Improve ship lab upgrade selection

This commit is contained in:
Loïc Wisniewski 2026-08-13 16:45:08 +02:00
commit 8219893cda
3 changed files with 208 additions and 29 deletions

View file

@ -90,6 +90,38 @@ func _process(delta: float) -> bool:
1:
if elapsed < 0.3:
return false
# The lab is a direct vessel -> upgrade flow: tapping a vessel
# shows its own upgrade cards, and tapping a card changes the
# purchase detail. A locked vessel must show its unlock alone.
var lab_menu: Control = controller.get_node("../UI/LabMenu")
var lab_card_0: Control = controller.get_node("../UI/LabMenu/Upgrade0")
var lab_card_1: Control = controller.get_node("../UI/LabMenu/Upgrade1")
var lab_card_3: Control = controller.get_node("../UI/LabMenu/Upgrade3")
var lab_detail: Label = controller.get_node("../UI/LabMenu/DetailLabel")
var lab_buy: IconButton = controller.get_node("../UI/LabMenu/BuyButton")
lab_menu.visible = true
controller.call("_on_lab_vessel", 1)
if not lab_card_0.visible or lab_card_1.visible:
print("TEST_SHIP_LAB: FAIL (locked shield page did not show only its unlock)")
quit(1)
return true
controller.call("_on_lab_upgrade", 0)
if not "Unlock Shield Vessel" in lab_detail.text or not lab_buy.enabled:
print("TEST_SHIP_LAB: FAIL (unlock card did not select a purchasable detail)")
quit(1)
return true
controller.call("_on_lab_vessel", 0)
if not lab_card_0.visible or not lab_card_3.visible:
print("TEST_SHIP_LAB: FAIL (interceptor upgrade cards were not shown)")
quit(1)
return true
controller.call("_on_lab_upgrade", 2)
if not "Targeting Array" in lab_detail.text:
print("TEST_SHIP_LAB: FAIL (tapping an upgrade did not update its detail)")
quit(1)
return true
print("lab cards are vessel-specific and selectable")
# --- 3. buying raises the level and charges ------------------
var before_rocks: int = game_state.rocks
var first_cost: int = game_state.upgrade_cost("int_damage")