PC controls: keyboard pan/zoom, Tab cycle, Escape stack, right-click deselect
Adds full PC keyboard+mouse support on top of existing touch controls. Touch paths untouched. All input goes through named actions in project.godot. Bindings: - WASD / arrows: camera pan (speed scales with zoom) - = / -: keyboard zoom in/out - C / Home: center on selected pawn - Tab / Shift+Tab: cycle through pawns (pans camera to selection) - B / L / P / ,: toggle BuildDrawer / AlertsLog / WorkPriorityMatrix / Settings - Escape: cancel active designation tool > close topmost panel > deselect pawn - Right-click: cancel active tool or deselect pawn (RTS convention) - F: speed_cycle (action restored; handler still TODO) - pawn_prev action removed; Shift+Tab read via event.shift_pressed inline Escape priority enforced by Designation._input running before _unhandled_input plus each panel consuming its own cancel action when visible. Also fixes a pre-existing pre-Phase-17 bug: WorkPriorityMatrix, AlertsLog, StorytellerModal, LoadMenu, and SettingsMenu had MOUSE_FILTER_STOP Controls (Backdrop / Dim) that remained input-active when the panel was "closed" — their open/close paths only toggled _root.visible / _panel.visible, never CanvasLayer.visible. World mouse events (right-click deselect, left-click pawn-select) were silently eaten. Now each _set_visible / open / close toggles self.visible (the CanvasLayer) so input dispatch shuts off properly. Verified end-to-end via MCP runtime: WASD pan, zoom keys, Tab+Shift+Tab cycle, B-open + Escape-close, right-click deselect, left-click pawn-select all working in sequence with no input bleed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b9093dd24b
commit
0b2e0fcd03
11 changed files with 300 additions and 1 deletions
|
|
@ -159,6 +159,27 @@ func cells() -> Array[Vector2i]:
|
|||
|
||||
# ── input ────────────────────────────────────────────────────────────────────
|
||||
|
||||
## _input runs before _unhandled_input so Escape / right-click tool-cancel takes
|
||||
## priority over Selection's deselect and over panel close-handlers.
|
||||
func _input(event: InputEvent) -> void:
|
||||
if _tool == TOOL_NONE:
|
||||
return
|
||||
|
||||
# Escape — cancel the active tool; consume so lower handlers don't also fire.
|
||||
if event.is_action_pressed("cancel"):
|
||||
set_active_tool(TOOL_NONE)
|
||||
get_viewport().set_input_as_handled()
|
||||
Audit.log("designation", "escape: tool cancelled")
|
||||
return
|
||||
|
||||
# Right-click — also cancel the active tool (RTS convention).
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_RIGHT and event.pressed:
|
||||
set_active_tool(TOOL_NONE)
|
||||
get_viewport().set_input_as_handled()
|
||||
Audit.log("designation", "right-click: tool cancelled")
|
||||
return
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if _tool == TOOL_NONE or _paint_layer == null:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue