From b45af65139e93bc435f038f33365805bbccf069d Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Wed, 13 Jul 2022 17:27:15 +0100 Subject: [PATCH] legacy mode is a pref now --- code/__DEFINES/preferences.dm | 3 ++- code/modules/client/preference/link_processing.dm | 13 ++++++++++++- code/modules/client/preference/preferences.dm | 7 ++++--- code/modules/input/input.dm | 8 +++++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index 2e4a9a15c61..8cc33cf7ea0 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -57,8 +57,9 @@ #define PREFTOGGLE_2_FORCE_WHITE_RUNECHAT 1024 #define PREFTOGGLE_2_SIMPLE_STAT_PANEL 2048 #define PREFTOGGLE_2_SEE_ITEM_OUTLINES 4096 +#define PREFTOGGLE_2_LEGACY_KEYBINDS 8192 -#define TOGGLES_2_TOTAL 8191 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined. +#define TOGGLES_2_TOTAL 16383 // If you add or remove a preference toggle above, make sure you update this define with the total value of the toggles combined. #define TOGGLES_2_DEFAULT (PREFTOGGLE_2_FANCYUI|PREFTOGGLE_2_ITEMATTACK|PREFTOGGLE_2_WINDOWFLASHING|PREFTOGGLE_2_RUNECHAT|PREFTOGGLE_2_DEATHMESSAGE|PREFTOGGLE_2_EMOTE_BUBBLE|PREFTOGGLE_2_SEE_ITEM_OUTLINES) diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm index f0e8f3d387e..8fdc4e7556c 100644 --- a/code/modules/client/preference/link_processing.dm +++ b/code/modules/client/preference/link_processing.dm @@ -936,6 +936,16 @@ if("winflash") toggles2 ^= PREFTOGGLE_2_WINDOWFLASHING + if("legacy_keys") + toggles2 ^= PREFTOGGLE_2_LEGACY_KEYBINDS + if(toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS) + to_chat(user, "You are now using legacy key mode. You can still rebind all keys, but only the following will be detected: \ + Arrow Keys, Function Keys, Insert, Del, Home, End, PageUp, PageDn.") + winset(user.client, null, "mainwindow.macro=legacy input.focus=true input.background-color=[COLOR_INPUT_ENABLED]") + else + to_chat(user, "You are no longer using legacy key mode. All keys will function as intended.") + winset(user.client, null, "mainwindow.macro=default map.focus=true input.background-color=[COLOR_INPUT_DISABLED]") + if("afk_watch") if(!(toggles2 & PREFTOGGLE_2_AFKWATCH)) to_chat(user, "You will now get put into cryo dorms after [GLOB.configuration.afk.auto_cryo_minutes] minutes. \ @@ -1114,7 +1124,8 @@ "ADD" = "Add", "SUBTRACT" = "Subtract", "DECIMAL" = "Decimal", - "CLEAR" = "Center" + "CLEAR" = "Center", + "TAB" = "Tab" ) new_key = key_map[new_key] || new_key diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 46ce462e42e..e5f0146579f 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -410,6 +410,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts dat += "Play Lobby Music: [(sound & SOUND_LOBBY) ? "Yes" : "No"]
" dat += "Randomized Character Slot: [toggles2 & PREFTOGGLE_2_RANDOMSLOT ? "Yes" : "No"]
" dat += "Window Flashing: [(toggles2 & PREFTOGGLE_2_WINDOWFLASHING) ? "Yes" : "No"]
" + dat += "Legacy Keybind Mode: [(toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS) ? "Yes" : "No"]
" // RIGHT SIDE OF THE PAGE dat += "" dat += "

Special Role Settings

" @@ -488,9 +489,9 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts dat += "
Please note, some keybinds are overriden by other categories.
" dat += "
Ensure you bind all of them, or the specific one you want.
" dat += "
" - dat += "
Users of legacy mode can only rebind and use the following keys:
" - dat += "
Arrow Keys, Function Keys, Insert, Del, Home, End, PageUp, PageDn.
" - + if(toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS) + dat += "
You are using legacy keybind mode. You can rebind any key but only the following will do anything:
" + dat += "
Arrow Keys, Function Keys, Insert, Del, Home, End, PageUp, PageDn.
" dat += "" // Lookup lists to make our life easier diff --git a/code/modules/input/input.dm b/code/modules/input/input.dm index 23b5c0e2e5b..0b19879ff79 100644 --- a/code/modules/input/input.dm +++ b/code/modules/input/input.dm @@ -24,11 +24,9 @@ "default" = list( "Any" = "\"KeyDown \[\[*\]\]\"", // Passes any key down to the rebindable input system "Any+UP" = "\"KeyUp \[\[*\]\]\"", // Passes any key up to the rebindable input system - "Tab" = "\".winset \\\"mainwindow.macro=legacy input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"", // Swaps us to legacy mode, forces input to the input bar, sets the input bar colour to salmon pink "Back" = "\".winset \\\"input.focus=true ? input.text=\\\"\"" // This makes it so backspace can remove default inputs ), "legacy" = list( - "Tab" = "\".winset \\\"mainwindow.macro=default map.focus=true input.background-color=[COLOR_INPUT_DISABLED]\\\"\"", // Swaps us to rebind mode, moves input away from input bar, sets input bar to white "Back" = "\".winset \\\"input.focus=true ? input.text=\\\"\"" // This makes it so backspace can remove default inputs ), ) @@ -63,9 +61,13 @@ var/command = macro_set[key] winset(src, "[setname]-[key]", "parent=[setname];name=[key];command=[command]") - winset(src, null, "input.background-color=[COLOR_INPUT_DISABLED]") //screw you, we start in hotkey mode now macro_sets = null //not needed anymore, bye have a great time + if(prefs.toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS) + winset(src, null, "mainwindow.macro=legacy input.focus=true input.background-color=[COLOR_INPUT_ENABLED]") + else + winset(src, null, "mainwindow.macro=default map.focus=true input.background-color=[COLOR_INPUT_DISABLED]") + /client/verb/KeyDown(_key as text) set instant = TRUE set hidden = TRUE