Laser shooters consume energy from the fleet hold when firing (#61)
Mirrors #60's gas bomber ammunition exactly: ENERGY_PER_SHOT (8) drawn from GameState.fleet_inventory before consuming the firing ship's cooldown, the button's enabled rule requires affordability too, and an unaffordable-but-otherwise-ready press still explains itself through a new LaserStatus label rather than silently doing nothing. Added two small generic GameState helpers this needed: deposit_fleet_resource()/deposit_bank_resource(), counterparts to #60's withdraw_fleet_resource() for resources (energy) with no dedicated fleet_cargo/fleet_gas_cargo-style property. Along the way, confirmed deposit_resource_to_building() on a "bank" building deposits into that building's own per-record inventory, NOT bank_inventory itself - only building_resource()/building_inventory() special-case the "bank" capability to redirect there. test_laser_vessel.gd (#58) updated to stock fleet energy first, since shots are no longer free - same fix #60 required for the gas bomber's own pre-existing tests. Also fixed test_laser_vessel.gd's own instance of the bare-ClassName.CONST script-corruption trap (documented in #60's commit): var skill: LaserController and a bare LaserController.BEAM_HALF_WIDTH reference, mirrored into a local const instead.
This commit is contained in:
parent
17d0cf7e66
commit
facbd83dd2
6 changed files with 236 additions and 6 deletions
14
GameState.gd
14
GameState.gd
|
|
@ -110,6 +110,20 @@ func withdraw_fleet_resource(resource_type: String, amount: int) -> int:
|
|||
return fleet_inventory.withdraw(resource_type, amount)
|
||||
|
||||
|
||||
# #61: generic counterparts, for resources (energy) with no dedicated
|
||||
# fleet_cargo/fleet_gas_cargo-style property of their own. Deliberately NOT
|
||||
# the same as deposit_resource_to_building() on a "bank" building - that
|
||||
# deposits into the building's OWN per-record inventory, not bank_inventory
|
||||
# itself (only building_resource()/building_inventory() special-case "bank"
|
||||
# capability to redirect there).
|
||||
func deposit_fleet_resource(resource_type: String, amount: int) -> int:
|
||||
return fleet_inventory.deposit(resource_type, amount)
|
||||
|
||||
|
||||
func deposit_bank_resource(resource_type: String, amount: int) -> int:
|
||||
return bank_inventory.deposit(resource_type, amount)
|
||||
|
||||
|
||||
# #56: total across every resource type in the hold, and the combined cap
|
||||
# that limits it - a HUD readout wants both, not any one resource's amount.
|
||||
func fleet_cargo_used() -> int:
|
||||
|
|
|
|||
Loading…
Reference in a new issue