42 lines
1.4 KiB
GDScript
42 lines
1.4 KiB
GDScript
extends SceneTree
|
|
|
|
|
|
func _initialize() -> void:
|
|
var state: Node = root.get_node("GameState")
|
|
state.buildings.clear()
|
|
state.extractors.clear()
|
|
state.transporters.clear()
|
|
state.stored_vessels.clear()
|
|
state.reset_progression()
|
|
state.rocks = 0
|
|
state.gas = 30
|
|
state.build_time_scale = 0.01
|
|
|
|
state.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
|
|
state.add_building(GameState.BUILDING_TRANSPORT_HUB, Vector2.ZERO)
|
|
var lab_id: int = state.add_building(GameState.BUILDING_SHIP_LAB, Vector2(120, 0))
|
|
if not state.queue_lab_research(lab_id, "unlock_gas_bomber"):
|
|
_fail("could not queue gas research")
|
|
return
|
|
if state.outstanding_resource_cost(lab_id, GameState.RESOURCE_GAS) != 30:
|
|
_fail("lab did not request 30 gas")
|
|
return
|
|
|
|
# Large steps make each physical leg complete in one call; multiple calls
|
|
# still exercise dispatch -> bank pickup -> lab delivery -> hub return.
|
|
for i in range(12):
|
|
state._advance_transporters(10.0)
|
|
state._advance_lab_research(10.0)
|
|
if not state.vessel_is_unlocked(GameState.VESSEL_GAS_BOMBER):
|
|
_fail("hub transporters did not deliver gas to research")
|
|
return
|
|
if state.gas != 0 or state.building_resource(lab_id, GameState.RESOURCE_GAS) != 0:
|
|
_fail("gas was not consumed at the lab")
|
|
return
|
|
print("TEST_MULTI_RESOURCE_SUPPLY: PASS")
|
|
quit(0)
|
|
|
|
|
|
func _fail(message: String) -> void:
|
|
print("TEST_MULTI_RESOURCE_SUPPLY: FAIL (%s)" % message)
|
|
quit(1)
|