mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
Requested by oranges and inspired by the upcoming event. A new subsyetem, non-processing (for now), aimed at providing some toggle switches that can be flipped as a last ditch effort to save some CPU cycles by sacrificing some non-critical mechanics. Below you can see each individual toggle. Screenshot of the admin panel: image Surely there are more opportunities for toggles I missed, but adding new ones is not very difficult at all. Why It's Good For The Game Better performance during extreme pop, I hope. Changelog cl code: Introduces the Lag Switch subsystem for when a smoother experience is worth trading a few bells and whistles for. Performance enhancement measures can be togged by admins with the Show Lag Switches admin verb or enabled automatically at a pop amount set via config. config: Added a new config var: number/auto_lag_switch_pop
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
SUBSYSTEM_DEF(input)
|
|
name = "Input"
|
|
wait = 1 //SS_TICKER means this runs every tick
|
|
init_order = INIT_ORDER_INPUT
|
|
flags = SS_TICKER
|
|
priority = FIRE_PRIORITY_INPUT
|
|
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
|
|
|
var/list/macro_set
|
|
|
|
/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()
|
|
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()
|
|
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()
|
|
for(var/mob/user as anything in GLOB.keyloop_list)
|
|
user.focus?.keyLoop(user.client)
|