Show the extractor derrick the moment it is built, not on respawn
Follow-up to #9: the marker was resolved once in Planet._ready() on the assumption that extractors are built on PlanetSurface.tscn, so a Planet node could never outlive a change to its own answer. That assumption was wrong. Extractors are built from SPACE, via BuildController._planet_under_fleet() with the fleet parked on the planet, so the Planet node is already in the tree with _ready() long since run. The derrick therefore did not appear until the planet happened to despawn and respawn - building one read as doing nothing. GameState now emits extractor_added, and Planet keeps its marker in step with it, redrawing only when its own answer actually changes. The test missed this because it spawned a fresh planet after registering the extractor, which is not the order the game does it in. It now keeps a planet alive across the build and asserts the derrick appears on that node. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
8dd5d7b78f
commit
2eb779e5de
3 changed files with 42 additions and 4 deletions
|
|
@ -270,12 +270,20 @@ func has_extractor_at(planet_name: String) -> bool:
|
|||
return false
|
||||
|
||||
|
||||
signal extractor_added(planet_name: String)
|
||||
|
||||
|
||||
func add_extractor(planet_name: String, at_position: Vector2) -> void:
|
||||
extractors.append({
|
||||
"position": at_position,
|
||||
"planet_name": planet_name,
|
||||
"progress": 0.0,
|
||||
})
|
||||
# An extractor is built from SPACE, with the fleet parked on the planet -
|
||||
# so the Planet node is already in the tree with its _ready() long since
|
||||
# run. Without this it kept showing no derrick until it happened to
|
||||
# despawn and respawn, which reads as the build having done nothing.
|
||||
extractor_added.emit(planet_name)
|
||||
|
||||
|
||||
func get_hauler_route_time(extractor: Dictionary) -> float:
|
||||
|
|
|
|||
Loading…
Reference in a new issue