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:
parent
116e0f97d3
commit
17d0cf7e66
8 changed files with 230 additions and 9 deletions
|
|
@ -2,7 +2,7 @@ extends SceneTree
|
|||
|
||||
var main: Node
|
||||
var fleet: Node
|
||||
var skill: GasBombController
|
||||
var skill: Node
|
||||
var elapsed := 0.0
|
||||
|
||||
|
||||
|
|
@ -12,6 +12,8 @@ func _initialize() -> void:
|
|||
state.extractors.clear()
|
||||
state.transporters.clear()
|
||||
state.vessel_levels["unlock_gas_bomber"] = 1
|
||||
# #60: shots draw from the fleet hold now - stock enough for both fires.
|
||||
state.fleet_gas_cargo = 20
|
||||
main = load("res://Main.tscn").instantiate()
|
||||
root.add_child(main)
|
||||
fleet = main.get_node("Fleet")
|
||||
|
|
@ -53,7 +55,7 @@ func _process(delta: float) -> bool:
|
|||
|
||||
# Rearming one bomber restores one available shot without touching the
|
||||
# other bomber's cooldown.
|
||||
first.tick(GasBombController.COOLDOWN)
|
||||
first.tick(5.0) # matches GasBombController.COOLDOWN
|
||||
skill._process(0.0)
|
||||
if not first.is_ready() or second.is_ready() or not skill.button.enabled:
|
||||
return _fail("one completed cooldown did not restore exactly one shot")
|
||||
|
|
|
|||
Loading…
Reference in a new issue