From 6d12dfed31e59f8918dd96fa35a1d9de873684d5 Mon Sep 17 00:00:00 2001 From: harry Date: Sun, 21 Apr 2024 05:05:20 +0100 Subject: [PATCH] unbreaks binding to space (#6168) we have to override the name of the key sometimes, and space is one of those times :cl: fix: you can bind to space again /:cl: --- tgui/packages/tgui/interfaces/KeyBinds.jsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tgui/packages/tgui/interfaces/KeyBinds.jsx b/tgui/packages/tgui/interfaces/KeyBinds.jsx index b387d6a8dba5..b3b2fd5a8c30 100644 --- a/tgui/packages/tgui/interfaces/KeyBinds.jsx +++ b/tgui/packages/tgui/interfaces/KeyBinds.jsx @@ -10,6 +10,20 @@ const KEY_MODS = { 'CONTROL': true, }; +const KEY_CODE_TO_BYOND = { + 'DEL': 'Delete', + 'DOWN': 'South', + 'END': 'Southwest', + 'HOME': 'Northwest', + 'INSERT': 'Insert', + 'LEFT': 'West', + 'PAGEDOWN': 'Southeast', + 'PAGEUP': 'Northeast', + 'RIGHT': 'East', + ' ': 'Space', + 'UP': 'North', +}; + const getAllKeybinds = (glob_keybinds) => { const all_keybinds = new Array(); Object.keys(glob_keybinds).map((x) => all_keybinds.push(...glob_keybinds[x])); @@ -274,6 +288,10 @@ export class ButtonKeybind extends Component { return; } + if (KEY_CODE_TO_BYOND[pressedKey]) { + pressedKey = KEY_CODE_TO_BYOND[pressedKey]; + } + if (e.keyCode >= 96 && e.keyCode <= 105) { pressedKey = 'Numpad' + pressedKey; }