Prioritize queued logistics deliveries

This commit is contained in:
Loïc Wisniewski 2026-08-15 10:41:18 +02:00
commit f5c60f8805
2 changed files with 46 additions and 29 deletions

View file

@ -9,7 +9,7 @@ func _initialize() -> void:
state.stored_vessels.clear()
state.reset_progression()
state.rocks = 0
state.gas = 30
state.gas = 10
state.build_time_scale = 0.01
state.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
@ -18,8 +18,20 @@ func _initialize() -> void:
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")
# 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")
return
# Large steps make each physical leg complete in one call; multiple calls