Repository navigation
feat(admin-panel): add a terrain editor for maps and their terrain variants - #1236
Merged
Merged
Conversation
…n variants The new page /terrain-editor shows the terrain of a map and lets you paint its attributes (safezone, blocked, no ground, water) with a brush, a rectangle or a fill tool, adding, removing or replacing the selected attributes. It edits the default terrain and the terrain variants of a map, supports zoom, panning, a tile grid, undo and redo. Terrain files can be imported (server *.att or client EncTerrain*.att) and downloaded in both formats, so that the changed terrain can also be distributed to the game client. The page logic which loads the maps, saves and asks before discarding changes is shared with the map editor page through a common base class. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KESqfok2EbBMX41efgZUvw
Deploying openmudocs with
|
| Latest commit: |
27d77d2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a8f9a03e.openmudocs.pages.dev |
| Branch Preview URL: | https://claude-elegant-euler-6nx3ol.openmudocs.pages.dev |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KESqfok2EbBMX41efgZUvw
Adds braces to single-line ifs and parentheses to arrow function parameters, replaces the constant loop condition of the brush line, and wraps over-long lines in the terrain editor documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KESqfok2EbBMX41efgZUvw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dedicated Terrain editor to the admin panel (Game configuration → Terrain editor, route
/terrain-editor), next to the existing map editor.GameMapDefinition.TerrainData) and the terrain variants (GameMapTerrainVariant, e.g. Crywolf peace/occupied/war) of a map.*.att(65539 bytes) and the encrypted clientEncTerrain*.att(byte and word-per-tile variants).*.attfile and as the encrypted clientEncTerrain<N>.attfile, so changed terrains can be shipped to players.Screenshots
The war terrain variant of the Crywolf fortress:
Lorencia at 600% zoom with the tile grid on. The blue area was just added as water with the rectangle tool, and the dashed frame is the preview of the next rectangle:
Implementation notes
IJSStreamReference, because it exceeds the SignalR message limit, and assigns it to the entity. Unsaved-changes detection and saving then work through the persistence context, like in the map editor.TerrainFileConverterhandles the server and client formats. The client encryption (map file XOR/key chain plus the 3-byte XOR key) follows the open source client (ZzzLodTerrain.h,_crypt.hin MuMain), not decompiled code.EditMap(loading maps, saving, asking before discarding changes) moved intoMapEditorPageBase<TEditor>, soEditMapand the newEditTerrainare a few lines each instead of a copy.wwwroot/css/terrain-editor.css(registered inExports), likemap-editor.css. In the all-in-one startup host, the scoped CSS bundle ofWeb.Sharedcurrently returns 404, so a.razor.csswould not apply.Resources.resxwith German and Chinese translations.docs-website/docs/admin-panel/map-editor.md, and updated the overview row.Testing
dotnet test tests/MUnique.OpenMU.Web.Tests: 252 passed. New tests:TerrainFileConverterTests: server/client round trips, header, rejecting invalid files, and a known-answer check of the client encryption. The expected bytes come from compiling MuMain's ownMapFileEncrypt/BuxConvert.TerrainEditorTests(bUnit): variant selection, initial load, and the client file name and content on download.Startup -demo:EncTerrain1.attwith MuMain's own decryption code: header0 0 255 255, size 65540, and the client's Lorencia sanity check (TerrainWall[123*256+135] == 5) passes.Codacy
The style findings (braces, arrow parentheses, constant loop condition, docs line length) are fixed. The remaining findings are false positives or thresholds I didn't follow:
ElementReferencefields and_canUndo/_canRedo: they are assigned and read by the Razor markup (@ref,disabled=).MapEditorPageBase: it does implementIDisposableand disposes_disposeCts.TileCountconstant.security/detect-object-injectionon typed-array indexing.complexitywith a maximum of 4.return { x, y }).Noticed, not changed
MUnique.OpenMU.Web.Shared.*.bundle.scp.css, etc.) return 404 in the startup host.LocalizedStringin the map editor heading, noticed here, is fixed by fix(localization): show translations instead of serialized localized strings #1245.)🤖 Generated with Claude Code
https://claude.ai/code/session_01KESqfok2EbBMX41efgZUvw