From 6a9f183a5c37998fba19ed4c1010e1746c4d1fee Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sun, 28 Dec 2014 15:26:32 +0100 Subject: [PATCH 1/3] adv. hotkey mode code + AZERTY support Adds a more advanced hotkey mode system, using verbs instead of .dmf defined .winset commands, allowing for multiple hotkey presets(QWERTY, AZERTY, DVORAK, you name it) Adds an AZERTY set of hotkeys, using this code --- code/modules/client/client defines.dm | 16 + interface/interface.dm | 31 ++ interface/skin.dmf | 438 +++++++++++++++++++++++++- paradise.dme | 2 +- 4 files changed, 483 insertions(+), 4 deletions(-) diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 35bdca3a0d0..8f96fa89437 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -55,3 +55,19 @@ // /vg/: MEDIAAAAAAAA // Set on login. var/datum/media_manager/media = null + + ///////////////////////////////////////////////////////////////////// + //adv. hotkey mode vars, code using them in /interface/interface.dm// + ///////////////////////////////////////////////////////////////////// + + var/hotkeytype = "QWERTY" //what set of hotkeys is in use(defaulting to QWERTY because I can't be bothered to ake this save on SQL) + var/hotkeyon = 0 //is the hotkey on? + + var/hotkeylist = list( //list defining hotkey types, look at lists in place for structure if adding any if the future + "QWERTY" = list( + "on" = "hotkeymode", + "off" = "macro"), + "AZERTY" = list( + "on" = "AZERTYon", + "off" = "AZERTYoff") + ) \ No newline at end of file diff --git a/interface/interface.dm b/interface/interface.dm index 2c96d47b994..6b109ec0ea5 100644 --- a/interface/interface.dm +++ b/interface/interface.dm @@ -119,3 +119,34 @@ Admin: src << other if(holder) src << admin + + +/client/verb/hotkey_toggle()//toggles hotkey mode between on and off, respects selected type + set name = ".Toggle hotkey mode" + + hotkeyon = !hotkeyon//toggle the var + + var/hotkeys = hotkeylist[hotkeytype]//get the list containing the hotkey names + var/hotkeyname = hotkeys[hotkeyon ? "on" : "off"]//get the name of the hotkey, to not clutter winset() to much + + winset(usr, "mainwindow", "macro=[hotkeyname]")//change the hotkey + usr << (hotkeyon ? "Hotkey mode enabled." : "Hotkey mode disabled.")//feedback to the user + + if(hotkeyon)//using an if statement because I don't want to clutter winset() with ? operators + winset(usr, "mainwindow.hotkey_toggle", "is-checked=true")//checks the button + winset(usr, "mainwindow.mapwindow", "focus=true")//sets mapwindow focus + else + winset(usr, "mainwindow.hotkey_toggle", "is-checked=false")//unchecks the button + winset(usr, "mainwindow.input", "focus=true")//sets focus + +/client/verb/hotkey_mode()//asks user for the hotkey type and changes the macro accordingly + set name = "Set hotkey mode" + set category = "Preferences" + + hotkeytype = input("Choose hotkey mode", "Hotkey mode") as null|anything in hotkeylist//ask the user for the hotkey type + + var/hotkeys = hotkeylist[hotkeytype]//get the list containing the hotkey names + var/hotkeyname = hotkeys[hotkeyon ? "on" : "off"]//get the name of the hotkey, to not clutter winset() to much + + winset(usr, "mainwindow", "macro=[hotkeyname]")//change the hotkey + usr << "Hotkey mode changed to [hotkeytype]." \ No newline at end of file diff --git a/interface/skin.dmf b/interface/skin.dmf index c7cb1ecb6c2..acbc0a4ffad 100644 --- a/interface/skin.dmf +++ b/interface/skin.dmf @@ -1,7 +1,439 @@ +macro "AZERTYoff" + elem + name = "TAB" + command = ".Toggle-hotkey-mode" + is-disabled = false + elem + name = "CENTER+REP" + command = ".center" + is-disabled = false + elem + name = "NORTHEAST" + command = ".northeast" + is-disabled = false + elem + name = "SOUTHEAST" + command = ".southeast" + is-disabled = false + elem + name = "SOUTHWEST" + command = ".southwest" + is-disabled = false + elem + name = "NORTHWEST" + command = ".northwest" + is-disabled = false + elem + name = "CTRL+WEST" + command = "westface" + is-disabled = false + elem + name = "WEST+REP" + command = ".west" + is-disabled = false + elem + name = "CTRL+NORTH" + command = "northface" + is-disabled = false + elem + name = "NORTH+REP" + command = ".north" + is-disabled = false + elem + name = "CTRL+EAST" + command = "eastface" + is-disabled = false + elem + name = "EAST+REP" + command = ".east" + is-disabled = false + elem + name = "CTRL+SOUTH" + command = "southface" + is-disabled = false + elem + name = "SOUTH+REP" + command = ".south" + is-disabled = false + elem + name = "INSERT" + command = "a-intent right" + is-disabled = false + elem + name = "DELETE" + command = "delete-key-pressed" + is-disabled = false + elem + name = "CTRL+1" + command = "a-intent help" + is-disabled = false + elem + name = "CTRL+2" + command = "a-intent disarm" + is-disabled = false + elem + name = "CTRL+3" + command = "a-intent grab" + is-disabled = false + elem + name = "CTRL+4" + command = "a-intent hurt" + is-disabled = false + elem + name = "CTRL+A" + command = ".northwest" + is-disabled = false + elem + name = "CTRL+D+REP" + command = ".east" + is-disabled = false + elem + name = "CTRL+E" + command = "quick-equip" + is-disabled = false + elem + name = "CTRL+F" + command = "a-intent left" + is-disabled = false + elem + name = "CTRL+G" + command = "a-intent right" + is-disabled = false + elem + name = "CTRL+Q+REP" + command = ".west" + is-disabled = false + elem + name = "CTRL+R" + command = ".southwest" + is-disabled = false + elem + name = "CTRL+S+REP" + command = ".south" + is-disabled = false + elem + name = "CTRL+W" + command = "Activate-Held-Object" + is-disabled = false + elem + name = "CTRL+X" + command = ".northeast" + is-disabled = false + elem + name = "CTRL+Y" + command = "Activate-Held-Object" + is-disabled = false + elem + name = "CTRL+Z+REP" + command = ".north" + is-disabled = false + elem + name = "F1" + command = "adminhelp" + is-disabled = false + elem + name = "CTRL+SHIFT+F1+REP" + command = ".options" + is-disabled = false + elem + name = "F2" + command = "ooc" + is-disabled = false + elem + name = "F2+REP" + command = ".screenshot auto" + is-disabled = false + elem + name = "SHIFT+F2+REP" + command = ".screenshot" + is-disabled = false + elem + name = "F3" + command = "say" + is-disabled = false + elem + name = "F4" + command = "me" + is-disabled = false + elem + name = "F5" + command = "asay" + is-disabled = false + elem + name = "F6" + command = "Player-Panel-New" + is-disabled = false + elem + name = "F7" + command = "Admin-PM" + is-disabled = false + elem + name = "F8" + command = "Invisimin" + is-disabled = false + elem + name = "F12" + command = "F12" + is-disabled = false + +macro "AZERTYon" + elem + name = "TAB" + command = ".Toggle-hotkey-mode" + is-disabled = false + elem + name = "CENTER+REP" + command = ".center" + is-disabled = false + elem + name = "NORTHEAST" + command = ".northeast" + is-disabled = false + elem + name = "SOUTHEAST" + command = ".southeast" + is-disabled = false + elem + name = "SOUTHWEST" + command = ".southwest" + is-disabled = false + elem + name = "NORTHWEST" + command = ".northwest" + is-disabled = false + elem + name = "CTRL+WEST" + command = "westface" + is-disabled = false + elem + name = "WEST+REP" + command = ".west" + is-disabled = false + elem + name = "CTRL+NORTH" + command = "northface" + is-disabled = false + elem + name = "NORTH+REP" + command = ".north" + is-disabled = false + elem + name = "CTRL+EAST" + command = "eastface" + is-disabled = false + elem + name = "EAST+REP" + command = ".east" + is-disabled = false + elem + name = "CTRL+SOUTH" + command = "southface" + is-disabled = false + elem + name = "SOUTH+REP" + command = ".south" + is-disabled = false + elem + name = "INSERT" + command = "a-intent right" + is-disabled = false + elem + name = "DELETE" + command = "delete-key-pressed" + is-disabled = false + elem + name = "1" + command = "a-intent help" + is-disabled = false + elem + name = "CTRL+1" + command = "a-intent help" + is-disabled = false + elem + name = "2" + command = "a-intent disarm" + is-disabled = false + elem + name = "CTRL+2" + command = "a-intent disarm" + is-disabled = false + elem + name = "3" + command = "a-intent grab" + is-disabled = false + elem + name = "CTRL+3" + command = "a-intent grab" + is-disabled = false + elem + name = "4" + command = "a-intent harm" + is-disabled = false + elem + name = "CTRL+4" + command = "a-intent harm" + is-disabled = false + elem + name = "A" + command = ".northwest" + is-disabled = false + elem + name = "CTRL+A" + command = ".northwest" + is-disabled = false + elem + name = "D+REP" + command = ".east" + is-disabled = false + elem + name = "CTRL+D+REP" + command = ".east" + is-disabled = false + elem + name = "E" + command = "quick-equip" + is-disabled = false + elem + name = "CTRL+E" + command = "quick-equip" + is-disabled = false + elem + name = "F" + command = "a-intent left" + is-disabled = false + elem + name = "CTRL+F" + command = "a-intent left" + is-disabled = false + elem + name = "G" + command = "a-intent right" + is-disabled = false + elem + name = "CTRL+G" + command = "a-intent right" + is-disabled = false + elem + name = "H" + command = ".holster" + is-disabled = false + elem + name = "CTRL+H" + command = ".holster" + is-disabled = false + elem + name = "Q+REP" + command = ".west" + is-disabled = false + elem + name = "CTRL+Q+REP" + command = ".west" + is-disabled = false + elem + name = "R" + command = ".southwest" + is-disabled = false + elem + name = "CTRL+R" + command = ".southwest" + is-disabled = false + elem "s_key" + name = "S+REP" + command = ".south" + is-disabled = false + elem + name = "CTRL+S+REP" + command = ".south" + is-disabled = false + elem + name = "T" + command = "say" + is-disabled = false + elem + name = "W" + command = "Activate-Held-Object" + is-disabled = false + elem + name = "CTRL+W" + command = "Activate-Held-Object" + is-disabled = false + elem + name = "X" + command = ".northeast" + is-disabled = false + elem + name = "CTRL+X" + command = ".northeast" + is-disabled = false + elem + name = "Y" + command = "Activate-Held-Object" + is-disabled = false + elem + name = "CTRL+Y" + command = "Activate-Held-Object" + is-disabled = false + elem "w_key" + name = "Z+REP" + command = ".north" + is-disabled = false + elem + name = "CTRL+Z+REP" + command = ".north" + is-disabled = false + elem + name = "F1" + command = "adminhelp" + is-disabled = false + elem + name = "CTRL+SHIFT+F1+REP" + command = ".options" + is-disabled = false + elem + name = "F2" + command = "ooc" + is-disabled = false + elem + name = "F2+REP" + command = ".screenshot auto" + is-disabled = false + elem + name = "SHIFT+F2+REP" + command = ".screenshot" + is-disabled = false + elem + name = "F3" + command = "say" + is-disabled = false + elem + name = "F4" + command = "me" + is-disabled = false + elem + name = "F5" + command = "asay" + is-disabled = false + elem + name = "F6" + command = "Player-Panel-New" + is-disabled = false + elem + name = "F7" + command = "Admin-PM" + is-disabled = false + elem + name = "F8" + command = "Invisimin" + is-disabled = false + elem + name = "F12" + command = "F12" + is-disabled = false + macro "macro" elem name = "TAB" - command = ".winset \"mainwindow.macro=hotkeymode hotkey_toggle.is-checked=true mapwindow.map.focus=true\"" + command = ".Toggle-hotkey-mode" is-disabled = false elem name = "CENTER+REP" @@ -179,7 +611,7 @@ macro "macro" macro "hotkeymode" elem name = "TAB" - command = ".winset \"mainwindow.macro=macro hotkey_toggle.is-checked=false input.focus=true\"" + command = ".Toggle-hotkey-mode" is-disabled = false elem name = "CENTER+REP" @@ -1207,7 +1639,7 @@ window "mainwindow" on-size = "" text = "Hotkey Toggle" image = "" - command = ".winset \"mainwindow.macro!=macro ? mainwindow.macro=macro hotkey_toggle.is-checked=false input.focus=true : mainwindow.macro=hotkeymode hotkey_toggle.is-checked=true mapwindow.map.focus=true\"" + command = ".Toggle-hotkey-mode" is-flat = false stretch = false is-checked = false diff --git a/paradise.dme b/paradise.dme index 7e82539fe1f..ec7dad41696 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1243,7 +1243,7 @@ #include "code\modules\mob\living\simple_animal\friendly\corgi.dm" #include "code\modules\mob\living\simple_animal\friendly\crab.dm" #include "code\modules\mob\living\simple_animal\friendly\farm_animals.dm" -#include "code\modules\mob\living\simple_animal\friendly\fox.dm" +#include "code\modules\mob\living\simple_animal\friendly\Fox.dm" #include "code\modules\mob\living\simple_animal\friendly\lizard.dm" #include "code\modules\mob\living\simple_animal\friendly\mouse.dm" #include "code\modules\mob\living\simple_animal\friendly\slime.dm" From 1911b35407d284fb7541121d431e27d191dc63cb Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sun, 28 Dec 2014 15:29:36 +0100 Subject: [PATCH 2/3] okay I forgot this comment Adds a comment to clear the code up ever so slightly --- interface/interface.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/interface.dm b/interface/interface.dm index 6b109ec0ea5..91050b50291 100644 --- a/interface/interface.dm +++ b/interface/interface.dm @@ -121,6 +121,8 @@ Admin: src << admin +//adv. hotkey mode verbs, vars located in /code/modules/client/client defines.dm + /client/verb/hotkey_toggle()//toggles hotkey mode between on and off, respects selected type set name = ".Toggle hotkey mode" From 58d37c5ae4b3836b7a08df797b8634bda5dd6dc6 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Sun, 28 Dec 2014 17:46:49 +0100 Subject: [PATCH 3/3] oops --- paradise.dme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paradise.dme b/paradise.dme index ec7dad41696..7e82539fe1f 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1243,7 +1243,7 @@ #include "code\modules\mob\living\simple_animal\friendly\corgi.dm" #include "code\modules\mob\living\simple_animal\friendly\crab.dm" #include "code\modules\mob\living\simple_animal\friendly\farm_animals.dm" -#include "code\modules\mob\living\simple_animal\friendly\Fox.dm" +#include "code\modules\mob\living\simple_animal\friendly\fox.dm" #include "code\modules\mob\living\simple_animal\friendly\lizard.dm" #include "code\modules\mob\living\simple_animal\friendly\mouse.dm" #include "code\modules\mob\living\simple_animal\friendly\slime.dm"