2026-08-14 22:46:25 +02:00
|
|
|
extends SceneTree
|
|
|
|
|
|
|
|
|
|
var state: Node
|
|
|
|
|
var lab_id: int
|
|
|
|
|
var elapsed: float = 0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _initialize() -> void:
|
|
|
|
|
state = root.get_node("GameState")
|
|
|
|
|
state.buildings.clear()
|
|
|
|
|
state.extractors.clear()
|
|
|
|
|
state.transporters.clear()
|
|
|
|
|
state.reset_progression()
|
|
|
|
|
state.rocks = 100
|
2026-08-16 20:14:29 +02:00
|
|
|
state.research_points = 1
|
2026-08-14 22:46:25 +02:00
|
|
|
state.build_time_scale = 0.02
|
|
|
|
|
state.add_building(state.BUILDING_MOTHERSHIP, Vector2.ZERO)
|
2026-08-15 00:09:10 +02:00
|
|
|
state.add_building(state.BUILDING_TRANSPORT_HUB, Vector2(50, 0))
|
2026-08-14 22:46:25 +02:00
|
|
|
lab_id = state.add_building(state.BUILDING_SHIP_LAB, Vector2(100, 0))
|
|
|
|
|
if not state.queue_lab_research(lab_id, "int_damage"):
|
|
|
|
|
return _fail("could not queue lab research")
|
|
|
|
|
if state.outstanding_cost(lab_id) != state.upgrade_cost("int_damage"):
|
|
|
|
|
return _fail("queued research did not expose its ore demand")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
|
|
|
elapsed += delta
|
|
|
|
|
if state.upgrade_level("int_damage") == 1:
|
|
|
|
|
if state.lab_research_order(lab_id).is_empty():
|
|
|
|
|
print("transporter supplied queued lab research end to end")
|
|
|
|
|
print("TEST_LAB_TRANSPORTER_DELIVERY: PASS")
|
|
|
|
|
quit(0)
|
|
|
|
|
return true
|
|
|
|
|
if elapsed > 5.0:
|
|
|
|
|
return _fail("lab still waiting: demand=%d transporter=%s stock=%d" % [
|
|
|
|
|
state.outstanding_cost(lab_id), state.transporters[0].state,
|
|
|
|
|
state.building_stock(lab_id)])
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _fail(message: String) -> bool:
|
|
|
|
|
print("TEST_LAB_TRANSPORTER_DELIVERY: FAIL (%s)" % message)
|
|
|
|
|
quit(1)
|
|
|
|
|
return true
|