Refine context actions and preserve fleet landings

This commit is contained in:
Loïc Wisniewski 2026-08-14 23:15:12 +02:00
commit 663648d949
20 changed files with 197 additions and 103 deletions

View file

@ -63,24 +63,30 @@ func _process(delta: float) -> bool:
_fail("hangar allowed the last deployed ship to be stored")
return true
# Context actions are compact until expanded. A mothership has three
# choices: research, transfer cargo and hangar, which unfold in their
# own non-overlapping berths to the right only after expansion.
# Context actions are compact until expanded. A mothership unfolds
# research and hangar; transfer stays as a persistent shortcut beside
# Build and is not duplicated in the foldout.
var mothership: Node2D = load("res://Building.tscn").instantiate()
mothership.set("building_type", GameState.BUILDING_MOTHERSHIP)
mothership._ready()
controller.current_building = mothership
controller.context_actions_expanded = true
controller.transfer_button.visible = controller._has_transfer_context()
controller._layout_context_buttons()
var buttons: Array = [controller.building_action_button, controller.transfer_button, controller.hangar_button]
var buttons: Array = [controller.building_action_button, controller.hangar_button]
for i in range(buttons.size() - 1):
if buttons[i].offset_right > buttons[i + 1].offset_left:
_fail("context buttons %d and %d overlap" % [i, i + 1])
return true
controller._collapse_context_actions()
if controller.building_action_button.visible or controller.transfer_button.visible or controller.hangar_button.visible:
if controller.building_action_button.visible or controller.hangar_button.visible:
_fail("collapsing the context button left an action visible")
return true
if not controller.transfer_button.visible \
or controller.transfer_button.offset_top != controller.build_button.offset_top \
or controller.transfer_button.offset_left <= controller.build_button.offset_left:
_fail("transfer shortcut is not beside Build")
return true
mothership.free()
print("hangar crews and stores typed vessels; contextual actions expand and collapse")
print("TEST_HANGAR_MANAGEMENT: PASS")