Cap fleet cargo capacity by composition (#56)
The fleet hold was unbounded - GameState.fleet_inventory had no total_capacity, so a lone ship could carry unlimited resources. Capacity is now data-driven: only vessels declaring the "cargo" capability contribute their cargo_capacity stat (interceptor: 20; shield vessel and gas bomber: 0, unarmed transporters are never in the fleet at all). Fleet.gd recomputes it in the one place composition can change (spawn_ships/add_ship/store_ship/_on_ship_destroyed), which also covers the space<->surface scene-swap restore since that goes through spawn_ships(). Rock.gd and GasVentField.gd (the two "fly over it to collect" pickup paths) now check what collect_cargo()/collect_gas_cargo() actually accepted before consuming their source, instead of assuming an unlimited hold. The HUD's FLEET HOLD caption shows the live total/cap. Also fixes test_resource_transfer.gd, which pushed more ore through a 2-ship fleet than the new cap allows - it now spawns the largest fleet every unlocked doctrine permits, since that test is about the transfer UI rather than the cap itself (test_fleet_cargo_limit.gd owns that).
This commit is contained in:
parent
cbe07bbb55
commit
f040327523
11 changed files with 250 additions and 12 deletions
|
|
@ -88,7 +88,12 @@ func _process(delta: float) -> bool:
|
|||
scene.get_node("AsteroidField").set_process(false)
|
||||
scene.get_node("EnemySpawner").set_process(false)
|
||||
_clear_hazards()
|
||||
fleet.spawn_ships(2, MOTHERSHIP_AT)
|
||||
# #56 gave the hold a finite, composition-driven capacity. This
|
||||
# test is about the transfer UI, not that cap - test_fleet_cargo_
|
||||
# limit.gd owns the cap itself - so it spawns the largest fleet
|
||||
# every unlocked doctrine allows (8 interceptors x 20 = 160),
|
||||
# comfortably above every hand-picked amount below.
|
||||
fleet.spawn_ships(game_state.max_fleet_size(), MOTHERSHIP_AT)
|
||||
var field: Node = scene.get_node("BuildingField")
|
||||
field.place(GameState.BUILDING_MOTHERSHIP, MOTHERSHIP_AT)
|
||||
mothership_id = int(game_state.buildings[-1].id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue