mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-16 12:43:09 +00:00
About The Pull Request Adds extools-powered reference tracking. Includes a couple procs that retrieve the back and forward references of a datum - Back references let you see what is referencing your object and potentially preventing it from garbage collecting, and forward ones show you what your object in turn references. Also made a cool GUI to inspect and follow these references. The tracking adds some overhead to all variable sets and list operations. Init time is increased by ~15%. I haven't actually benched it so it might impact the actual game less. Why It's Good For The Game no lagging caused by hard dels scanning the entire planet (once coders fix them)
82 lines
3.3 KiB
Plaintext
82 lines
3.3 KiB
Plaintext
//Not using datum.vv_do_topic for very basic/low level debug things, incase the datum's vv_do_topic is runtiming/whatnot.
|
|
/client/proc/vv_do_basic(datum/target, href_list)
|
|
var/target_var = GET_VV_VAR_TARGET
|
|
if(check_rights(R_VAREDIT))
|
|
if(target_var)
|
|
if(href_list[VV_HK_BASIC_EDIT])
|
|
if(!modify_variables(target, target_var, 1))
|
|
return
|
|
switch(target_var)
|
|
if("name")
|
|
vv_update_display(target, "name", "[target]")
|
|
if("dir")
|
|
var/atom/A = target
|
|
if(istype(A))
|
|
vv_update_display(target, "dir", dir2text(A.dir) || A.dir)
|
|
if("ckey")
|
|
var/mob/living/L = target
|
|
if(istype(L))
|
|
vv_update_display(target, "ckey", L.ckey || "No ckey")
|
|
if("real_name")
|
|
var/mob/living/L = target
|
|
if(istype(L))
|
|
vv_update_display(target, "real_name", L.real_name || "No real name")
|
|
if(href_list[VV_HK_BASIC_CHANGE])
|
|
modify_variables(target, target_var, 0)
|
|
if(href_list[VV_HK_BASIC_MASSEDIT])
|
|
cmd_mass_modify_object_variables(target, target_var)
|
|
if(check_rights(R_ADMIN, FALSE))
|
|
if(href_list[VV_HK_EXPOSE])
|
|
var/value = vv_get_value(VV_CLIENT)
|
|
if (value["class"] != VV_CLIENT)
|
|
return
|
|
var/client/C = value["value"]
|
|
if (!C)
|
|
return
|
|
if(!target)
|
|
to_chat(usr, "<span class='warning'>The object you tried to expose to [C] no longer exists (nulled or hard-deled)</span>", confidential = TRUE)
|
|
return
|
|
message_admins("[key_name_admin(usr)] Showed [key_name_admin(C)] a <a href='?_src_=vars;datumrefresh=[REF(target)]'>VV window</a>")
|
|
log_admin("Admin [key_name(usr)] Showed [key_name(C)] a VV window of a [target]")
|
|
to_chat(C, "[holder.fakekey ? "an Administrator" : "[usr.client.key]"] has granted you access to view a View Variables window", confidential = TRUE)
|
|
C.debug_variables(target)
|
|
if(check_rights(R_DEBUG))
|
|
if(href_list[VV_HK_DELETE])
|
|
usr.client.admin_delete(target)
|
|
if (isturf(src)) // show the turf that took its place
|
|
usr.client.debug_variables(src)
|
|
if(href_list[VV_HK_MARK])
|
|
usr.client.mark_datum(target)
|
|
if(href_list[VV_HK_ADDCOMPONENT])
|
|
if(!check_rights(NONE))
|
|
return
|
|
var/list/names = list()
|
|
var/list/componentsubtypes = sortList(subtypesof(/datum/component), /proc/cmp_typepaths_asc)
|
|
names += "---Components---"
|
|
names += componentsubtypes
|
|
names += "---Elements---"
|
|
names += sortList(subtypesof(/datum/element), /proc/cmp_typepaths_asc)
|
|
var/result = input(usr, "Choose a component/element to add","better know what ur fuckin doin pal") as null|anything in names
|
|
if(!usr || !result || result == "---Components---" || result == "---Elements---")
|
|
return
|
|
if(QDELETED(src))
|
|
to_chat(usr, "That thing doesn't exist anymore!", confidential = TRUE)
|
|
return
|
|
var/list/lst = get_callproc_args()
|
|
if(!lst)
|
|
return
|
|
var/datumname = "error"
|
|
lst.Insert(1, result)
|
|
if(result in componentsubtypes)
|
|
datumname = "component"
|
|
target._AddComponent(lst)
|
|
else
|
|
datumname = "element"
|
|
target._AddElement(lst)
|
|
log_admin("[key_name(usr)] has added [result] [datumname] to [key_name(src)].")
|
|
message_admins("<span class='notice'>[key_name_admin(usr)] has added [result] [datumname] to [key_name_admin(src)].</span>")
|
|
if(href_list[VV_HK_CALLPROC])
|
|
usr.client.callproc_datum(target)
|
|
if(href_list[VV_HK_VIEW_REFERENCES])
|
|
usr.client.view_refs(target)
|