Edit variables and view variables combined.

Screenshot:
http://www.kamletos.si/view%20vars3.JPG

What C and E mean is written on the window itself.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2178 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-09-11 19:18:04 +00:00
parent 214336dbc9
commit 0a974b3c0e
2 changed files with 180 additions and 75 deletions
+48 -6
View File
@@ -1,3 +1,6 @@
// reference: /client/proc/modify_variables(var/atom/O, var/param_var_name = null, var/autodetect_class = 0)
client
proc/debug_variables(datum/D in world)
set category = "Debug"
@@ -19,6 +22,12 @@ client
#endif
title = "[D] (\ref[D]) = [D.type]"
body += "<div align='center'><table width='100%'><tr><td width='50%'><div align='center'><b>[D]<br><font size='1'>[D.type]</font></b></div></td>"
body += "<td width='50%'><div align='center'><a href='byond://?src=\ref[src];datumrefresh=\ref[D];refresh=1'>Refresh</a></div></td></tr></table></div><hr>"
body += "<font size='1'><b>E</b> - Edit, tries to determine the variable type by itself.<br>"
body += "<b>C</b> - Change, asks you for the var type first.</font>"
body += "<ol>"
@@ -29,7 +38,7 @@ client
names = sortList(names)
for (var/V in names)
body += debug_variable(V, D.vars[V], 0)
body += debug_variable(V, D.vars[V], 0, D)
body += "</ol>"
@@ -56,13 +65,13 @@ client
return
proc/debug_variable(name, value, level)
proc/debug_variable(name, value, level, var/datum/DA = null)
var/html = ""
html += "<li>"
if(DA)
html += "<li>(<a href='byond://?src=\ref[src];datumedit=\ref[DA];varnameedit=[name]'>E</a>) (<a href='byond://?src=\ref[src];datumchange=\ref[DA];varnamechange=[name]'>C</a>) "
else
html += "<li>"
if (isnull(value))
html += "[name] = <span class='value'>null</span>"
@@ -130,6 +139,39 @@ client
if (href_list["Vars"])
debug_variables(locate(href_list["Vars"]))
else if (href_list["varnameedit"])
if(!href_list["datumedit"] || !href_list["varnameedit"])
usr << "Varedit error: Not all information has been sent Contact a coder."
return
var/datum/DAT = locate(href_list["datumedit"])
if(!DAT)
usr << "Item not found"
return
if(!istype(DAT,/datum))
usr << "Can't edit an item of this type. Type must be /datum, so anything except simple variables. [DAT]"
return
modify_variables(DAT, href_list["varnameedit"], 1)
else if (href_list["varnamechange"])
if(!href_list["datumchange"] || !href_list["varnamechange"])
usr << "Varedit error: Not all information has been sent. Contact a coder."
return
var/datum/DAT = locate(href_list["datumchange"])
if(!DAT)
usr << "Item not found"
return
if(!istype(DAT,/datum))
usr << "Can't edit an item of this type. Type must be /datum, so anything except simple variables. [DAT]"
return
modify_variables(DAT, href_list["varnamechange"], 0)
else if (href_list["refresh"])
if(!href_list["datumrefresh"])
return
var/datum/DAT = locate(href_list["datumrefresh"])
if(!DAT)
return
if(!istype(DAT,/datum))
return
src.debug_variables(DAT)
else
..()