From 807e1a543ffb878bb030f2c7c474d4f3da3aad90 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 27 Apr 2026 15:58:10 +0200 Subject: [PATCH] Implement player start key binding capture and refine key handling logic --- src/app/App.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 6efdeaf1..649027a7 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -3447,7 +3447,10 @@ export function App({ store, initialStatusMessage }: AppProps) { return; } - if (event.code === "Escape") { + if ( + event.code === "Escape" && + playerStartKeyboardCaptureAction !== "clearTarget" + ) { setPlayerStartKeyboardCaptureAction(null); setStatusMessage("Cancelled Player Start key capture."); return; @@ -8925,6 +8928,10 @@ export function App({ store, initialStatusMessage }: AppProps) { navigationMode, interactionReachMeters, interactionAngleDegrees, + allowLookInputTargetSwitch: + playerStartAllowLookInputTargetSwitchDraft, + targetButtonCyclesActiveTarget: + playerStartTargetButtonCyclesActiveTargetDraft, movementTemplate, inputBindings, collider: { @@ -8958,6 +8965,21 @@ export function App({ store, initialStatusMessage }: AppProps) { } }; + const beginPlayerStartKeyboardCapture = (action: PlayerStartInputAction) => { + if (playerStartKeyboardCaptureAction === action) { + setPlayerStartKeyboardCaptureAction(null); + setStatusMessage("Cancelled Player Start key capture."); + return; + } + + setPlayerStartKeyboardCaptureAction(action); + setStatusMessage( + action === "clearTarget" + ? `Press any key or mouse button for ${getPlayerStartInputActionLabel(action)}. Click the binding button again to cancel.` + : `Press any key or mouse button for ${getPlayerStartInputActionLabel(action)}. Press Escape to cancel.` + ); + }; + const handlePlayerStartKeyboardBindingChange = ( action: PlayerStartInputAction, nextCode: PlayerStartKeyboardBindingCode