Skip to content

Commit

Permalink
unbreaks binding to space (#6168)
Browse files Browse the repository at this point in the history
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:
  • Loading branch information
harryob committed Apr 21, 2024
1 parent b8bd5c5 commit 6d12dfe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tgui/packages/tgui/interfaces/KeyBinds.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6d12dfe

Please sign in to comment.