2026-08-15 04:45:15 +02:00
|
|
|
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
|
2026-08-15 10:41:18 +02:00
|
|
|
state.gas = 10
|
2026-08-16 20:14:29 +02:00
|
|
|
state.research_points = 1
|
2026-08-15 04:45:15 +02:00
|
|
|
state.build_time_scale = 0.01
|
|
|
|
|
|
|
|
|
|
state.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
|
|
|
|
|
state.add_building(GameState.BUILDING_TRANSPORT_HUB, Vector2.ZERO)
|
Build the logistics crews, and let them burn energy
#216: transport hubs and spacial workshops no longer conjure their crews.
Transporters and repair drones are ordered at a ship crafter, assigned per
building through a new Station menu, flown out from the mothership hangar,
and spent by the work they do - 20 runs, 12 repairs, counted where the run
ENDS so nothing retires with cargo in the air or a building half repaired.
A spent vessel is gone, so the structure is short again and the player has
to build another. The menu shows what each one has left, worst first.
Craftability needed its own flag: "the crafter can make it" and "it can take
a berth in the fleet" stopped being the same question.
#217: transporters crawl at 120 rather than 150, and a Burn Drive lets them
carry energy and spend it to travel far faster. Fetching it is a leg of its
own, to the nearest store that has any - so a refuelling transporter cannot
be dispatched mid-errand - and the leg flown to COLLECT fuel is not charged
for it. Unresearched, nothing detours and nothing changes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
2026-09-05 19:09:35 +02:00
|
|
|
# #216: crews are built and flown in now, not provisioned with the
|
|
|
|
|
# structure. This test is about what a crew DOES, so it is put
|
|
|
|
|
# straight at its post - test_transporter_supply.gd owns the journey.
|
|
|
|
|
load("res://tests/_staff.gd").staff_all(state)
|
2026-08-15 04:45:15 +02:00
|
|
|
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
|
2026-08-15 10:41:18 +02:00
|
|
|
# Reproduce a first 20-unit delivery followed by the remaining 10 being
|
|
|
|
|
# available at the mothership. Full extractors must not take priority over
|
|
|
|
|
# completing this already-partly-supplied research order.
|
|
|
|
|
state.deposit_resource_to_building(lab_id, GameState.RESOURCE_GAS, 20)
|
|
|
|
|
state.add_extractor("Ore A", Vector2(240, 0), GameState.RESOURCE_ORE)
|
|
|
|
|
state.add_extractor("Ore B", Vector2(360, 0), GameState.RESOURCE_ORE)
|
|
|
|
|
for extractor in state.extractors:
|
|
|
|
|
extractor.inventory.deposit(GameState.RESOURCE_ORE, state.transporter_load_limit())
|
|
|
|
|
if state.outstanding_resource_cost(lab_id, GameState.RESOURCE_GAS) != 10:
|
|
|
|
|
_fail("partly supplied lab did not request its remaining 10 gas")
|
|
|
|
|
return
|
|
|
|
|
state._dispatch_transporters()
|
|
|
|
|
if not state._transporter_inbound_to(lab_id):
|
|
|
|
|
_fail("extractor collection took priority over waiting research")
|
2026-08-15 04:45:15 +02:00
|
|
|
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)
|