mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Added reference tracking (#26900)
This commit is contained in:
@@ -52,3 +52,5 @@
|
||||
|
||||
// I wonder what this does
|
||||
#define SHOW_CHANGELOG_ON_NEW_PLAYER_LOGIN !DEVELOPER_MODE
|
||||
|
||||
#define EXTOOLS_REFERENCE_TRACKING DEVELOPER_MODE
|
||||
|
||||
Binary file not shown.
@@ -144,7 +144,9 @@
|
||||
body += "<option value='?_src_=vars;toggle_aliasing=\ref[D]'>Toggle Transform Aliasing</option>"
|
||||
|
||||
body += "<option value='?_src_=vars;proc_call=\ref[D]'>Proc call</option>"
|
||||
|
||||
#if EXTOOLS_REFERENCE_TRACKING
|
||||
body += "<option value='?_src_=vars;view_references=\ref[D]'>View references</option>"
|
||||
#endif
|
||||
body += "<option value>---</option>"
|
||||
|
||||
if(ismob(D))
|
||||
@@ -859,7 +861,7 @@ function loadPage(list) {
|
||||
if ("Monolith")
|
||||
rod_type = /obj/item/projectile/immovablerod/hyper
|
||||
|
||||
if(alert("Are you sure you want to do this?","Confirm","Yes","No") != "Yes")
|
||||
if(alert("Are you sure you want to do this?","Confirm","Yes","No") != "Yes")
|
||||
return
|
||||
|
||||
var/obj/item/projectile/immovablerod/rod = new rod_type(random_start_turf(A.z))
|
||||
@@ -1157,7 +1159,17 @@ function loadPage(list) {
|
||||
return
|
||||
|
||||
callatomproc(DAT) //Yes it could be a datum, technically but eh
|
||||
#if EXTOOLS_REFERENCE_TRACKING
|
||||
else if(href_list["view_references"])
|
||||
if(!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
var/datum/target = locate(href_list["view_references"])
|
||||
if(!target)
|
||||
return
|
||||
|
||||
usr.client.view_refs(target)
|
||||
#endif
|
||||
else if (href_list["edit_transform"])
|
||||
if (!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
45
code/datums/reference_tracking.dm
Normal file
45
code/datums/reference_tracking.dm
Normal file
@@ -0,0 +1,45 @@
|
||||
#if EXTOOLS_REFERENCE_TRACKING
|
||||
|
||||
/proc/get_back_references(datum/D)
|
||||
CRASH("/proc/get_back_references not hooked by extools, reference tracking will not function!")
|
||||
|
||||
/proc/get_forward_references(datum/D)
|
||||
CRASH("/proc/get_forward_references not hooked by extools, reference tracking will not function!")
|
||||
|
||||
/client/verb/view_refs(atom/D) //it actually supports datums as well but byond no likey
|
||||
set category = "Debug"
|
||||
set name = "View References"
|
||||
|
||||
var/list/backrefs = get_back_references(D)
|
||||
if(isnull(backrefs))
|
||||
usr << browse("Reference tracking not enabled", "window=ref_view")
|
||||
return
|
||||
var/list/frontrefs = get_forward_references(D)
|
||||
var/list/dat = list()
|
||||
dat += "<h1>References of \ref[D] - [D]</h1><br><a href='?_src_=vars;view_references=[ref(D)]'>\[Refresh\]</a><hr>"
|
||||
dat += "<h3>Back references - these things hold references to this object.</h3>"
|
||||
dat += "<table>"
|
||||
dat += "<tr><th>Ref</th><th>Type</th><th>Variable Name</th><th>Follow</th>"
|
||||
for(var/ref in backrefs)
|
||||
var/datum/R = ref
|
||||
dat += "<tr><td><a href='?_src_=vars;Vars=[ref(R)]'>"
|
||||
dat += "[ref(R)]</td>"
|
||||
try
|
||||
dat += "<td>[R.type]</td>"
|
||||
catch
|
||||
dat += "<td>RUNTIME ERROR</td>"
|
||||
dat += "<td>[backrefs[R]]</td>"
|
||||
dat += "<td><a href='?_src_=vars;view_references=[ref(R)]'>\[Follow\]</a></td></tr>"
|
||||
dat += "</table><hr>"
|
||||
dat += "<h3>Forward references - this object is referencing those things.</h3>"
|
||||
dat += "<table>"
|
||||
dat += "<tr><th>Variable name</th><th>Ref</th><th>Type</th><th>Follow</th>"
|
||||
for(var/ref in frontrefs)
|
||||
var/datum/R = frontrefs[ref]
|
||||
dat += "<tr><td>[ref]</td><td><a href='?_src_=vars;Vars=[ref(R)]'>[ref(R)]</a></td><td>[R.type]</td><td><a href='?_src_=vars;view_references=[ref(R)]'>\[Follow\]</a></td></tr>"
|
||||
dat += "</table><hr>"
|
||||
dat = dat.Join()
|
||||
|
||||
usr << browse(dat, "window=ref_view;size=800x500")
|
||||
|
||||
#endif
|
||||
@@ -20,6 +20,9 @@ var/savefile/panicfile
|
||||
var/extools_path = system_type == MS_WINDOWS ? "byond-extools.dll" : "libbyond-extools.so"
|
||||
if(fexists(extools_path))
|
||||
call(extools_path, "maptick_initialize")()
|
||||
#if EXTOOLS_REFERENCE_TRACKING
|
||||
call(extools_path, "ref_tracking_initialize")()
|
||||
#endif
|
||||
else
|
||||
// warn on missing library
|
||||
// extools on linux does not exist and is not in the repository as of yet
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
#include "code\datums\profiling.dm"
|
||||
#include "code\datums\recipe.dm"
|
||||
#include "code\datums\recruiter.dm"
|
||||
#include "code\datums\reference_tracking.dm"
|
||||
#include "code\datums\religions.dm"
|
||||
#include "code\datums\shuttle.dm"
|
||||
#include "code\datums\sun.dm"
|
||||
|
||||
Reference in New Issue
Block a user