Skip to content

Commit

Permalink
we have to override the key description for byonds sake
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Apr 19, 2024
1 parent 4f1e9f5 commit 2adabcc
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 2adabcc

Please sign in to comment.