mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
## About The Pull Request The "Debug Controller" verb wasn't doing anything. You'd click on it, and nothing would happen. Turns out, it was searching for controllers in the wrong place - controllers are considered globals, not part of `/world`. This PR fixes that. Now you get this fancy box instead of nothing:  (As an aside - choosing the Global Variables controller causes several seconds of lag, due to the mass amount of data that needs to be rendered. Perhaps a new verb should be added specifically for going through Global Variables?) ## Why It's Good For The Game Enables coders to debug the various controllers with less need for debug printing statements. ## Why It's Terrible For The Game Enables admins with debug permission to abuse the live server even harder. ## Changelog No player-facing changes. This regards a verb that should only be used during debugging (i.e. locally).
78 lines
2.5 KiB
Plaintext
78 lines
2.5 KiB
Plaintext
// Clickable stat() button.
|
|
/obj/effect/statclick
|
|
name = "Initializing..."
|
|
blocks_emissive = EMISSIVE_BLOCK_NONE
|
|
var/target
|
|
|
|
INITIALIZE_IMMEDIATE(/obj/effect/statclick)
|
|
|
|
/obj/effect/statclick/Initialize(mapload, text, target)
|
|
. = ..()
|
|
name = text
|
|
src.target = target
|
|
if(isdatum(target)) //Harddel man bad
|
|
RegisterSignal(target, COMSIG_QDELETING, PROC_REF(cleanup))
|
|
|
|
/obj/effect/statclick/Destroy()
|
|
target = null
|
|
return ..()
|
|
|
|
/obj/effect/statclick/proc/cleanup()
|
|
SIGNAL_HANDLER
|
|
qdel(src)
|
|
|
|
/obj/effect/statclick/proc/update(text)
|
|
name = text
|
|
return src
|
|
|
|
/obj/effect/statclick/debug
|
|
var/class
|
|
|
|
/obj/effect/statclick/debug/Click()
|
|
if(!usr.client.holder || !target)
|
|
return
|
|
if(!class)
|
|
if(istype(target, /datum/controller/subsystem))
|
|
class = "subsystem"
|
|
else if(istype(target, /datum/controller))
|
|
class = "controller"
|
|
else if(isdatum(target))
|
|
class = "datum"
|
|
else
|
|
class = "unknown"
|
|
|
|
usr.client.debug_variables(target)
|
|
message_admins("Admin [key_name_admin(usr)] is debugging the [target] [class].")
|
|
|
|
ADMIN_VERB(restart_controller, R_DEBUG, "Restart Controller", "Restart one of the various periodic loop controllers for the game (be careful!)", ADMIN_CATEGORY_DEBUG, controller in list("Master", "Failsafe"))
|
|
switch(controller)
|
|
if("Master")
|
|
Recreate_MC()
|
|
BLACKBOX_LOG_ADMIN_VERB("Restart Master Controller")
|
|
if("Failsafe")
|
|
new /datum/controller/failsafe()
|
|
BLACKBOX_LOG_ADMIN_VERB("Restart Failsafe Controller")
|
|
|
|
message_admins("Admin [key_name_admin(user)] has restarted the [controller] controller.")
|
|
|
|
ADMIN_VERB(debug_controller, R_DEBUG, "Debug Controller", "Debug the various periodic loop controllers for the game (be careful!)", ADMIN_CATEGORY_DEBUG)
|
|
var/list/controllers = list()
|
|
var/list/controller_choices = list()
|
|
|
|
for (var/var_key in global.vars)
|
|
var/datum/controller/controller = global.vars[var_key]
|
|
if(!istype(controller) || istype(controller, /datum/controller/subsystem))
|
|
continue
|
|
controllers[controller.name] = controller //we use an associated list to ensure clients can't hold references to controllers
|
|
controller_choices += controller.name
|
|
|
|
var/datum/controller/controller_string = input("Select controller to debug", "Debug Controller") as null|anything in controller_choices
|
|
var/datum/controller/controller = controllers[controller_string]
|
|
|
|
if (!istype(controller))
|
|
return
|
|
SSadmin_verbs.dynamic_invoke_verb(user, /datum/admin_verb/debug_variables, controller)
|
|
|
|
BLACKBOX_LOG_ADMIN_VERB("Debug Controller")
|
|
message_admins("Admin [key_name_admin(user)] is debugging the [controller] controller.")
|