From a6d73e034447b2d17edfd9e823d3a8cfaf5b9d38 Mon Sep 17 00:00:00 2001 From: silicons <2003111+silicons@users.noreply.github.com> Date: Fri, 27 Nov 2020 04:25:22 -0700 Subject: [PATCH] fix --- code/controllers/subsystem/input.dm | 6 +++++ code/modules/keybindings/setup.dm | 42 ++++++++++------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/code/controllers/subsystem/input.dm b/code/controllers/subsystem/input.dm index 7650d46049..8c4fba367d 100644 --- a/code/controllers/subsystem/input.dm +++ b/code/controllers/subsystem/input.dm @@ -6,6 +6,12 @@ SUBSYSTEM_DEF(input) priority = FIRE_PRIORITY_INPUT runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY + /// KEEP THIS UP TO DATE! + var/static/list/all_macrosets = list( + SKIN_MACROSET_HOTKEYS, + SKIN_MACROSET_CLASSIC_HOTKEYS, + SKIN_MACROSET_CLASSIC_INPUT + ) /// Classic mode input focused macro set. Manually set because we can't define ANY or ANY+UP for classic. var/static/list/macroset_classic_input /// Classic mode map focused macro set. Manually set because it needs to be clientside and go to macroset_classic_input. diff --git a/code/modules/keybindings/setup.dm b/code/modules/keybindings/setup.dm index 3946ad77e1..3ed411e693 100644 --- a/code/modules/keybindings/setup.dm +++ b/code/modules/keybindings/setup.dm @@ -10,7 +10,9 @@ // removes all the existing macros /client/proc/erase_all_macros() var/erase_output = "" - var/list/macro_set = params2list(winget(src, "default.*", "command")) // The third arg doesnt matter here as we're just removing them all + var/list/macro_set = list() + for(var/macroset in SSinput.all_macrosets) // WE HAVE THREE AAAAAAAA + macro_set |= params2list(winget(src, "[macroset].*", "command")) // The third arg doesnt matter here as we're just removing them all for(var/k in 1 to length(macro_set)) var/list/split_name = splittext(macro_set[k], ".") var/macro_name = "[split_name[1]].[split_name[2]]" // [3] is "command" @@ -25,7 +27,6 @@ var/key = macroset[i] var/command = macroset[key] winset(src, "[name]-[REF(key)]", "parent=[name];name=[key];command=[command]") - update_special_keybinds() /client/proc/set_macros(datum/preferences/prefs_override = prefs) set waitfor = FALSE @@ -54,18 +55,7 @@ set_macros(prefs_override) update_special_keybinds(prefs_override) -/* -/datum/controller/subsystem/input - /** KEEP THIS UP TO DATE WITH update_special_keybinds! - * We use this list to detect when to avoid binding a key twice. - */ - var/list/special_keybinds = list("North", "East", "West", "South", "Say", "OOC", "Me", "Subtle", "Subtler", "Whisper", "LOOC") - -/datum/preferences/proc/get_all_keys_for_special_keybinds() - for(var/key in key_bindings) -*/ - -/client/proc/do_special_keybind(key, command) +/client/proc/do_special_keybind(key, command, datum/preferences/prefs_override = prefs) var/alt = findtext(key, "Alt") if(alt) key = copytext(key, 1, alt) + copytext(key, alt + 3, 0) @@ -75,14 +65,10 @@ var/shift = findtext(key, "Shift") if(shift) key = copytext(key, 1, shift) + copytext(key, shift + 5, 0) + if(!alt && !ctrl && !shift && !prefs_override.hotkeys) + return /// DO NOT. key = "[alt? "Alt+":""][ctrl? "Ctrl+":""][shift? "Shift+":""][key]" - /// KEEP THIS UP TO DATE! - var/static/list/all_macrosets = list( - SKIN_MACROSET_HOTKEYS, - SKIN_MACROSET_CLASSIC_HOTKEYS, - SKIN_MACROSET_CLASSIC_INPUT - ) - for(var/macroset in all_macrosets) + for(var/macroset in SSinput.all_macrosets) winset(src, "[macroset]-[REF(key)]", "parent=[macroset];name=[key];command=[command]") /** @@ -111,16 +97,16 @@ if("South") movement_keys[key] = SOUTH if("Say") - do_special_keybind(key, "say") + do_special_keybind(key, "say", D) if("OOC") - do_special_keybind(key, "OOC") + do_special_keybind(key, "ooc", D) if("Me") - do_special_keybind(key, "me") + do_special_keybind(key, "me", D) if("Subtle") - do_special_keybind(key, "subtle") + do_special_keybind(key, "subtle", D) if("Subtler") - do_special_keybind(key, "Subtler-Anti-Ghost") + do_special_keybind(key, "subtler-anti-ghost", D) if("Whisper") - do_special_keybind(key, "whisper") + do_special_keybind(key, "whisper", D) if("LOOC") - do_special_keybind(key, "LOOC") + do_special_keybind(key, "looc", D)