spaceship/tests/_staff.gd
Loïc Wisniewski 265e121cb0 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

29 lines
1.3 KiB
GDScript

extends RefCounted
# #216 made hub and workshop crews built things: ordered at a ship crafter,
# flown out from the mothership hangar, and worn out by the work they do.
#
# A test that is about what a crew DOES should not have to build and fly one
# in first, so this puts them straight at their post. The assignment is still
# made, so the structure counts them as its own and reports them the way it
# would if they had arrived on their own - only the journey is skipped.
#
# test_transporter_supply.gd owns the journey itself, and does not use this.
# Tops the structure UP to `count`, rather than adding that many: a hub asked
# for three when it already holds two needs one more, and the order is clamped
# to what it can hold anyway.
static func staff(game_state: Node, building_id: int, count: int) -> void:
game_state.set_station_desired(building_id, count)
while game_state.station_crew(building_id) < game_state.station_desired(building_id):
game_state._station_arrived(building_id)
# Every hub and workshop already standing, filled to what it can hold. For
# tests that just need logistics to work at all.
static func staff_all(game_state: Node) -> void:
for building in game_state.buildings:
if game_state.station_vessel_type(building) == "":
continue
staff(game_state, int(building.id), game_state.station_capacity(building))