Collapse contextual building actions

This commit is contained in:
Loïc Wisniewski 2026-08-13 20:49:15 +02:00
commit d79c756d5b
4 changed files with 110 additions and 34 deletions

View file

@ -63,18 +63,25 @@ func _process(delta: float) -> bool:
_fail("hangar allowed the last deployed ship to be stored")
return true
# #25: all three contextual controls have non-overlapping vertical
# rectangles when the mothership exposes Action, Transfer and Hangar.
controller.action_button.visible = true
controller.transfer_button.visible = true
controller.hangar_button.visible = true
# Context actions are compact until expanded. A mothership has three
# choices: research, transfer cargo and hangar, which must receive
# their own non-overlapping berth only after expansion.
var mothership: Node2D = load("res://Building.tscn").instantiate()
mothership.set("building_type", GameState.BUILDING_MOTHERSHIP)
controller.current_building = mothership
controller.context_actions_expanded = true
controller._layout_context_buttons()
var buttons: Array = [controller.action_button, controller.transfer_button, controller.hangar_button]
var buttons: Array = [controller.building_action_button, controller.transfer_button, controller.hangar_button]
for i in range(buttons.size() - 1):
if buttons[i].offset_bottom > buttons[i + 1].offset_top:
_fail("context buttons %d and %d overlap" % [i, i + 1])
return true
print("hangar crews and stores typed vessels; contextual buttons have separate berths")
controller._collapse_context_actions()
if controller.building_action_button.visible or controller.transfer_button.visible or controller.hangar_button.visible:
_fail("collapsing the context button left an action visible")
return true
mothership.free()
print("hangar crews and stores typed vessels; contextual actions expand and collapse")
print("TEST_HANGAR_MANAGEMENT: PASS")
quit(0)
return true