Gas bombers consume gas from the fleet hold when firing (#60)

Shots cost GAS_PER_SHOT (5) from GameState.fleet_inventory, not the
bank - the fleet has to be carrying its own ammunition. The button's
enabled rule now also requires affordability, and a press on a ready-
but-unaffordable bomber still consumes the touch to explain itself via
a new status label (GasBombStatus, IconButton's own "greyed but still
pressable" convention) rather than either silently doing nothing or
consuming the bomber's cooldown for a shot that never fires.

Also documents a real, reproducible GDScript trap hit while writing
tests/test_gas_bomber_ammo.gd: a bare `ClassName.SOME_CONST` reference
anywhere in a -s entry test script can corrupt method resolution for
the WHOLE script, making an unrelated, earlier `some_node._process()`
call fail with "Nonexistent function '_process' in base 'Nil'" despite
the node being valid and the method existing (confirmed via
has_method()). Root cause unconfirmed; fixed by mirroring the constant
's value into a local const instead of referencing the class directly,
in all three gas-bomber tests.

tests/test_gas_bomber.gd and test_gas_bomber_cooldowns.gd updated to
stock fleet gas first, since shots are no longer free.
This commit is contained in:
Loïc Wisniewski 2026-08-16 18:54:44 +02:00
commit 17d0cf7e66
8 changed files with 230 additions and 9 deletions

View file

@ -229,6 +229,22 @@ icon = 32
glow_color = Color(0.82, 0.08, 0.48, 1)
core_color = Color(0.02, 0.09, 0.15, 1)
[node name="GasBombStatus" 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 = -480
offset_bottom = -430
theme_override_font_sizes/font_size = 18
theme_override_colors/font_color = Color(0.82, 0.08, 0.48, 1)
autowrap_mode = 2
horizontal_alignment = 1
text = ""
[node name="PivotCWButton" type="Control" parent="UI"]
mouse_filter = 2
anchor_left = 1.0