mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Rips out the old keybind system and ports a better version from /tg/ (#17216)
* Initial version Ripped out old version and added new version * Update some of the keybinds * More changes * Added hotkey sanity checks * Misc. fixes and features * Small fix * Refactor keys_held * Adds emote keybinds * Small spelling fixes * I always forget this one * Add 1 second cooldown on emotes * Fix DME * Don't spam * Make linter happy * New MC init
This commit is contained in:
@@ -1,21 +1,18 @@
|
||||
// yogs - Replicated for custom keybindings
|
||||
SUBSYSTEM_DEF(input)
|
||||
name = "Input"
|
||||
wait = 1 //SS_TICKER means this runs every tick
|
||||
init_order = INIT_ORDER_INPUT
|
||||
init_stage = INITSTAGE_EARLY
|
||||
flags = SS_TICKER
|
||||
priority = FIRE_PRIORITY_INPUT
|
||||
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
||||
init_stage = INITSTAGE_EARLY
|
||||
|
||||
var/list/macro_sets
|
||||
var/list/movement_keys
|
||||
var/list/macro_set
|
||||
|
||||
/datum/controller/subsystem/input/Initialize()
|
||||
setup_default_macro_sets()
|
||||
|
||||
setup_default_movement_keys()
|
||||
|
||||
initialized = TRUE
|
||||
|
||||
refresh_client_macro_sets()
|
||||
@@ -24,85 +21,13 @@ SUBSYSTEM_DEF(input)
|
||||
|
||||
// This is for when macro sets are eventualy datumized
|
||||
/datum/controller/subsystem/input/proc/setup_default_macro_sets()
|
||||
var/list/static/default_macro_sets
|
||||
|
||||
if(default_macro_sets)
|
||||
macro_sets = default_macro_sets
|
||||
return
|
||||
|
||||
default_macro_sets = list(
|
||||
"default" = list(
|
||||
"Tab" = "\".winset \\\"input.focus=true?map.focus=true input.background-color=[COLOR_INPUT_DISABLED]:input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"",
|
||||
"O" = "ooc",
|
||||
"T" = "say",
|
||||
"M" = "me",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
),
|
||||
"old_default" = list(
|
||||
"Tab" = "\".winset \\\"mainwindow.macro=old_hotkeys map.focus=true input.background-color=[COLOR_INPUT_DISABLED]\\\"\"",
|
||||
"Ctrl+T" = "say",
|
||||
"Ctrl+O" = "ooc",
|
||||
),
|
||||
"old_hotkeys" = list(
|
||||
"Tab" = "\".winset \\\"mainwindow.macro=old_default input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"",
|
||||
"O" = "ooc",
|
||||
"T" = "say",
|
||||
"M" = "me",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
),
|
||||
)
|
||||
|
||||
// Because i'm lazy and don't want to type all these out twice
|
||||
var/list/old_default = default_macro_sets["old_default"]
|
||||
|
||||
var/list/static/oldmode_keys = list(
|
||||
"North", "East", "South", "West",
|
||||
"Northeast", "Southeast", "Northwest", "Southwest",
|
||||
"Insert", "Delete", "Ctrl", "Alt",
|
||||
"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
|
||||
)
|
||||
|
||||
for(var/i in 1 to oldmode_keys.len)
|
||||
var/key = oldmode_keys[i]
|
||||
old_default[key] = "\"KeyDown [key]\""
|
||||
old_default["[key]+UP"] = "\"KeyUp [key]\""
|
||||
|
||||
var/list/static/oldmode_ctrl_override_keys = list(
|
||||
"W" = "W", "A" = "A", "S" = "S", "D" = "D", // movement
|
||||
"1" = "1", "2" = "2", "3" = "3", "4" = "4", // intent
|
||||
"B" = "B", // resist
|
||||
"E" = "E", // quick equip
|
||||
"F" = "F", // intent left
|
||||
"G" = "G", // intent right
|
||||
"H" = "H", // stop pulling
|
||||
"Q" = "Q", // drop
|
||||
"R" = "R", // throw
|
||||
"X" = "X", // switch hands
|
||||
"Y" = "Y", // activate item
|
||||
"Z" = "Z", // activate item
|
||||
"V" = "V", // rest
|
||||
)
|
||||
|
||||
for(var/i in 1 to oldmode_ctrl_override_keys.len)
|
||||
var/key = oldmode_ctrl_override_keys[i]
|
||||
var/override = oldmode_ctrl_override_keys[key]
|
||||
old_default["Ctrl+[key]"] = "\"KeyDown [override]\""
|
||||
old_default["Ctrl+[key]+UP"] = "\"KeyUp [override]\""
|
||||
|
||||
macro_sets = default_macro_sets
|
||||
|
||||
// For initially setting up or resetting to default the movement keys
|
||||
/datum/controller/subsystem/input/proc/setup_default_movement_keys()
|
||||
var/static/list/default_movement_keys = list(
|
||||
"W" = NORTH, "A" = WEST, "S" = SOUTH, "D" = EAST, // WASD
|
||||
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
|
||||
)
|
||||
|
||||
movement_keys = default_movement_keys.Copy()
|
||||
macro_set = list(
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"",
|
||||
"Tab" = "\".winset \\\"input.focus=true?map.focus=true input.background-color=[COLOR_INPUT_DISABLED]:input.focus=true input.background-color=[COLOR_INPUT_ENABLED]\\\"\"",
|
||||
"Escape" = "Reset-Held-Keys",
|
||||
)
|
||||
|
||||
// Badmins just wanna have fun ♪
|
||||
/datum/controller/subsystem/input/proc/refresh_client_macro_sets()
|
||||
|
||||
Reference in New Issue
Block a user