From 193f1a222f2bb723608142bd8f39b757ed6c0d92 Mon Sep 17 00:00:00 2001 From: hyperholy <30881438+hyperholy@users.noreply.github.com> Date: Sun, 5 Oct 2025 04:24:17 +1100 Subject: [PATCH] Fixes Preferences key binding problem Issue #29597 (#30554) * Copied and fixed code from issue #29597 * fixed whitespace, make linter happy? * okay LAST whitespace * comments with hopefully enough information + whitespace fix --- code/modules/client/preference/preferences.dm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 5bf6ffcad88..b19a92be97e 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -780,7 +780,13 @@ GLOBAL_LIST_INIT(special_role_times, list( var shift = e.shiftKey ? 1 : 0; var numpad = (95 < e.keyCode && e.keyCode < 112) ? 1 : 0; var escPressed = e.keyCode == 27 ? 1 : 0; - var url = 'byond://?_src_=prefs;preference=keybindings;set=[KB.UID()];old=[url_encode(old)];clear_key='+escPressed+';key='+encodeURIComponent(e.key)+';alt='+alt+';ctrl='+ctrl+';shift='+shift+';numpad='+numpad+';key_code='+e.keyCode; + var number = 0; + if(e.keyCode >= 48 && e.keyCode <= 57) { + number = e.keyCode - 48; + var url = 'byond://?_src_=prefs;preference=keybindings;set=[KB.UID()];old=[url_encode(old)];clear_key='+escPressed+';key='+number+';alt='+alt+';ctrl='+ctrl+';shift='+shift+';numpad='+numpad+';key_code='+e.keyCode; + } else { + var url = 'byond://?_src_=prefs;preference=keybindings;set=[KB.UID()];old=[url_encode(old)];clear_key='+escPressed+';key='+encodeURIComponent(e.key)+';alt='+alt+';ctrl='+ctrl+';shift='+shift+';numpad='+numpad+';key_code='+e.keyCode; + } window.location=url; deedDone = true; }