legacy mode is a pref now

This commit is contained in:
S34N
2022-07-13 17:27:15 +01:00
parent 17ac11b0c6
commit b45af65139
4 changed files with 23 additions and 8 deletions
+2 -1
View File
@@ -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)
@@ -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, "<span class='info'>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.</span>")
winset(user.client, null, "mainwindow.macro=legacy input.focus=true input.background-color=[COLOR_INPUT_ENABLED]")
else
to_chat(user, "<span class='info'>You are no longer using legacy key mode. All keys will function as intended.</span>")
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, "<span class='info'>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
@@ -410,6 +410,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "<b>Play Lobby Music:</b> <a href='?_src_=prefs;preference=lobby_music'><b>[(sound & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Randomized Character Slot:</b> <a href='?_src_=prefs;preference=randomslot'><b>[toggles2 & PREFTOGGLE_2_RANDOMSLOT ? "Yes" : "No"]</b></a><br>"
dat += "<b>Window Flashing:</b> <a href='?_src_=prefs;preference=winflash'>[(toggles2 & PREFTOGGLE_2_WINDOWFLASHING) ? "Yes" : "No"]</a><br>"
dat += "<b>Legacy Keybind Mode:</b> <a href='?_src_=prefs;preference=legacy_keys'>[(toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS) ? "Yes" : "No"]</a><br>"
// RIGHT SIDE OF THE PAGE
dat += "</td><td width='300px' height='300px' valign='top'>"
dat += "<h2>Special Role Settings</h2>"
@@ -488,9 +489,9 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
dat += "<tr><td colspan=4><div align='center'><b>Please note, some keybinds are overriden by other categories.</b></div></td></tr>"
dat += "<tr><td colspan=4><div align='center'><b>Ensure you bind all of them, or the specific one you want.</b></div></td></tr>"
dat += "<tr><td colspan=4><hr></td></tr>"
dat += "<tr><td colspan=4><div align='center'><b>Users of legacy mode can only rebind and use the following keys:</b></div></td></tr>"
dat += "<tr><td colspan=4><div align='center'><b>Arrow Keys, Function Keys, Insert, Del, Home, End, PageUp, PageDn.</b></div></td></tr>"
if(toggles2 & PREFTOGGLE_2_LEGACY_KEYBINDS)
dat += "<tr><td colspan=4><div align='center'><b>You are using legacy keybind mode. You can rebind any key but only the following will do anything:</b></div></td></tr>"
dat += "<tr><td colspan=4><div align='center'><b>Arrow Keys, Function Keys, Insert, Del, Home, End, PageUp, PageDn.</b></div></td></tr>"
dat += "<table align='center' width='100%'>"
// Lookup lists to make our life easier
+5 -3
View File
@@ -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