#define ICON_STATE_CHECKED 1 /// this dmi is checked. We don't check this one anymore. #define ICON_STATE_NULL 2 /// this dmi has null-named icon_state, allowing it to show a sprite on vv editor. /client/proc/debug_variables(datum/D in world) set category = "Debug.Investigate" set name = "View Variables" //set src in world var/static/cookieoffset = rand(1, 9999) //to force cookies to reset after the round. if(!usr.client || !usr.client.holder) //The usr vs src abuse in this proc is intentional and must not be changed to_chat(usr, span_danger("You need to be an administrator to access this.")) return if(!D) return var/dark = usr.client.prefs ? usr.client.prefs.read_preference(/datum/preference/toggle/holder/vv_dark) : TRUE var/use_gfi = usr.client.prefs ? usr.client.prefs.read_preference(/datum/preference/toggle/holder/vv_gfi) : TRUE var/datum/asset/asset_cache_datum = get_asset_datum(/datum/asset/simple/vv) asset_cache_datum.send(usr) var/islist = islist(D) || (!isdatum(D) && hascall(D, "Cut")) // Some special lists don't count as lists, but can be detected by if they have list procs if(!islist && !isdatum(D)) return //VOREStation Edit Start - the rest of this proc in a spawn spawn(0) var/title = "" var/refid = "\ref[D]" var/icon/sprite var/hash var/type = islist ? /list : D.type var/no_icon = FALSE if(isatom(D)) var/atom/AT = D if(use_gfi) sprite = getFlatIcon(D) if(!sprite) no_icon = TRUE else if(AT.icon && AT.icon_state) sprite = new /icon(AT.icon, AT.icon_state) else no_icon = TRUE else if(isimage(D)) // icon_state=null shows first image even if dmi has no icon_state for null name. // This list remembers which dmi has null icon_state, to determine if icon_state=null should display a sprite // (NOTE: icon_state="" is correct, but saying null is obvious) var/static/list/dmi_nullstate_checklist = list() var/image/image_object = D var/icon_filename_text = "[image_object.icon]" // "icon(null)" type can exist. textifying filters it. if(icon_filename_text) if(image_object.icon_state) sprite = icon(image_object.icon, image_object.icon_state) else // it means: icon_state="" if(!dmi_nullstate_checklist[icon_filename_text]) dmi_nullstate_checklist[icon_filename_text] = ICON_STATE_CHECKED if(icon_exists(image_object.icon, "")) // this dmi has nullstate. We'll allow "icon_state=null" to show image. dmi_nullstate_checklist[icon_filename_text] = ICON_STATE_NULL if(dmi_nullstate_checklist[icon_filename_text] == ICON_STATE_NULL) sprite = icon(image_object.icon, image_object.icon_state) var/sprite_text if(sprite) hash = md5(sprite) src << browse_rsc(sprite, "vv[hash].png") sprite_text = no_icon ? "\[NO ICON\]" : "" title = "[D] (\ref[D]) = [type]" var/formatted_type = replacetext("[type]", "/", "/") var/list/header = islist(D)? list(span_bold("/list")) : D.vv_get_header() var/ref_line = "@[copytext(refid, 2, -1)]" // get rid of the brackets, add a @ prefix for copy pasting in asay var/marked_line if(holder && holder.marked_datum && holder.marked_datum == D) marked_line = VV_MSG_MARKED var/varedited_line = "" if(!islist && (D.datum_flags & DF_VAR_EDITED)) varedited_line = VV_MSG_EDITED var/deleted_line if(!islist && D.gc_destroyed) deleted_line = VV_MSG_DELETED var/list/dropdownoptions = list() var/autoconvert_dropdown = FALSE if (islist) dropdownoptions = list( "---", "Add Item" = "?_src_=vars;[HrefToken()];[VV_HK_LIST_ADD]=TRUE;target=[refid]", "Remove Nulls" = "?_src_=vars;[HrefToken()];[VV_HK_LIST_ERASE_NULLS]=TRUE;target=[refid]", "Remove Dupes" = "?_src_=vars;[HrefToken()];[VV_HK_LIST_ERASE_DUPES]=TRUE;target=[refid]", "Set len" = "?_src_=vars;[HrefToken()];[VV_HK_LIST_SET_LENGTH]=TRUE;target=[refid]", "Shuffle" = "?_src_=vars;[HrefToken()];[VV_HK_LIST_SHUFFLE]=TRUE;target=[refid]", // "Show VV To Player" = "?_src_=vars;[HrefToken()];[VV_HK_EXPOSE]=TRUE;target=[refid]" // TODO - Not yet implemented for lists ) autoconvert_dropdown = TRUE else dropdownoptions = D.vv_get_dropdown() var/list/dropdownoptions_html = list() if(autoconvert_dropdown) for (var/name in dropdownoptions) var/link = dropdownoptions[name] if (link) dropdownoptions_html += "" else dropdownoptions_html += "" else dropdownoptions_html = dropdownoptions + D.get_view_variables_options() var/list/names = list() if (!islist) names = D.get_variables() //sleep(1)//For some reason, without this sleep, VVing will cause client to disconnect on certain objects. //VOREStation edit - commented out, replaced with spawn(0) above var/ui_scale = prefs?.read_preference(/datum/preference/toggle/ui_scale) var/list/variable_html = list() if(islist) var/list/L = D for (var/i in 1 to L.len) var/key = L[i] var/value if(IS_NORMAL_LIST(L) && IS_VALID_ASSOC_KEY(key)) value = L[key] variable_html += debug_variable(i, value, 0, D) else names = sortList(names) for (var/V in names) if(D.can_vv_get(V)) variable_html += D.vv_get_var(V) var/html = {" [title] [!ui_scale && window_scaling ? "" : ""]
[sprite_text]
[header.Join()]
[formatted_type]
[ref_line] [marked_line] [varedited_line] [deleted_line]
Refresh

E - Edit, tries to determine the variable type by itself.
C - Change, asks you for the var type first.
M - Mass modify: changes this variable for all objects of this type.

Search:

    [variable_html.Join()]
"} var/size_string = "size=475x650"; if(ui_scale && window_scaling) size_string = "size=[475 * window_scaling]x[650 * window_scaling]" src << browse(html, "window=variables[refid];[size_string]") /client/proc/vv_update_display(datum/D, span, content) src << output("[span]:[content]", "variables\ref[D].browser:replace_span") #undef ICON_STATE_CHECKED #undef ICON_STATE_NULL