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:
parent
65fe19aeb6
commit
c4e2ee7178
16 changed files with 511 additions and 36 deletions
|
|
@ -12,6 +12,15 @@ extends SceneTree
|
|||
|
||||
const SCRATCH_SETUP_PATH: String = "res://PlanetSetups/_test_scratch_setup.tres"
|
||||
|
||||
# Resolved via load() inside _initialize(), NOT a top-level `const ...
|
||||
# preload(...)` - a top-level preload in a script-mode ENTRY point (-s
|
||||
# this_file.gd) evaluates during this file's own early compilation, which
|
||||
# can happen before autoloads are registered, and CapturePoint.gd
|
||||
# references GameState in a function body (resolved at compile time). See
|
||||
# test_capture_points.gd for the full explanation.
|
||||
var PLANET_SETUP_SCRIPT: Script
|
||||
var CAPTURE_POINT_SCRIPT: Script
|
||||
|
||||
var game_state: Node
|
||||
var rocky_setup: Resource
|
||||
var stage: int = 0
|
||||
|
|
@ -20,6 +29,8 @@ var pending_surface: Node
|
|||
|
||||
|
||||
func _initialize() -> void:
|
||||
PLANET_SETUP_SCRIPT = load("res://PlanetSetup.gd")
|
||||
CAPTURE_POINT_SCRIPT = load("res://CapturePoint.gd")
|
||||
# --- 1. determinism and profile filtering ---
|
||||
rocky_setup = PlanetSetups.setup_for_planet("chunk:3:7", "rocky")
|
||||
if rocky_setup == null:
|
||||
|
|
@ -42,7 +53,7 @@ func _initialize() -> void:
|
|||
|
||||
# --- 2. dropping a new .tres is picked up by rescan() ---
|
||||
var before_count: int = PlanetSetups.setups_for_profile("rocky").size()
|
||||
var scratch: Resource = PlanetSetup.new()
|
||||
var scratch: Resource = PLANET_SETUP_SCRIPT.new()
|
||||
scratch.setup_id = "_test_scratch_setup"
|
||||
scratch.display_name = "Scratch"
|
||||
scratch.surface_profile_id = "rocky"
|
||||
|
|
@ -89,14 +100,14 @@ func _process(delta: float) -> bool:
|
|||
if host.setup != rocky_setup:
|
||||
pending_surface.free()
|
||||
return _fail("host did not receive the deterministically resolved setup")
|
||||
var marker_count: int = 0
|
||||
var point_count: int = 0
|
||||
for child in host.get_children():
|
||||
if child is NeonPiece:
|
||||
marker_count += 1
|
||||
if marker_count != rocky_setup.capture_points.size():
|
||||
if child.get_script() == CAPTURE_POINT_SCRIPT:
|
||||
point_count += 1
|
||||
if point_count != rocky_setup.capture_points.size():
|
||||
pending_surface.free()
|
||||
return _fail("host placed %d markers for %d capture points" % [
|
||||
marker_count, rocky_setup.capture_points.size()
|
||||
return _fail("host placed %d capture points for %d authored ones" % [
|
||||
point_count, rocky_setup.capture_points.size()
|
||||
])
|
||||
pending_surface.free()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue