mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
[MIRROR] Drastic Lag Mitigation Subsystem: SSlag_switch (#6786)
* Drastic Lag Mitigation Subsystem: SSlag_switch (#59717) 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 * Drastic Lag Mitigation Subsystem: SSlag_switch * mirrored the changes to the modular file Co-authored-by: Wayland-Smithy <64715958+Wayland-Smithy@users.noreply.github.com> Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
This commit is contained in:
co-authored by
Wayland-Smithy
Useroth
parent
694032f53f
commit
df651808d4
@@ -1721,6 +1721,58 @@
|
||||
GLOB.station_goals += G
|
||||
modify_goals()
|
||||
|
||||
else if(href_list["change_lag_switch"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
switch(href_list["change_lag_switch"])
|
||||
if("ALL_ON")
|
||||
SSlag_switch.set_all_measures(TRUE)
|
||||
log_admin("[key_name(usr)] turned all Lag Switch measures ON.")
|
||||
message_admins("[key_name_admin(usr)] turned all Lag Switch measures ON.")
|
||||
if("ALL_OFF")
|
||||
SSlag_switch.set_all_measures(FALSE)
|
||||
log_admin("[key_name(usr)] turned all Lag Switch measures OFF.")
|
||||
message_admins("[key_name_admin(usr)] turned all Lag Switch measures OFF.")
|
||||
else
|
||||
var/switch_index = text2num(href_list["change_lag_switch"])
|
||||
if(!SSlag_switch.set_measure(switch_index, !LAZYACCESS(SSlag_switch.measures, switch_index)))
|
||||
to_chat(src, span_danger("Something went wrong when trying to toggle that Lag Switch. Check runtimes for more info."), confidential = TRUE)
|
||||
else
|
||||
log_admin("[key_name(usr)] turned a Lag Switch measure at index ([switch_index]) [LAZYACCESS(SSlag_switch.measures, switch_index) ? "ON" : "OFF"]")
|
||||
message_admins("[key_name_admin(usr)] turned a Lag Switch measure [LAZYACCESS(SSlag_switch.measures, switch_index) ? "ON" : "OFF"]")
|
||||
|
||||
src.show_lag_switch_panel()
|
||||
|
||||
else if(href_list["change_lag_switch_option"])
|
||||
if(!check_rights(R_ADMIN))
|
||||
return
|
||||
|
||||
switch(href_list["change_lag_switch_option"])
|
||||
if("CANCEL")
|
||||
if(SSlag_switch.cancel_auto_enable_in_progress())
|
||||
log_admin("[key_name(usr)] canceled the automatic Lag Switch activation in progress.")
|
||||
message_admins("[key_name_admin(usr)] canceled the automatic Lag Switch activation in progress.")
|
||||
return // return here to avoid (re)rendering the panel for this case
|
||||
if("TOGGLE_AUTO")
|
||||
SSlag_switch.toggle_auto_enable()
|
||||
log_admin("[key_name(usr)] toggled automatic Lag Switch activation [SSlag_switch.auto_switch ? "ON" : "OFF"].")
|
||||
message_admins("[key_name_admin(usr)] toggled automatic Lag Switch activation [SSlag_switch.auto_switch ? "ON" : "OFF"].")
|
||||
if("NUM")
|
||||
var/new_num = input("Enter new threshold value:", "Num") as null|num
|
||||
if(!isnull(new_num))
|
||||
SSlag_switch.trigger_pop = new_num
|
||||
log_admin("[key_name(usr)] set the Lag Switch automatic trigger pop to [new_num].")
|
||||
message_admins("[key_name_admin(usr)] set the Lag Switch automatic trigger pop to [new_num].")
|
||||
if("SLOWCOOL")
|
||||
var/new_num = input("Enter new cooldown in seconds:", "Num") as null|num
|
||||
if(!isnull(new_num))
|
||||
SSlag_switch.change_slowmode_cooldown(new_num)
|
||||
log_admin("[key_name(usr)] set the Lag Switch slowmode cooldown to [new_num] seconds.")
|
||||
message_admins("[key_name_admin(usr)] set the Lag Switch slowmode cooldown to [new_num] seconds.")
|
||||
|
||||
src.show_lag_switch_panel()
|
||||
|
||||
else if(href_list["viewruntime"])
|
||||
var/datum/error_viewer/error_viewer = locate(href_list["viewruntime"])
|
||||
if(!istype(error_viewer))
|
||||
|
||||
Reference in New Issue
Block a user