mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-10 15:45:05 +01:00
Re-Support old hotkey mode behaviour (#33460)
* supports old hotkey mode behavior * testmerge fixes
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// This is eventualy for wjohn to add more color standardization stuff like I keep asking him >:(
|
||||
|
||||
#define COLOR_INPUT_DISABLED "#F0F0F0"
|
||||
#define COLOR_INPUT_ENABLED "#D3B5B5"
|
||||
@@ -46,16 +46,17 @@
|
||||
#define INIT_ORDER_DBCORE 18
|
||||
#define INIT_ORDER_BLACKBOX 17
|
||||
#define INIT_ORDER_SERVER_MAINT 16
|
||||
#define INIT_ORDER_RESEARCH 15
|
||||
#define INIT_ORDER_EVENTS 14
|
||||
#define INIT_ORDER_JOBS 13
|
||||
#define INIT_ORDER_TICKER 12
|
||||
#define INIT_ORDER_MAPPING 11
|
||||
#define INIT_ORDER_ATOMS 10
|
||||
#define INIT_ORDER_NETWORKS 9
|
||||
#define INIT_ORDER_LANGUAGE 8
|
||||
#define INIT_ORDER_MACHINES 7
|
||||
#define INIT_ORDER_CIRCUIT 6
|
||||
#define INIT_ORDER_INPUT 15
|
||||
#define INIT_ORDER_RESEARCH 14
|
||||
#define INIT_ORDER_EVENTS 13
|
||||
#define INIT_ORDER_JOBS 12
|
||||
#define INIT_ORDER_TICKER 11
|
||||
#define INIT_ORDER_MAPPING 10
|
||||
#define INIT_ORDER_ATOMS 9
|
||||
#define INIT_ORDER_NETWORKS 8
|
||||
#define INIT_ORDER_LANGUAGE 7
|
||||
#define INIT_ORDER_MACHINES 6
|
||||
#define INIT_ORDER_CIRCUIT 5
|
||||
#define INIT_ORDER_TIMER 1
|
||||
#define INIT_ORDER_DEFAULT 0
|
||||
#define INIT_ORDER_AIR -1
|
||||
|
||||
@@ -1,10 +1,101 @@
|
||||
SUBSYSTEM_DEF(input)
|
||||
name = "Input"
|
||||
wait = 1 //SS_TICKER means this runs every tick
|
||||
flags = SS_TICKER | SS_NO_INIT
|
||||
init_order = INIT_ORDER_INPUT
|
||||
flags = SS_TICKER
|
||||
priority = FIRE_PRIORITY_INPUT
|
||||
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
||||
|
||||
var/list/macro_sets
|
||||
|
||||
/datum/controller/subsystem/input/Initialize()
|
||||
setup_default_macro_sets()
|
||||
|
||||
initialized = TRUE
|
||||
|
||||
refresh_client_macro_sets()
|
||||
|
||||
return ..()
|
||||
|
||||
// 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", "F5", "F6", "F7", "F8", "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
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
// Badmins just wanna have fun ♪
|
||||
/datum/controller/subsystem/input/proc/refresh_client_macro_sets()
|
||||
var/list/clients = GLOB.clients
|
||||
for(var/i in 1 to clients.len)
|
||||
var/client/user = clients[i]
|
||||
user.set_macros()
|
||||
|
||||
/datum/controller/subsystem/input/fire()
|
||||
var/list/clients = GLOB.clients // Let's sing the list cache song
|
||||
for(var/i in 1 to clients.len)
|
||||
|
||||
@@ -158,7 +158,7 @@ GLOBAL_LIST_INIT(admin_verbs_debug, world.AVerbsDebug())
|
||||
/client/proc/pump_random_event,
|
||||
/client/proc/cmd_display_init_log,
|
||||
/client/proc/cmd_display_overlay_log,
|
||||
/datum/admins/proc/create_or_modify_area
|
||||
/datum/admins/proc/create_or_modify_area,
|
||||
)
|
||||
GLOBAL_PROTECT(admin_verbs_possess)
|
||||
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess, /proc/release))
|
||||
|
||||
@@ -234,7 +234,8 @@ GLOBAL_LIST(external_rsc_urls)
|
||||
|
||||
. = ..() //calls mob.Login()
|
||||
|
||||
set_macros()
|
||||
if(SSinput.initialized)
|
||||
set_macros()
|
||||
|
||||
chatOutput.start() // Starts the chat
|
||||
|
||||
|
||||
@@ -1170,6 +1170,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
|
||||
if("hotkeys")
|
||||
hotkeys = !hotkeys
|
||||
if(hotkeys)
|
||||
winset(user, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=default")
|
||||
else
|
||||
winset(user, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=old_default")
|
||||
if("action_buttons")
|
||||
buttons_locked = !buttons_locked
|
||||
if("tgui_fancy")
|
||||
|
||||
@@ -20,43 +20,36 @@ GLOBAL_LIST_INIT(movement_keys, list(
|
||||
"North" = NORTH, "West" = WEST, "South" = SOUTH, "East" = EAST, // Arrow keys & Numpad
|
||||
))
|
||||
|
||||
/*
|
||||
A horrific battle against shitcode was fought here to find out some use details of winset
|
||||
Aparently you need to wrap the entire proc + args in quotes if you intend on using args
|
||||
But you don't need the quote wrappings to just call on a proc with no args
|
||||
ex. winset(src, "default-Any", "command=keyDown \[\[*\]\]") fail: command = keyDown
|
||||
ex. winset(src, "default-Any", "command=keyDown \"\[\[*\]\]\"") fail: same
|
||||
ex. winset(src, "default-T", "command=say") works fine
|
||||
ex. winset(src, "default-Any", "command=\"keyDown \[\[*\]\]\"") works fine
|
||||
Thanks for the useful errors lummox ~ninjanomnom
|
||||
*/
|
||||
GLOBAL_LIST_INIT(default_macros, list(
|
||||
"Tab" = "\".winset \\\"input.focus=true?map.focus=true input.background-color=#F0F0F0:input.focus=true input.background-color=#D3B5B5\\\"\"",
|
||||
"O" = "ooc",
|
||||
"T" = "say",
|
||||
"M" = "me",
|
||||
"Back" = "\".winset \\\"input.text=\\\"\\\"\\\"\"", // This makes it so backspace can remove default inputs
|
||||
"Any" = "\"KeyDown \[\[*\]\]\"",
|
||||
"Any+UP" = "\"KeyUp \[\[*\]\]\"",
|
||||
))
|
||||
// removes all the existing macros
|
||||
/client/proc/erase_all_macros()
|
||||
var/list/macro_sets = params2list(winget(src, null, "macros"))
|
||||
var/erase_output = ""
|
||||
for(var/i in 1 to macro_sets.len)
|
||||
var/setname = macro_sets[i]
|
||||
var/list/macro_set = params2list(winget(src, "[setname].*", "command")) // The third arg doesnt matter here as we're just removing them all
|
||||
for(var/k in 1 to macro_set.len)
|
||||
var/list/split_name = splittext(macro_set[k], ".")
|
||||
var/macro_name = "[split_name[1]].[split_name[2]]" // [3] is "command"
|
||||
erase_output = "[erase_output];[macro_name].parent=null"
|
||||
winset(src, null, erase_output)
|
||||
|
||||
/client/proc/set_macros()
|
||||
set waitfor = FALSE
|
||||
|
||||
winset(src, null, "reset=true")
|
||||
winset(src, null, "mainwindow.macro=default")
|
||||
var/list/default = params2list(winget(src, "default.*", "command"))
|
||||
for(var/i in 1 to length(default))
|
||||
var/id = default[i]
|
||||
winset(src, id, "parent=none")
|
||||
erase_all_macros()
|
||||
|
||||
var/list/default_macros = GLOB.default_macros
|
||||
for(var/i in 1 to length(default_macros))
|
||||
var/input = default_macros[i]
|
||||
var/output = default_macros[input]
|
||||
winset(src, "default-[input]", "parent=default;name=[input];command=[output]")
|
||||
var/list/macro_sets = SSinput.macro_sets
|
||||
for(var/i in 1 to macro_sets.len)
|
||||
var/setname = macro_sets[i]
|
||||
if(setname != "default")
|
||||
winclone(src, "default", setname)
|
||||
var/list/macro_set = macro_sets[setname]
|
||||
for(var/k in 1 to macro_set.len)
|
||||
var/key = macro_set[k]
|
||||
var/command = macro_set[key]
|
||||
winset(src, "[setname]-[REF(key)]", "parent=[setname];name=[key];command=[command]")
|
||||
|
||||
if(prefs.hotkeys)
|
||||
winset(src, null, "mapwindow.map.focus=true input.background-color=#e0e0e0")
|
||||
winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=default")
|
||||
else
|
||||
winset(src, null, "input.focus=true input.background-color=#d3b5b5")
|
||||
winset(src, null, "input.focus=true input.background-color=[COLOR_INPUT_ENABLED] mainwindow.macro=old_default")
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "code\__DEFINES\cinematics.dm"
|
||||
#include "code\__DEFINES\cleaning.dm"
|
||||
#include "code\__DEFINES\clockcult.dm"
|
||||
#include "code\__DEFINES\colors.dm"
|
||||
#include "code\__DEFINES\combat.dm"
|
||||
#include "code\__DEFINES\components.dm"
|
||||
#include "code\__DEFINES\configuration.dm"
|
||||
|
||||
Reference in New Issue
Block a user