Planet setup map editor #48
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #40. Depends on the planet-setups ticket (data format) and the main-menu ticket (entry point).
Scope
PlanetSetupEditor.tscn+PlanetSetupEditor.gd, reachable from the main menu, 720x1280 touch UI in the existing idiom.PlanetSurfaceProfiles.get_profile(id)so the canvas shows the real surface appearance rather than a blank sheet.EnemyDefinitionsentry. Generated from the registry, never hardcoded, so a new enemy definition shows up automatically. Draw each entry with its definition's hull and colour.Main.tscn/TouchJoystick.gd. Show a grid or origin marker so positions are judgeable - the fleet lands atVector2.ZERO.PlanetSetupsfor editing, or start a new one and name it.ResourceSaver.save()tores://PlanetSetups/<setup_id>.tres, producing exactly thePlanetSetup+PlanetSetupSpawnstructure the game already loads.res://is writable only when running from the project (the Godot editor, or the Godot Android app this project is opened with) - never from an exported build. Guard the save and show a clear message ("setups can only be saved when running from the project") instead of failing silently. Do not add auser://fallback: #40 requires setups to live in the game as committed resources.res://PlanetSetups/withDirAccess, so a newly saved file is picked up without touching any code; a Godot reimport may be needed before it appears.GameStategameplay state.Acceptance criteria
EnemyDefinitionsappears in the palette with no editor code change.res://is not writable, saving reports the reason instead of appearing to succeed.Tests
tests/test_setup_editor.gd- drive the editor's model directly (place / move / delete / save / reload) and assert the saved resource round-trips; the touch layer itself can stay out of the headless test.bash tests/run_tests.sh editor, plus a 720x1280 screenshot of the editor with items placed.Repo notes (read before starting)
/storage/emulated/0/GodotProjects/SpaceshipTest.touchon it. Android FUSE does not bump mtime under~/storage/shared, and Godot's import cache will silently keep serving the old version, making a correct fix look like it did nothing.bash tests/run_tests.sh <substring>; full suite with no argument. Tests areSceneTreescripts printingTEST_NAME: PASS/TEST_NAME: FAIL (reason)and callingquit(0|1)- copy the shape oftests/test_gas_bomber_cooldowns.gd.bash tests/screenshot.sh <res://Scene.tscn> <out.png> <frames> 720x1280. Use few frames (~10-20); the software rasterizer is slow.--headlessrenders nothing at all, so it cannot validate visuals.NeonDraw/NeonPiece; do not introduce a different visual idiom.*Definitionresources plus capability component scenes. Do not addif type == "..."branches.FileAccess, nouser://anywhere outside this ticket's explicit scope).GameStateis an in-memory autoload. Do not invent a save system.Implemented and pushed as
df2f252.PlanetSetupEditorauthorsPlanetSetupresources: pick a surface profile (drives the real lunar_surface background, not a blank sheet), place/move/delete capture points and enemies from a palette generated straight offEnemyDefinitions.all()(a new enemy definition shows up with no editor change), pan/pinch-zoom the canvas with the same touch idiom asGameController, then save tores://PlanetSetups/<id>.tresviaResourceSaver.new_setup/load_setup/add_*/move_*/remove_*/save_setup) are the whole model and work standalone, which is what lettests/test_setup_editor.gddrive placement/move/delete/save/reload directly without simulating touch input, per the ticket's own guidance.Verified: placed 3 capture points + 2 enemies, saved, reopened in a fresh editor instance, confirmed exact round-trip, moved/deleted after reopening. Palette entry count is asserted against
EnemyDefinitions.all().size() + 1rather than a hardcoded number, so it stays correct as more enemy types land. Verified visually at 720x1280 with items placed, selection highlighting, and the dynamic palette all visible.Every cross-file reference in this file is a preloaded script const rather than a bare global class name, matching #42/#44's load-order notes.
This closes out the #40 breakdown: #41-#48 are now all implemented, tested, and merged.