From 6118cc8f48d9e424b59b3cdec50259d22dff7294 Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Mon, 25 Sep 2023 19:03:02 -0400 Subject: [PATCH] Adds a new admin/runtime verb that allows you to easily access global variables without lag (#22407) * fuq yeah * AA review --- code/datums/datumvars.dm | 26 ++++++++++++++++++++++++++ code/modules/admin/admin_verbs.dm | 26 +++++++++++++++----------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index af39a46d8ed..f389f04df60 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -1420,3 +1420,29 @@ if(href_list["listrefresh"]) debug_variables(locate(href_list["listrefresh"])) return TRUE + +/client/proc/debug_global_variables(var_search as text) + set category = "Debug" + set name = "Debug Global Variables" + + if(!check_rights(R_ADMIN|R_VIEWRUNTIMES)) + to_chat(usr, "You need to be an administrator to access this.") + return + + var_search = trim(var_search) + if(!var_search) + return + if(!GLOB.can_vv_get(var_search)) + return + switch(var_search) + if("vars") + return FALSE + if(!(var_search in GLOB.vars)) + to_chat(src, "GLOB.[var_search] does not exist.") + return + log_and_message_admins("is debugging the Global Variables controller with the search term \"[var_search]\"") + var/result = GLOB.vars[var_search] + if(islist(result) || isclient(result) || istype(result, /datum)) + to_chat(src, "Now showing GLOB.[var_search].") + return debug_variables(result) + to_chat(src, "GLOB.[var_search] returned [result].") diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index f5418f6a7f5..53cddf617d3 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -180,7 +180,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, list( /client/proc/debug_timers, /client/proc/force_verb_bypass, /client/proc/show_gc_queues, - /client/proc/toggle_mctabs + /client/proc/toggle_mctabs, + /client/proc/debug_global_variables )) GLOBAL_LIST_INIT(admin_verbs_possess, list( /proc/possess, @@ -239,6 +240,18 @@ GLOBAL_LIST_INIT(admin_verbs_maintainer, list( /client/proc/cinematic, // This will break everyone's screens in the round. Dont use this for adminbus. /client/proc/throw_runtime, // Do I even need to explain why this is locked? )) +GLOBAL_LIST_INIT(view_runtimes_verbs, list( + /client/proc/view_runtimes, + /client/proc/cmd_display_del_log, + /client/proc/cmd_display_del_log_simple, + /client/proc/toggledebuglogs, + /client/proc/debug_variables, /*allows us to -see- the variables of any instance in the game. +VAREDIT needed to modify*/ + /client/proc/ss_breakdown, + /client/proc/show_gc_queues, + /client/proc/toggle_mctabs, + /client/proc/debug_global_variables, + /client/proc/visualise_active_turfs +)) /client/proc/on_holder_add() if(chatOutput && chatOutput.loaded) @@ -287,16 +300,7 @@ GLOBAL_LIST_INIT(admin_verbs_maintainer, list( if(holder.rights & R_MAINTAINER) verbs += GLOB.admin_verbs_maintainer if(holder.rights & R_VIEWRUNTIMES) - // TODO - Make a viewruntimes list at this point - its getting silly - verbs += /client/proc/view_runtimes - verbs += /client/proc/cmd_display_del_log - verbs += /client/proc/cmd_display_del_log_simple - verbs += /client/proc/toggledebuglogs - verbs += /client/proc/debug_variables /*allows us to -see- the variables of any instance in the game. +VAREDIT needed to modify*/ - verbs += /client/proc/ss_breakdown - verbs += /client/proc/show_gc_queues - verbs += /client/proc/toggle_mctabs - verbs += /client/proc/visualise_active_turfs + verbs += GLOB.view_runtimes_verbs spawn(1) // This setting exposes the profiler for people with R_VIEWRUNTIMES. They must still have it set in cfg/admin.txt control_freak = 0