#define VV_HTML_ENCODE(thing) ( sanitize ? html_encode(thing) : thing ) /// Get displayed variable in VV variable list /proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value. if(owner) if(islist(owner)) var/list/list_owner = owner var/index = name if (value) name = list_owner[name] //name is really the index until this line else value = list_owner[name] . = "
  • ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_EDIT, "E", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_CHANGE, "C", index)]) ([VV_HREF_TARGET_1V(owner, VV_HK_LIST_REMOVE, "-", index)]) " else . = "
  • ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_EDIT, "E", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_CHANGE, "C", name)]) ([VV_HREF_TARGET_1V(owner, VV_HK_BASIC_MASSEDIT, "M", name)]) " else . = "
  • " var/name_part = VV_HTML_ENCODE(name) if(level > 0 || islist(owner)) //handling keys in assoc lists if(istype(name,/datum)) name_part = "[VV_HTML_ENCODE(name)] [REF(name)]" else if(islist(name)) var/list/list_value = name name_part = " /list ([length(list_value)]) [REF(name)]" . = "[.][name_part] = " var/item = _debug_variable_value(name, value, level, owner, sanitize, display_flags) return "[.][item]
  • " // This is split into a separate proc mostly to make errors that happen not break things too much /proc/_debug_variable_value(name, value, level, datum/owner, sanitize, display_flags) if(isappearance(value)) value = get_vv_appearance(value) . = "DISPLAY_ERROR: ([value] [REF(value)])" // Make sure this line can never runtime if(isnull(value)) return "null" if(istext(value)) return "\"[VV_HTML_ENCODE(value)]\"" if(isicon(value)) #ifdef VARSICON var/icon/icon_value = icon(value) var/rnd = rand(1,10000) var/rname = "tmp[REF(icon_value)][rnd].png" usr << browse_rsc(icon_value, rname) return "([value]) " #else return "/icon ([value])" #endif if(isfilter(value)) var/datum/filter_value = value return "/filter ([filter_value.type] [REF(filter_value)])" if(isfile(value)) return "'[value]'" if(isdatum(value)) var/datum/datum_value = value return datum_value.debug_variable_value(name, level, owner, sanitize, display_flags) if(islist(value) || (name in GLOB.vv_special_lists)) // Some special lists aren't detectable as a list through istype var/list/list_value = value var/list/items = list() // This is because some lists either don't count as lists or a locate on their ref will return null var/link_vars = "Vars=[REF(value)]" if(name in GLOB.vv_special_lists) link_vars = "Vars=[REF(owner)];special_varname=[name]" if (!(display_flags & VV_ALWAYS_CONTRACT_LIST) && list_value.len > 0 && list_value.len <= (IS_NORMAL_LIST(list_value) ? VV_NORMAL_LIST_NO_EXPAND_THRESHOLD : VV_SPECIAL_LIST_NO_EXPAND_THRESHOLD)) for (var/i in 1 to list_value.len) var/key = list_value[i] var/val if (IS_NORMAL_LIST(list_value) && !isnum(key)) val = list_value[key] if (isnull(val)) // we still want to display non-null false values, such as 0 or "" val = key key = i items += debug_variable(key, val, level + 1, sanitize = sanitize) return "/list ([list_value.len])" else return "/list ([list_value.len])" if(name in GLOB.bitfields) var/list/flags = list() for (var/i in GLOB.bitfields[name]) if (value & GLOB.bitfields[name][i]) flags += i if(length(flags)) return "[VV_HTML_ENCODE(jointext(flags, ", "))]" else return "NONE" else return "[VV_HTML_ENCODE(value)]" /datum/proc/debug_variable_value(name, level, datum/owner, sanitize, display_flags) if("[src]" != "[type]") // If we have a name var, let's use it. return "[src] [type] [REF(src)]" else return "[type] [REF(src)]" /datum/weakref/debug_variable_value(name, level, datum/owner, sanitize, display_flags) . = ..() return "[.] (Resolve)" /matrix/debug_variable_value(name, level, datum/owner, sanitize, display_flags) return {"
     
    [a][d]0
    [b][e]0
    [c][f]1
     
    "} //TODO link to modify_transform wrapper for all matrices #undef VV_HTML_ENCODE