Add capture points and the planet conquest loop (#43)

CapturePoint tracks neutral/blocked/capturing/captured state by polling
proximity each frame (a ship in capture_radius, no enemy within
enemy_clear_radius), draining gradually rather than resetting when
interrupted, and calling GameState.mark_point_captured() on completion.
PlanetSetupHost now instantiates the real CapturePoint scene per
authored point (restoring already-captured state immediately on
re-landing) and spawns each setup's authored enemies, replacing the
placeholder markers from #42. CaptureLabel is a small self-polling HUD
(same convention as ResourceCounter) showing "CAPTURED n/m" or
"CONQUERED" with a one-shot fade on completion, themed per surface
profile alongside the existing bank/fleet captions.

test_planet_atmosphere_transition.gd's "no enemies on a landed
surface" assumption no longer holds now that setups can place guard
enemies by design - narrowed the check to what it actually needs to
prove: no space-side EnemySpawner/AsteroidField node leaks across the
scene swap.

Part of the #40 conquest-mechanic breakdown.
This commit is contained in:
Loïc Wisniewski 2026-08-15 21:22:10 +02:00
commit c4e2ee7178
16 changed files with 511 additions and 36 deletions

View file

@ -6,10 +6,14 @@ extends SceneTree
# scene swap (Main.tscn <-> PlanetSurface.tscn) rather than an in-place
# overlay: standing on a planet shows the prompt, pressing it fades out
# and swaps to PlanetSurface.tscn with the SAME surviving ship count,
# where no asteroid/enemy ever exists (not hidden - structurally absent,
# since PlanetSurface.tscn has no such nodes at all) and the fleet is
# still fully flyable. Exiting fades back to Main.tscn with the fleet
# restored at the world position it left from.
# where no asteroid ever exists and no space-side EnemySpawner/AsteroidField
# node carries over (structurally absent - PlanetSurface.tscn has no such
# nodes at all), and the fleet is still fully flyable. Landed enemies MAY
# still exist post-#43 (PlanetSetupHost places authored ones to guard
# capture points), which is a different thing from the space-side spawner
# leaking across the swap - see the structural check below. Exiting fades
# back to Main.tscn with the fleet restored at the world position it left
# from.
var main_scene: Node
var fleet: Node
@ -163,11 +167,16 @@ func _process(delta: float) -> bool:
var ship_count_ok: bool = surface_fleet.ships.size() == 5
var composition_ok: bool = surface_fleet.vessel_types() == expected_vessel_types
var no_asteroids: bool = get_nodes_in_group("asteroids").is_empty()
var no_enemies: bool = get_nodes_in_group("enemies").is_empty()
print("ship_count_ok=%s (count=%d) no_asteroids=%s no_enemies=%s" % [
ship_count_ok, surface_fleet.ships.size(), no_asteroids, no_enemies
# Landed enemies from an authored PlanetSetup are expected
# post-#43 (they guard capture points) - what this test actually
# owes is that the SPACE-SIDE spawner nodes never carry across,
# checked structurally rather than by assuming zero enemies.
var no_space_spawners: bool = current_scene.get_node_or_null("EnemySpawner") == null \
and current_scene.get_node_or_null("AsteroidField") == null
print("ship_count_ok=%s (count=%d) no_asteroids=%s no_space_spawners=%s" % [
ship_count_ok, surface_fleet.ships.size(), no_asteroids, no_space_spawners
])
if not (ship_count_ok and composition_ok and no_asteroids and no_enemies):
if not (ship_count_ok and composition_ok and no_asteroids and no_space_spawners):
print("TEST_PLANET_ATMOSPHERE_TRANSITION: FAIL (surface scene contents wrong)")
quit(1)
return true