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
16
Main.tscn
16
Main.tscn
|
|
@ -303,6 +303,22 @@ autowrap_mode = 2
|
|||
horizontal_alignment = 1
|
||||
text = ""
|
||||
|
||||
[node name="LaserStatus" type="Label" parent="UI"]
|
||||
mouse_filter = 2
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -344
|
||||
offset_right = -24
|
||||
offset_top = -540
|
||||
offset_bottom = -490
|
||||
theme_override_font_sizes/font_size = 18
|
||||
theme_override_colors/font_color = Color(0.3, 0.9, 1, 1)
|
||||
autowrap_mode = 2
|
||||
horizontal_alignment = 1
|
||||
text = ""
|
||||
|
||||
[node name="PivotCWButton" type="Control" parent="UI"]
|
||||
mouse_filter = 2
|
||||
anchor_left = 1.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue