mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
142 lines
3.4 KiB
Plaintext
142 lines
3.4 KiB
Plaintext
client
|
|
proc/debug_variables(datum/D in world)
|
|
set category = "Debug"
|
|
set name = "View Variables"
|
|
//set src in world
|
|
|
|
|
|
var/title = ""
|
|
var/body = ""
|
|
|
|
if (istype(D, /atom))
|
|
var/atom/A = D
|
|
title = "[A.name] (\ref[A]) = [A.type]"
|
|
|
|
#ifdef VARSICON
|
|
if (A.icon)
|
|
body += debug_variable("icon", new/icon(A.icon, A.icon_state, A.dir), 0)
|
|
#endif
|
|
title = "[D] (\ref[D]) = [D.type]"
|
|
|
|
|
|
body += "<ol>"
|
|
|
|
var/list/names = list()
|
|
for (var/V in D.vars)
|
|
names += V
|
|
|
|
names = sortList(names)
|
|
|
|
for (var/V in names)
|
|
body += debug_variable(V, D.vars[V], 0)
|
|
|
|
body += "</ol>"
|
|
|
|
var/html = "<html><head>"
|
|
if (title)
|
|
html += "<title>[title]</title>"
|
|
html += {"<style>
|
|
body
|
|
{
|
|
font-family: Verdana, sans-serif;
|
|
font-size: 9pt;
|
|
}
|
|
.value
|
|
{
|
|
font-family: "Courier New", monospace;
|
|
font-size: 8pt;
|
|
}
|
|
</style>"}
|
|
html += "</head><body>"
|
|
html += body
|
|
html += "</body></html>"
|
|
|
|
usr << browse(html, "window=variables\ref[D]")
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
proc/debug_variable(name, value, level)
|
|
var/html = ""
|
|
|
|
html += "<li>"
|
|
|
|
if (isnull(value))
|
|
html += "[name] = <span class='value'>null</span>"
|
|
|
|
else if (istext(value))
|
|
html += "[name] = <span class='value'>\"[value]\"</span>"
|
|
|
|
else if (isicon(value))
|
|
#ifdef VARSICON
|
|
var/icon/I = new/icon(value)
|
|
var/rnd = rand(1,10000)
|
|
var/rname = "tmp\ref[I][rnd].png"
|
|
usr << browse_rsc(I, rname)
|
|
html += "[name] = (<span class='value'>[value]</span>) <img class=icon src=\"[rname]\">"
|
|
#else
|
|
html += "[name] = /icon (<span class='value'>[value]</span>)"
|
|
#endif
|
|
|
|
/* else if (istype(value, /image))
|
|
#ifdef VARSICON
|
|
var/rnd = rand(1, 10000)
|
|
var/image/I = value
|
|
|
|
src << browse_rsc(I.icon, "tmp\ref[value][rnd].png")
|
|
html += "[name] = <img src=\"tmp\ref[value][rnd].png\">"
|
|
#else
|
|
html += "[name] = /image (<span class='value'>[value]</span>)"
|
|
#endif
|
|
*/
|
|
else if (isfile(value))
|
|
html += "[name] = <span class='value'>'[value]'</span>"
|
|
|
|
else if (istype(value, /datum))
|
|
var/datum/D = value
|
|
html += "<a href='byond://?src=\ref[src];Vars=\ref[value]'>[name] \ref[value]</a> = [D.type]"
|
|
|
|
else if (istype(value, /client))
|
|
var/client/C = value
|
|
html += "<a href='byond://?src=\ref[src];Vars=\ref[value]'>[name] \ref[value]</a> = [C] [C.type]"
|
|
//
|
|
else if (istype(value, /list))
|
|
var/list/L = value
|
|
html += "[name] = /list ([L.len])"
|
|
|
|
if (L.len > 0 && !(name == "underlays" || name == "overlays" || name == "vars" || L.len > 500))
|
|
// not sure if this is completely right...
|
|
if (0) // (L.vars.len > 0)
|
|
html += "<ol>"
|
|
for (var/entry in L)
|
|
html += debug_variable(entry, L[entry], level + 1)
|
|
html += "</ol>"
|
|
else
|
|
html += "<ul>"
|
|
for (var/index = 1, index <= L.len, index++)
|
|
html += debug_variable("[index]", L[index], level + 1)
|
|
html += "</ul>"
|
|
else
|
|
html += "[name] = <span class='value'>[value]</span>"
|
|
|
|
html += "</li>"
|
|
|
|
return html
|
|
|
|
Topic(href, href_list, hsrc)
|
|
|
|
if (href_list["Vars"])
|
|
debug_variables(locate(href_list["Vars"]))
|
|
else
|
|
..()
|
|
|
|
|
|
|
|
/mob/proc/Delete(atom/A in view())
|
|
set category = "Debug"
|
|
switch (alert("Are you sure you wish to delete \the [A.name] at ([A.x],[A.y],[A.z]) ?", "Admin Delete Object","Yes","No"))
|
|
if("Yes")
|
|
log_admin("[usr.key] deleted [A.name] at ([A.x],[A.y],[A.z])")
|