2026-02-22 17:12:28 -05:00
|
|
|
/**
|
|
|
|
|
* Declarative command ids for the primary gameplay input mode.
|
|
|
|
|
*/
|
2026-02-22 16:49:15 -05:00
|
|
|
export type MainModeCommand =
|
|
|
|
|
| 'editNickname'
|
|
|
|
|
| 'toggleMute'
|
|
|
|
|
| 'toggleOutputMode'
|
|
|
|
|
| 'toggleLoopback'
|
|
|
|
|
| 'toggleVoiceLayer'
|
|
|
|
|
| 'toggleItemLayer'
|
|
|
|
|
| 'toggleMediaLayer'
|
|
|
|
|
| 'toggleWorldLayer'
|
|
|
|
|
| 'openEffectSelect'
|
|
|
|
|
| 'effectValueUp'
|
|
|
|
|
| 'effectValueDown'
|
|
|
|
|
| 'speakCoordinates'
|
|
|
|
|
| 'openMicGainEdit'
|
|
|
|
|
| 'calibrateMicrophone'
|
2026-02-22 17:16:31 -05:00
|
|
|
| 'useItem'
|
|
|
|
|
| 'speakUsers'
|
2026-02-22 16:49:15 -05:00
|
|
|
| 'addItem'
|
|
|
|
|
| 'locateOrListItems'
|
|
|
|
|
| 'pickupDropOrDelete'
|
|
|
|
|
| 'editOrInspectItem'
|
|
|
|
|
| 'pingServer'
|
|
|
|
|
| 'locateOrListUsers'
|
|
|
|
|
| 'openHelp'
|
|
|
|
|
| 'openChat'
|
|
|
|
|
| 'chatPrev'
|
|
|
|
|
| 'chatNext'
|
|
|
|
|
| 'chatFirst'
|
|
|
|
|
| 'chatLast'
|
|
|
|
|
| 'escape';
|
|
|
|
|
|
2026-02-22 17:12:28 -05:00
|
|
|
/**
|
|
|
|
|
* Maps raw key events to a semantic command for main mode handling.
|
|
|
|
|
*/
|
2026-02-22 16:49:15 -05:00
|
|
|
export function resolveMainModeCommand(code: string, shiftKey: boolean): MainModeCommand | null {
|
2026-02-22 17:33:31 -05:00
|
|
|
if (code === 'KeyN') return shiftKey ? null : 'editNickname';
|
2026-02-22 16:49:15 -05:00
|
|
|
if (code === 'KeyM') return shiftKey ? 'toggleOutputMode' : 'toggleMute';
|
|
|
|
|
if (code === 'Digit1') return shiftKey ? 'toggleLoopback' : 'toggleVoiceLayer';
|
|
|
|
|
if (code === 'Digit2') return 'toggleItemLayer';
|
|
|
|
|
if (code === 'Digit3') return 'toggleMediaLayer';
|
|
|
|
|
if (code === 'Digit4') return 'toggleWorldLayer';
|
2026-02-22 17:33:31 -05:00
|
|
|
if (code === 'KeyE') return shiftKey ? null : 'openEffectSelect';
|
2026-02-22 16:49:15 -05:00
|
|
|
if (code === 'Equal' || code === 'NumpadAdd') return 'effectValueUp';
|
|
|
|
|
if (code === 'Minus' || code === 'NumpadSubtract') return 'effectValueDown';
|
2026-02-22 17:33:31 -05:00
|
|
|
if (code === 'KeyC') return shiftKey ? null : 'speakCoordinates';
|
2026-02-22 16:49:15 -05:00
|
|
|
if (code === 'KeyV') return shiftKey ? 'calibrateMicrophone' : 'openMicGainEdit';
|
2026-02-22 17:16:31 -05:00
|
|
|
if (code === 'Enter') return 'useItem';
|
2026-02-22 17:33:31 -05:00
|
|
|
if (code === 'KeyU') return shiftKey ? null : 'speakUsers';
|
|
|
|
|
if (code === 'KeyA') return shiftKey ? null : 'addItem';
|
2026-02-22 16:49:15 -05:00
|
|
|
if (code === 'KeyI') return 'locateOrListItems';
|
|
|
|
|
if (code === 'KeyD') return 'pickupDropOrDelete';
|
|
|
|
|
if (code === 'KeyO') return 'editOrInspectItem';
|
2026-02-22 17:33:31 -05:00
|
|
|
if (code === 'KeyP') return shiftKey ? null : 'pingServer';
|
2026-02-22 16:49:15 -05:00
|
|
|
if (code === 'KeyL') return 'locateOrListUsers';
|
|
|
|
|
if (code === 'Slash') return shiftKey ? 'openHelp' : 'openChat';
|
|
|
|
|
if (code === 'Comma') return shiftKey ? 'chatFirst' : 'chatPrev';
|
|
|
|
|
if (code === 'Period') return shiftKey ? 'chatLast' : 'chatNext';
|
|
|
|
|
if (code === 'Escape') return 'escape';
|
|
|
|
|
return null;
|
|
|
|
|
}
|