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
32
CaptureLabel.gd
Normal file
32
CaptureLabel.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
extends Label
|
||||
|
||||
# Polls GameState directly, same convention as ResourceCounter/GasCounter,
|
||||
# so it stays correct without anyone having to push updates into it. Hidden
|
||||
# entirely when the current planet has no capture points (e.g. no setup
|
||||
# resolved for it) rather than showing "0/0".
|
||||
|
||||
var _was_conquered: bool = false
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var planet_id: String = GameState.planet_id
|
||||
var total: int = GameState.total_capture_points(planet_id)
|
||||
if total <= 0:
|
||||
visible = false
|
||||
return
|
||||
visible = true
|
||||
|
||||
var conquered: bool = GameState.is_planet_conquered(planet_id)
|
||||
if conquered:
|
||||
text = "CONQUERED"
|
||||
if not _was_conquered:
|
||||
_flash()
|
||||
else:
|
||||
text = "CAPTURED %d/%d" % [GameState.captured_point_count(planet_id), total]
|
||||
_was_conquered = conquered
|
||||
|
||||
|
||||
func _flash() -> void:
|
||||
modulate.a = 0.0
|
||||
var tween: Tween = create_tween()
|
||||
tween.tween_property(self, "modulate:a", 1.0, 1.2)
|
||||
Loading…
Reference in a new issue