Planet conquest state and extractor placement gate #41
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. Data layer and gate only - the capture gameplay itself is a separate ticket.
Planets must be conquered before an extractor can be built on them. Until then only manual gathering is possible, which is already the behaviour on the surface (
RockField/Rock), so nothing has to be added for that half.Scope
GameState.gd, next to the existingextractorsarray (~line 945, same keying byplanet_id):var planet_capture: Dictionary = {}mappingplanet_id -> {"captured": Array[bool], "conquered": bool}signal planet_conquered(planet_id: String)func register_capture_points(planet_key: String, total: int) -> void- creates the entry on first landing, and is idempotent: re-landing on a planet must NOT wipe already-captured points.func capture_state(planet_key: String) -> Dictionaryfunc is_point_captured(planet_key: String, index: int) -> boolfunc mark_point_captured(planet_key: String, index: int) -> void- setsconqueredand emitsplanet_conqueredonce every entry is true.func is_planet_conquered(planet_key: String) -> boolfunc captured_point_count(planet_key: String) -> intPlanet keys are the stable
planet_id("chunk:x:y", fromWorldGen.planet_data_at_chunk) - never the display name, which is not unique (see #37).BuildController.gd- four existing extractor gates, all keyed off_planet_under_fleet():_refresh_build_option_states()(~line 557): aplacement_mode == "planet"option is enabled only if the planet is also conquered._refresh_build_status()(~line 547): over an unconquered planet, say"Over %s - capture it before building an extractor".has_extractor_atone -"%s is not captured yet - take all its capture points.",can_build = false._confirm_build()(~line 639): re-check conquest alongside the existinghas_extractor_atre-check (the fleet keeps flying while the popup is open) and bail with abuild_status.textmessage, spending nothing.Out of scope
Capture points, enemies, surface HUD, showing conquest on the world map.
Acceptance criteria
GameStatereports every planet unconquered._confirm_build()places no extractor and spends no ore.register_capture_points(id, 3)and threemark_point_capturedcalls,is_planet_conquered(id)is true andplanet_conqueredfired exactly once; the same build flow then places the extractor and charges its cost.register_capture_pointscalled a second time with the same total preserves captured points.Tests
New
tests/test_planet_conquest_gate.gd. Runbash tests/run_tests.sh conquest, thenbash tests/run_tests.sh extractorandbash tests/run_tests.sh buildfor regressions.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
a1ad6cc.GameState.planet_capturetracks per-planet capture progress, keyed by the same stableplanet_idasextractors;register_capture_pointsis idempotent so re-landing never wipes progress.BuildController's four extractor placement checks (menu enable state, status text, info popup, confirm) all re-check conquest, not just proximity/duplication.New test
tests/test_planet_conquest_gate.gdcovers the unconquered-blocks-build and conquered-allows-build paths plus the idempotent-registration/single-signal-fire cases. Extractor and build regressions (test_extractor_building,test_build_*) still pass - the existing extractor test now pre-conquers its target planet in setup rather than the gate being weakened.No capture UI/enemies yet - that's #43.