diff --git a/code/modules/keybindings/bindings_client.dm b/code/modules/keybindings/bindings_client.dm index 6bcf76703e21c..94f56f9fe0b24 100644 --- a/code/modules/keybindings/bindings_client.dm +++ b/code/modules/keybindings/bindings_client.dm @@ -23,7 +23,10 @@ GLOBAL_LIST_INIT(valid_keys, list( "Gamepad3L1" = 1, "Gamepad3L2" = 1, "Gamepad3L3" = 1, "Gamepad3Start" = 1, "Gamepad3Select" = 1, "Gamepad4Up" = 1, "Gamepad4Down" = 1, "Gamepad4Left" = 1, "Gamepad4Right" = 1, "Gamepad4DownLeft" = 1,"Gamepad4DownRight" = 1, "Gamepad4UpLeft" = 1, "Gamepad4UpRight" = 1, "Gamepad4Face1" = 1, "Gamepad4Face2" = 1, "Gamepad4Face3" = 1, "Gamepad4Face4" = 1, "Gamepad4R1" = 1, "Gamepad4R2" = 1, "Gamepad4R3" = 1, "Gamepad4L1" = 1, "Gamepad4L2" = 1, "Gamepad4L3" = 1, - "Gamepad4Start" = 1, "Gamepad4Select" = 1, "VolumeUp" = 1, "VolumeDown" = 1, "VolumeMute" = 1, "MediaPlayPause" = 1, "MediaStop" = 1, "MediaNext" = 1, "MediaPrev" = 1 + "Gamepad4Start" = 1, "Gamepad4Select" = 1, "VolumeUp" = 1, "VolumeDown" = 1, "VolumeMute" = 1, "MediaPlayPause" = 1, "MediaStop" = 1, "MediaNext" = 1, "MediaPrev" = 1, + // AZERTY support + "&" = 1, "É" = 1, "\"" = 1, "(" = 1, "È" = 1, "_" = 1, "Ç" = 1, "À" = 1, ")" = 1, "*" = 1, "$" = 1, "!" = 1, ":" = 1, "²" = 1, "Ù" = 1, + "é" = 1, "è" = 1, "ç" = 1, "à" = 1, "ù" = 1, )) /proc/input_sanity_check(client/C, key) @@ -60,7 +63,11 @@ GLOBAL_LIST_INIT(valid_keys, list( if("Alt", "Ctrl", "Shift") full_key = "[AltMod][CtrlMod][ShiftMod]" else - full_key = "[AltMod][CtrlMod][ShiftMod][_key]" + if(AltMod || CtrlMod || ShiftMod) + full_key = "[AltMod][CtrlMod][ShiftMod][_key]" + key_combos_held[_key] = full_key + else + full_key = _key var/list/kbs = list() for (var/kb_name in prefs.key_bindings_by_key[full_key]) @@ -90,6 +97,11 @@ GLOBAL_LIST_INIT(valid_keys, list( if(input_sanity_check(src, _key)) return + var/key_combo = key_combos_held[_key] + if(key_combo) + key_combos_held -= _key + keyUp(key_combo) + keys_held -= _key var/movement = SSinput.movement_keys[_key] if(!(next_move_dir_add & movement) && !movement_locked) diff --git a/code/modules/keybindings/setup.dm b/code/modules/keybindings/setup.dm index 583524cacceb9..dab17bcb1c68e 100644 --- a/code/modules/keybindings/setup.dm +++ b/code/modules/keybindings/setup.dm @@ -1,6 +1,8 @@ /client /// A list of any keys held currently var/list/keys_held = list() + /// A buffer for combinations such of modifiers + keys (ex: CtrlD, AltE, ShiftT). Format: ["key"] -> ["combo"] (ex: ["D"] -> ["CtrlD"]) + var/list/key_combos_held = list() // These next two vars are to apply movement for keypresses and releases made while move delayed. // Because discarding that input makes the game less responsive. var/next_move_dir_add // On next move, add this dir to the move that would otherwise be done diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/KeybindingsPage.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/KeybindingsPage.tsx index a1e97c5c5a38a..0d24e6904e16e 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/KeybindingsPage.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/KeybindingsPage.tsx @@ -39,6 +39,11 @@ const isStandardKey = (event: KeyboardEvent): boolean => { return event.key !== 'Alt' && event.key !== 'Control' && event.key !== 'Shift' && event.key !== 'Esc'; }; +/** + * Keys that JS wants to capitalize but BYOND does not. + */ +const NO_CAPS_KEYS = ['é', 'è', 'ç', 'à', 'ù']; + const KEY_CODE_TO_BYOND: Record = { 'DEL': 'Delete', 'DOWN': 'South', @@ -88,7 +93,10 @@ const formatKeyboardEvent = (event: KeyboardEvent): string => { } if (isStandardKey(event)) { - const key = event.key.toUpperCase(); + let key = event.key; + if (!NO_CAPS_KEYS.includes(key)) { + key = key.toUpperCase(); + } text += KEY_CODE_TO_BYOND[key] || key; } @@ -396,6 +404,8 @@ export class KeybindingsPage extends Component<{}, KeybindingsPageState> {
Contact a maintainer or create an issue report by pressing Report Issue in the top right of the game window.
+ Reconnecting will also likely fix this issue. +
Error Details:{'\n'} {typeof this.state.error === 'object' && Object.keys(this.state.error).includes('stack') diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/ServerPreferencesFetcher.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/ServerPreferencesFetcher.tsx index beef2520f6782..659eea55bb90e 100644 --- a/tgui/packages/tgui/interfaces/PreferencesMenu/ServerPreferencesFetcher.tsx +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/ServerPreferencesFetcher.tsx @@ -67,6 +67,8 @@ export class ServerPreferencesFetcher extends Component<
Contact a maintainer or create an issue report by pressing Report Issue in the top right of the game window.
+ Reconnecting will also likely fix this issue. +
Error Details:{'\n'} {typeof lastError === 'object' && Object.keys(lastError).includes('stack') ? lastError.stack : lastError.toString()}