From 5b2cd2f34b8d6cc0ada11ec233d9c5fd71771a25 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Sat, 17 Jun 2023 08:56:05 -0700 Subject: [PATCH] Always contracts lists when VVing GLOB (#76091) ## About The Pull Request This takes render times from like 20 seconds to maybe 2 Most of the time appears to be clientside rn, so the best we could do further would be reducing the amount of shit that actually needs to render So like, removing the E C M buttons (or at least adding a toggle to render them), that sort of thing ## Why It's Good For The Game A glob vv you can actually use ![image](https://github.com/tgstation/tgstation/assets/58055496/d7c29c9a-aa45-4cad-9f38-7131140cab5b) ## Changelog :cl: admin: VV for global vars will now load MUCH faster, in exchange lists are now perma contracted in that particular pane /:cl: --- code/__DEFINES/vv.dm | 5 +++++ code/controllers/globals.dm | 6 ++++++ code/modules/admin/view_variables/debug_variables.dm | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index 7770c63d1d0..32e18e5d146 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -159,3 +159,8 @@ #define VV_HK_TO_OUTFIT_EDITOR "outfit_editor" #define VV_HK_WEAKREF_RESOLVE "weakref_resolve" + +// Flags for debug_variable() that do little things to what we end up rendering + +/// ALWAYS render a reduced list, useful for fuckoff big datums that need to be condensed for the sake of client load +#define VV_ALWAYS_CONTRACT_LIST (1<<0) diff --git a/code/controllers/globals.dm b/code/controllers/globals.dm index dd9b41aacc3..72b00c7d868 100644 --- a/code/controllers/globals.dm +++ b/code/controllers/globals.dm @@ -33,6 +33,12 @@ GLOBAL_REAL(GLOB, /datum/controller/global_vars) return FALSE return ..() +/datum/controller/global_vars/vv_get_var(var_name) + switch(var_name) + if (NAMEOF(src, vars)) + return debug_variable(var_name, list(), 0, src) + return debug_variable(var_name, vars[var_name], 0, src, display_flags = VV_ALWAYS_CONTRACT_LIST) + /datum/controller/global_vars/Initialize() gvars_datum_init_order = list() gvars_datum_protected_varlist = list(NAMEOF(src, gvars_datum_protected_varlist) = TRUE) diff --git a/code/modules/admin/view_variables/debug_variables.dm b/code/modules/admin/view_variables/debug_variables.dm index f92d5de5365..24ee0032a33 100644 --- a/code/modules/admin/view_variables/debug_variables.dm +++ b/code/modules/admin/view_variables/debug_variables.dm @@ -1,6 +1,6 @@ #define VV_HTML_ENCODE(thing) ( sanitize ? html_encode(thing) : thing ) /// Get displayed variable in VV variable list -/proc/debug_variable(name, value, level, datum/D, sanitize = TRUE) //if D is a list, name will be index, and value will be assoc value. +/proc/debug_variable(name, value, level, datum/D, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value. var/header if(D) if(islist(D)) @@ -69,7 +69,7 @@ var/list/L = value var/list/items = list() - if (L.len > 0 && !(name == "underlays" || name == "overlays" || L.len > (IS_NORMAL_LIST(L) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD))) + if (!(display_flags & VV_ALWAYS_CONTRACT_LIST) && L.len > 0 && !(name == "underlays" || name == "overlays" || L.len > (IS_NORMAL_LIST(L) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD))) for (var/i in 1 to L.len) var/key = L[i] var/val