Refine context actions and preserve fleet landings
This commit is contained in:
parent
18a7d44db4
commit
663648d949
20 changed files with 197 additions and 103 deletions
|
|
@ -24,6 +24,7 @@ var scene: Node
|
|||
var field: Node
|
||||
var controller: Node
|
||||
var map_content: Node2D
|
||||
var hub_building: Node2D
|
||||
var hub: Node2D
|
||||
var stage: int = 0
|
||||
var elapsed: float = 0.0
|
||||
|
|
@ -101,11 +102,19 @@ func _process(delta: float) -> bool:
|
|||
return false
|
||||
for b in field.spawned:
|
||||
if is_instance_valid(b) and b.building_type == GameState.BUILDING_TRANSPORT_HUB:
|
||||
hub_building = b
|
||||
hub = b.visual
|
||||
if hub == null:
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (never spawned)")
|
||||
quit(1)
|
||||
return true
|
||||
if not hub_building.available_actions().is_empty():
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (offers a manual resource transfer)")
|
||||
quit(1)
|
||||
return true
|
||||
for ship in scene.get_node("Fleet").ships:
|
||||
ship.position = HUB_AT
|
||||
scene.get_node("Fleet").move_to(HUB_AT)
|
||||
|
||||
# --- 3. drawn as itself, not via the crafter catch-all -------
|
||||
# _hub_traffic only exists if _ready() took the transport-hub
|
||||
|
|
@ -142,6 +151,14 @@ func _process(delta: float) -> bool:
|
|||
# --- 4. animates without ever redrawing (#10) ----------------
|
||||
if elapsed < 2.0:
|
||||
return false
|
||||
if controller.current_building != hub_building \
|
||||
or controller.action_button.visible or controller.transfer_button.visible:
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (actionless hub context current=%s expected=%s action=%s transfer=%s)" % [
|
||||
controller.current_building, hub_building, controller.action_button.visible,
|
||||
controller.transfer_button.visible,
|
||||
])
|
||||
quit(1)
|
||||
return true
|
||||
print("rasterisations after %.1fs: %d" % [elapsed, hub.draw_count])
|
||||
if hub.draw_count != 1:
|
||||
print("TEST_TRANSPORT_HUB_BUILDING: FAIL (redrew its geometry %d times to animate)" % hub.draw_count)
|
||||
|
|
|
|||
Loading…
Reference in a new issue