diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm index 86378e26bc3..7443a4a17ed 100644 --- a/code/modules/client/client_defines.dm +++ b/code/modules/client/client_defines.dm @@ -51,5 +51,4 @@ var/datum/tooltip/tooltips //Used for var edit flagging, also defined in datums (clients are not a child of datums for some reason) - var/var_edited = 0 - var/hotkeys = FALSE \ No newline at end of file + var/var_edited = 0 \ No newline at end of file diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index c7e00407efc..894e6a23ab4 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -143,7 +143,7 @@ var/next_external_rsc = 0 preferences_datums[ckey] = prefs prefs.last_ip = address //these are gonna be used for banning prefs.last_id = computer_id //these are gonna be used for banning - hotkeys = prefs.hotkey_preference //hotkey setting when client connects + sethotkeys(1) //set hoykeys from preferences (from_pref = 1) . = ..() //calls mob.Login() diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3225373ff28..c3747346a01 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -27,7 +27,7 @@ var/list/preferences_datums = list() var/UI_style = "Midnight" - var/hotkey_preference = FALSE + var/hotkeys = FALSE var/tgui_fancy = TRUE var/tgui_lock = TRUE var/toggles = TOGGLES_DEFAULT @@ -336,7 +336,7 @@ var/list/preferences_datums = list() dat += "
"
dat += "General Settings" dat += "UI Style: [UI_style]" - dat += "Keybindings: [(hotkey_preference) ? "Hotkeys" : "Default"] " + dat += "Keybindings: [(hotkeys) ? "Hotkeys" : "Default"] " dat += "tgui Style: [(tgui_fancy) ? "Fancy" : "No Frills"] " dat += "tgui Monitors: [(tgui_lock) ? "Primary" : "All"] " dat += "Play admin midis: [(toggles & SOUND_MIDI) ? "Yes" : "No"] " @@ -1077,8 +1077,8 @@ var/list/preferences_datums = list() else UI_style = "Midnight" - if("hotkey_preference") - hotkey_preference = !hotkey_preference + if("hotkeys") + hotkeys = !hotkeys if("tgui_fancy") tgui_fancy = !tgui_fancy diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 2a75f69354e..50f2154ef23 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -199,7 +199,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["ooccolor"] >> ooccolor S["lastchangelog"] >> lastchangelog S["UI_style"] >> UI_style - S["hotkeys"] >> hotkey_preference + S["hotkeys"] >> hotkeys S["tgui_fancy"] >> tgui_fancy S["tgui_lock"] >> tgui_lock @@ -227,18 +227,18 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car update_antagchoices(needs_update) //Sanitize - ooccolor = sanitize_ooccolor(sanitize_hexcolor(ooccolor, 6, 1, initial(ooccolor))) - lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) - UI_style = sanitize_inlist(UI_style, list("Midnight", "Plasmafire", "Retro", "Slimecore", "Operative"), initial(UI_style)) - hotkey_preference = sanitize_integer(hotkey_preference, 0, 1, initial(hotkey_preference)) - tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy)) - tgui_lock = sanitize_integer(tgui_lock, 0, 1, initial(tgui_lock)) - default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot)) - toggles = sanitize_integer(toggles, 0, 65535, initial(toggles)) - ghost_form = sanitize_inlist(ghost_form, ghost_forms, initial(ghost_form)) - ghost_orbit = sanitize_inlist(ghost_orbit, ghost_orbits, initial(ghost_orbit)) - ghost_accs = sanitize_inlist(ghost_accs, ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION) - ghost_others = sanitize_inlist(ghost_others, ghost_others_options, GHOST_OTHERS_DEFAULT_OPTION) + ooccolor = sanitize_ooccolor(sanitize_hexcolor(ooccolor, 6, 1, initial(ooccolor))) + lastchangelog = sanitize_text(lastchangelog, initial(lastchangelog)) + UI_style = sanitize_inlist(UI_style, list("Midnight", "Plasmafire", "Retro", "Slimecore", "Operative"), initial(UI_style)) + hotkeys = sanitize_integer(hotkeys, 0, 1, initial(hotkeys)) + tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy)) + tgui_lock = sanitize_integer(tgui_lock, 0, 1, initial(tgui_lock)) + default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot)) + toggles = sanitize_integer(toggles, 0, 65535, initial(toggles)) + ghost_form = sanitize_inlist(ghost_form, ghost_forms, initial(ghost_form)) + ghost_orbit = sanitize_inlist(ghost_orbit, ghost_orbits, initial(ghost_orbit)) + ghost_accs = sanitize_inlist(ghost_accs, ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION) + ghost_others = sanitize_inlist(ghost_others, ghost_others_options, GHOST_OTHERS_DEFAULT_OPTION) return 1 @@ -256,7 +256,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car S["ooccolor"] << ooccolor S["lastchangelog"] << lastchangelog S["UI_style"] << UI_style - S["hotkeys"] << hotkey_preference + S["hotkeys"] << hotkeys S["tgui_fancy"] << tgui_fancy S["tgui_lock"] << tgui_lock S["be_special"] << be_special diff --git a/code/modules/client/verbs/sethotkeys.dm b/code/modules/client/verbs/sethotkeys.dm new file mode 100644 index 00000000000..f7bf137c31a --- /dev/null +++ b/code/modules/client/verbs/sethotkeys.dm @@ -0,0 +1,24 @@ +/client/verb/sethotkeys(from_pref = 0 as num) + set name = "Set Hotkeys" + set hidden = 1 + set desc = "Used to set mob-specific hotkeys or load hoykey mode from preferences" + + var/hotkey_default = "default" + var/hotkey_macro = "hotkeys" + var/current_setting + + var/list/default_macros = list("default", "robot-default") + + if(from_pref) + current_setting = (prefs.hotkeys ? hotkey_macro : hotkey_default) + else + current_setting = winget(src, "mainwindow", "macro") + + if(mob) + hotkey_macro = mob.macro_hotkeys + hotkey_default = mob.macro_default + + if(current_setting in default_macros) + winset(src, null, "mainwindow.macro=[hotkey_default] input.focus=true input.background-color=#d3b5b5") + else + winset(src, null, "mainwindow.macro=[hotkey_macro] mapwindow.map.focus=true input.background-color=#e0e0e0") \ No newline at end of file diff --git a/code/modules/client/verbs/togglehotkeys.dm b/code/modules/client/verbs/togglehotkeys.dm deleted file mode 100644 index 9293647ba1b..00000000000 --- a/code/modules/client/verbs/togglehotkeys.dm +++ /dev/null @@ -1,20 +0,0 @@ -/client/verb/togglehotkeys(notoggle = 0 as num) - set name = "Toggle Hotkey Mode" - set category = "OOC" - set desc = "Switches input mode betweeen regular and hotkey mode." - - //fallback - var/hotkey_default = "default" - var/hotkey_macro = "hotkeys" - - if(!notoggle) - hotkeys = !hotkeys - - if(mob) - hotkey_macro = mob.macro_hotkeys - hotkey_default = mob.macro_default - - if(hotkeys) - winset(src, null, "mainwindow.macro=[hotkey_macro] mapwindow.map.focus=true input.background-color=#e0e0e0") - else - winset(src, null, "mainwindow.macro=[hotkey_default] input.focus=true input.background-color=#d3b5b5") \ No newline at end of file diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index d15ee8cb818..de3c89133f8 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -60,7 +60,7 @@ sync_mind() - client.togglehotkeys(1) //notoggle = 1, as in we are using this to set, rather than toggle + client.sethotkeys() //set mob specific hotkeys if(viewing_alternate_appearances && viewing_alternate_appearances.len) for(var/aakey in viewing_alternate_appearances) diff --git a/interface/skin.dmf b/interface/skin.dmf index b1eb176f7a4..8fa4df97371 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -1,7 +1,7 @@ macro "default" elem name = "TAB" - command = "Toggle-Hotkey-Mode" + command = ".winset \"mainwindow.macro=hotkeys mapwindow.map.focus=true input.background-color=#e0e0e0\"" elem name = "CENTER+REP" command = ".center" @@ -132,7 +132,7 @@ macro "default" macro "hotkeys" elem name = "TAB" - command = "Toggle-Hotkey-Mode" + command = ".winset \"mainwindow.macro=default input.focus=true input.background-color=#d3b5b5\"" elem name = "CENTER+REP" command = ".center" @@ -324,7 +324,7 @@ macro "hotkeys" macro "robot-default" elem name = "TAB" - command = "Toggle-Hotkey-Mode" + command = ".winset \"mainwindow.macro=robot-hotkeys mapwindow.map.focus=true input.background-color=#e0e0e0\"" elem name = "CENTER+REP" command = ".center" @@ -446,7 +446,7 @@ macro "robot-default" macro "robot-hotkeys" elem name = "TAB" - command = "Toggle-Hotkey-Mode" + command = ".winset \"mainwindow.macro=robot-default input.focus=true input.background-color=#d3b5b5\"" elem name = "CENTER+REP" command = ".center" diff --git a/tgstation.dme b/tgstation.dme index 9ec026d6c1f..69e213f9352 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -989,8 +989,8 @@ #include "code\modules\client\preferences_savefile.dm" #include "code\modules\client\preferences_toggles.dm" #include "code\modules\client\verbs\ooc.dm" +#include "code\modules\client\verbs\sethotkeys.dm" #include "code\modules\client\verbs\suicide.dm" -#include "code\modules\client\verbs\togglehotkeys.dm" #include "code\modules\client\verbs\who.dm" #include "code\modules\clothing\chameleon.dm" #include "code\modules\clothing\clothing.dm" |