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).
19 lines
672 B
GDScript
19 lines
672 B
GDScript
extends Node2D
|
|
|
|
# Preview, not a test - the fleet-hold cap shown on the FLEET HOLD caption.
|
|
#
|
|
# bash tests/screenshot.sh res://tests/_fleet_cargo_limit_preview.tscn /tmp/cargo_limit.png 15 720x1280
|
|
|
|
|
|
func _ready() -> void:
|
|
GameState.buildings.clear()
|
|
GameState.extractors.clear()
|
|
GameState.rocks = 200
|
|
GameState.gas = 30
|
|
GameState.fleet_cargo = 0
|
|
var scene: Node = load("res://Main.tscn").instantiate()
|
|
add_child(scene)
|
|
var fleet: Node = scene.get_node("Fleet")
|
|
fleet.spawn_ships(3, Vector2.ZERO, PackedStringArray(["interceptor", "interceptor", "shield"]))
|
|
# Two cargo-capable interceptors (40) + one shield vessel (0) = 40 total.
|
|
GameState.fleet_cargo = 27
|