diff --git a/code/modules/admin/view_variables/debug_variable_appearance.dm b/code/modules/admin/view_variables/debug_variable_appearance.dm index abeab3d7721ef..33dd63a70b5d5 100644 --- a/code/modules/admin/view_variables/debug_variable_appearance.dm +++ b/code/modules/admin/view_variables/debug_variable_appearance.dm @@ -5,30 +5,37 @@ * /appearance references are not capable of executing procs, because these are not real /image * This is why these global procs exist. Welcome to the curse. */ +#define ADD_UNUSED_VAR(varlist, thing, varname) if(NAMEOF(##thing, ##varname)) ##varlist += #varname +#define RESULT_VARIABLE_NOT_FOUND "_switch_result_variable_not_found" + /// Makes a var list of /appearance type actually uses. This will be only called once. /proc/build_virtual_appearance_vars() - . = list("vis_flags") // manual listing - var/list/unused_var_names = list( - "appearance", // it only does self-reference - "x","y","z", // these are always 0 - "weak_reference", // it's not a good idea to make a weak_ref on this, and this won't have it - "vars", // inherited from /image, but /appearance hasn't this - - // we have no reason to show those, right? - "active_timers", - "comp_lookup", - "datum_components", - "signal_procs", - "status_traits", - "gc_destroyed", - "stat_tabs", - "cooldowns", - "datum_flags", - "visibility", - "verbs", - "tgui_shared_states" - ) + var/list/used_variables = list("vis_flags") // manual listing. + . = used_variables + var/list/unused_var_names = list() + var/image/dummy_image = image(null, null) + ADD_UNUSED_VAR(unused_var_names, dummy_image, appearance) // it only does self-reference + ADD_UNUSED_VAR(unused_var_names, dummy_image, x) // xyz are always 0 + ADD_UNUSED_VAR(unused_var_names, dummy_image, y) + ADD_UNUSED_VAR(unused_var_names, dummy_image, z) + ADD_UNUSED_VAR(unused_var_names, dummy_image, weak_reference) // it's not a good idea to make a weak_ref on this, and this won't have it + ADD_UNUSED_VAR(unused_var_names, dummy_image, vars) // inherited from /image, but /appearance hasn't this + + // we have no reason to show these, right? + ADD_UNUSED_VAR(unused_var_names, dummy_image, active_timers) + ADD_UNUSED_VAR(unused_var_names, dummy_image, comp_lookup) + ADD_UNUSED_VAR(unused_var_names, dummy_image, datum_components) + ADD_UNUSED_VAR(unused_var_names, dummy_image, signal_procs) + ADD_UNUSED_VAR(unused_var_names, dummy_image, status_traits) + ADD_UNUSED_VAR(unused_var_names, dummy_image, gc_destroyed) + ADD_UNUSED_VAR(unused_var_names, dummy_image, stat_tabs) + ADD_UNUSED_VAR(unused_var_names, dummy_image, cooldowns) + ADD_UNUSED_VAR(unused_var_names, dummy_image, datum_flags) + ADD_UNUSED_VAR(unused_var_names, dummy_image, visibility) + ADD_UNUSED_VAR(unused_var_names, dummy_image, tgui_shared_states) + ADD_UNUSED_VAR(unused_var_names, dummy_image, tgui_shared_states) + for(var/each in dummy_image.vars) // try to inherit var list from /image if(each in unused_var_names) continue @@ -36,137 +43,143 @@ del(dummy_image) dummy_image = null -/// appearance type needs a manual var referencing because it doesn't have "vars" variable internally. -/// There's no way doing this in a fancier way. +/// debug_variable() proc but made for /appearance type specifically /proc/debug_variable_appearance(var_name, appearance) var/value try - switch(var_name) // Welcome to this curse - // appearance doesn't have "vars" variable. - // This means you need to target a variable manually through this way. - - // appearance vars in DM document - if("alpha") - value = appearance:alpha - if("appearance_flags") - value = appearance:appearance_flags - if("blend_mode") - value = appearance:blend_mode - if("color") - value = appearance:color - if("desc") - value = appearance:desc - if("gender") - value = appearance:gender - if("icon") - value = appearance:icon - if("icon_state") - value = appearance:icon_state - if("invisibility") - value = appearance:invisibility - if("infra_luminosity") - value = appearance:infra_luminosity - if("filters") - value = appearance:filters - if("layer") - value = appearance:layer - if("luminosity") - value = appearance:luminosity - if("maptext") - value = appearance:maptext - if("maptext_width") - value = appearance:maptext_width - if("maptext_height") - value = appearance:maptext_height - if("maptext_x") - value = appearance:maptext_x - if("maptext_y") - value = appearance:maptext_y - if("mouse_over_pointer") - value = appearance:mouse_over_pointer - if("mouse_drag_pointer") - value = appearance:mouse_drag_pointer - if("mouse_drop_pointer") - value = appearance:mouse_drop_pointer - if("mouse_drop_zone") - value = appearance:mouse_drop_zone - if("mouse_opacity") - value = appearance:mouse_opacity - if("name") - value = appearance:name - if("opacity") - value = appearance:opacity - if("overlays") - value = appearance:overlays - if("override") - value = appearance:override - if("pixel_x") - value = appearance:pixel_x - if("pixel_y") - value = appearance:pixel_y - if("pixel_w") - value = appearance:pixel_w - if("pixel_z") - value = appearance:pixel_z - if("plane") - value = appearance:plane - if("render_source") - value = appearance:render_source - if("render_target") - value = appearance:render_target - if("suffix") - value = appearance:suffix - if("text") - value = appearance:text - if("transform") - value = appearance:transform - if("underlays") - value = appearance:underlays - - if("parent_type") - value = appearance:parent_type - if("type") - value = "/appearance (as [appearance:type])" // don't fool people - - // These are not documented ones but trackable values. Maybe we'd want these. - if("animate_movement") - value = appearance:animate_movement - if("dir") - value = appearance:dir - if("glide_size") - value = appearance:glide_size - if("pixel_step_size") - value = "" //appearance:pixel_step_size - // DM compiler complains this - - // I am not sure if these will be ever detected, but I made a connection just in case. - if("contents") - value = appearance:contents - if("vis_contents") - value = appearance:vis_contents - if("vis_flags") // DM document says /appearance has this, but it throws error - value = appearance:vis_flags - if("loc") - value = appearance:loc - - // we wouldn't need these, but let's these trackable anyway... - if("density") - value = appearance:density - if("screen_loc") - value = appearance:screen_loc - if("sorted_verbs") - value = appearance:sorted_verbs - if("tag") - value = appearance:tag - if("cached_ref") - value = appearance:cached_ref - - else - return "