Big debugging/adminbus QoL improvements.

This commit is contained in:
PJB3005
2015-08-05 15:02:04 +02:00
committed by d3athrow
parent 4a579754c5
commit f2372b5a19
5 changed files with 546 additions and 464 deletions

View File

@@ -1,474 +1,474 @@
// reference: /client/proc/modify_variables(var/atom/O, var/param_var_name = null, var/autodetect_class = 0)
client
proc/debug_reagents(datum/D in world)
set category = "Debug"
set name = "Add Reagent"
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_reagents() called tick#: [world.time]")
if(!usr.client || !usr.client.holder)
usr << "<span class='warning'>You need to be an administrator to access this.</span>"
return
if(!D) return
if(istype(D, /atom))
var/atom/A = D
var/reagentDatum = input(usr,"Reagent","Insert Reagent","") as text|null
if(reagentDatum)
var/reagentAmount = input(usr, "Amount", "Insert Amount", "") as num
if(A.reagents.add_reagent(reagentDatum, reagentAmount))
usr << "<span class='warning'>[reagentDatum] doesn't exist.</span>"
return
log_admin("[key_name(usr)] added [reagentDatum] with [reagentAmount] units to [A] ")
message_admins("[key_name(usr)] added [reagentDatum] with [reagentAmount] units to [A] ")
proc/debug_variables(datum/D in world)
set category = "Debug"
set name = "View Variables"
//set src in world
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_variables() called tick#: [world.time]")
if(!usr.client || !usr.client.holder)
usr << "<span class='warning'>You need to be an administrator to access this.</span>"
return
var/title = ""
var/body = ""
if(!D) return
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
var/icon/sprite
if(istype(D,/atom))
var/atom/AT = D
if(AT.icon && AT.icon_state)
sprite = new /icon(AT.icon, AT.icon_state)
usr << browse_rsc(sprite, "view_vars_sprite.png")
title = "[D] (\ref[D]) = [D.type]"
body += {"<script type="text/javascript">
function updateSearch(){
var filter_text = document.getElementById('filter');
var filter = filter_text.value.toLowerCase();
if(event.keyCode == 13){ //Enter / return
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
alist = lis\[i\].getElementsByTagName("a")
if(alist.length > 0){
location.href=alist\[0\].href;
}
}
}catch(err) { }
}
return
}
if(event.keyCode == 38){ //Up arrow
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
if( (i-1) >= 0){
var li_new = lis\[i-1\];
li.style.backgroundColor = "white";
li_new.style.backgroundColor = "#ffee88";
return
}
}
}catch(err) { }
}
return
}
if(event.keyCode == 40){ //Down arrow
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
if( (i+1) < lis.length){
var li_new = lis\[i+1\];
li.style.backgroundColor = "white";
li_new.style.backgroundColor = "#ffee88";
return
}
}
}catch(err) { }
}
return
}
//This part here resets everything to how it was at the start so the filter is applied to the complete list. Screw efficiency, it's client-side anyway and it only looks through 200 or so variables at maximum anyway (mobs).
if(complete_list != null && complete_list != ""){
var vars_ol1 = document.getElementById("vars");
vars_ol1.innerHTML = complete_list
}
if(filter.value == ""){
return;
}else{
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.innerText.toLowerCase().indexOf(filter) == -1 )
{
vars_ol.removeChild(li);
i--;
}
}catch(err) { }
}
}
var lis_new = vars_ol.getElementsByTagName("li");
for ( var j = 0; j < lis_new.length; ++j )
{
var li1 = lis\[j\];
if (j == 0){
li1.style.backgroundColor = "#ffee88";
}else{
li1.style.backgroundColor = "white";
}
}
}
function selectTextField(){
var filter_text = document.getElementById('filter');
filter_text.focus();
filter_text.select();
}
function loadPage(list) {
if(list.options\[list.selectedIndex\].value == ""){
return;
}
location.href=list.options\[list.selectedIndex\].value;
}
</script> "}
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:162: body += "<body onload='selectTextField(); updateSearch()' onkeyup='updateSearch()'>"
body += {"<body onload='selectTextField(); updateSearch()' onkeyup='updateSearch()'>
<div align='center'><table width='100%'><tr><td width='50%'>"}
// END AUTOFIX
if(sprite)
body += "<table align='center' width='100%'><tr><td><img src='view_vars_sprite.png'></td><td>"
else
body += "<table align='center' width='100%'><tr><td>"
body += "<div align='center'>"
if(istype(D,/atom))
var/atom/A = D
if(isliving(A))
body += "<a href='?_src_=vars;rename=\ref[D]'><b>[D]</b></a>"
if(A.dir)
body += "<br><font size='1'><a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=left'><<</a> <a href='?_src_=vars;datumedit=\ref[D];varnameedit=dir'>[dir2text(A.dir)]</a> <a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=right'>>></a></font>"
var/mob/living/M = A
body += "<br><font size='1'><a href='?_src_=vars;datumedit=\ref[D];varnameedit=ckey'>[M.ckey ? M.ckey : "No ckey"]</a> / <a href='?_src_=vars;datumedit=\ref[D];varnameedit=real_name'>[M.real_name ? M.real_name : "No real name"]</a></font>"
body += {"
<br><font size='1'>
BRUTE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=brute'>[M.getBruteLoss()]</a>
FIRE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=fire'>[M.getFireLoss()]</a>
TOXIN:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=toxin'>[M.getToxLoss()]</a>
OXY:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=oxygen'>[M.getOxyLoss()]</a>
CLONE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=clone'>[M.getCloneLoss()]</a>
BRAIN:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=brain'>[M.getBrainLoss()]</a>
</font>
"}
else
body += "<a href='?_src_=vars;datumedit=\ref[D];varnameedit=name'><b>[D]</b></a>"
if(A.dir)
body += "<br><font size='1'><a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=left'><<</a> <a href='?_src_=vars;datumedit=\ref[D];varnameedit=dir'>[dir2text(A.dir)]</a> <a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=right'>>></a></font>"
else
body += "<b>[D]</b>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:200: body += "</div>"
body += {"</div>
</tr></td></table>"}
// END AUTOFIX
var/formatted_type = text("[D.type]")
if(length(formatted_type) > 25)
var/middle_point = length(formatted_type) / 2
var/splitpoint = findtext(formatted_type,"/",middle_point)
if(splitpoint)
formatted_type = "[copytext(formatted_type,1,splitpoint)]<br>[copytext(formatted_type,splitpoint)]"
else
formatted_type = "Type too long" //No suitable splitpoint (/) found.
body += "<div align='center'><b><font size='1'>[formatted_type]</font></b>"
if(src.holder && src.holder.marked_datum && src.holder.marked_datum == D)
body += "<br><font size='1' color='red'><b>Marked Object</b></font>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:218: body += "</div>"
body += {"</div>
</div></td>
<td width='50%'><div align='center'><a href='?_src_=vars;datumrefresh=\ref[D]'>Refresh</a>"}
// END AUTOFIX
//if(ismob(D))
// body += "<br><a href='?_src_=vars;mob_player_panel=\ref[D]'>Show player panel</a></div></td></tr></table></div><hr>"
body += {" <form>
<select name="file" size="1"
onchange="loadPage(this.form.elements\[0\])"
target="_parent._top"
onmouseclick="this.focus()"
style="background-color:#ffffff">
"}
body += {" <option value>Select option</option>
<option value> </option>
"}
body += "<option value='?_src_=vars;mark_object=\ref[D]'>Mark Object</option>"
if(ismob(D))
body += "<option value='?_src_=vars;mob_player_panel=\ref[D]'>Show player panel</option>"
if(istype(D,/atom/movable))
body += "<option value='?_src_=vars;teleport_here=\ref[D]'>Teleport Here</option>"
if(istype(D,/atom))
body += "<option value='?_src_=vars;teleport_to=\ref[D]'>Teleport To</option>"
body += "<option value>---</option>"
if(ismob(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:247: body += "<option value='?_src_=vars;give_spell=\ref[D]'>Give Spell</option>"
body += {"<option value='?_src_=vars;give_spell=\ref[D]'>Give Spell</option>
<option value='?_src_=vars;give_disease=\ref[D]'>Give Disease</option>
<option value='?_src_=vars;godmode=\ref[D]'>Toggle Godmode</option>
<option value='?_src_=vars;build_mode=\ref[D]'>Toggle Build Mode</option>
<option value='?_src_=vars;make_skeleton=\ref[D]'>Make 2spooky</option>
<option value='?_src_=vars;direct_control=\ref[D]'>Assume Direct Control</option>
<option value='?_src_=vars;drop_everything=\ref[D]'>Drop Everything</option>
<option value='?_src_=vars;regenerateicons=\ref[D]'>Regenerate Icons</option>
<option value='?_src_=vars;addlanguage=\ref[D]'>Add Language</option>
<option value='?_src_=vars;remlanguage=\ref[D]'>Remove Language</option>"}
// END AUTOFIX
if(ishuman(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:262: body += "<option value>---</option>"
body += {"<option value>---</option>
<option value='?_src_=vars;setmutantrace=\ref[D]'>Set Mutantrace</option>
<option value='?_src_=vars;setspecies=\ref[D]'>Set Species</option>
<option value='?_src_=vars;makeai=\ref[D]'>Make AI</option>
<option value='?_src_=vars;makerobot=\ref[D]'>Make cyborg</option>
<option value='?_src_=vars;makemonkey=\ref[D]'>Make monkey</option>
<option value='?_src_=vars;makealien=\ref[D]'>Make alien</option>
<option value='?_src_=vars;makeslime=\ref[D]'>Make slime</option>
<option value='?_src_=vars;makecluwne=\ref[D]'>Make cluwne</option>"}
// END AUTOFIX
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:270: body += "<option value>---</option>"
body += {"<option value>---</option>
<option value='?_src_=vars;gib=\ref[D]'>Gib</option>"}
// END AUTOFIX
if(istype(D,/atom))
body += "<option value='?_src_=vars;delete=\ref[D]'>Delete</option>"
if(isobj(D))
body += "<option value='?_src_=vars;delall=\ref[D]'>Delete all of type</option>"
if(isobj(D) || ismob(D) || isturf(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:275: body += "<option value='?_src_=vars;explode=\ref[D]'>Trigger explosion</option>"
body += {"<option value='?_src_=vars;explode=\ref[D]'>Trigger explosion</option>
<option value='?_src_=vars;emp=\ref[D]'>Trigger EM pulse</option>"}
// END AUTOFIX
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:278: body += "</select></form>"
body += {"</select></form>
</div></td></tr></table></div><hr>
<font size='1'><b>E</b> - Edit, tries to determine the variable type by itself.<br>
<b>C</b> - Change, asks you for the var type first.<br>
<b>M</b> - Mass modify: changes this variable for all objects of this type.</font><br>
<hr><table width='100%'><tr><td width='20%'><div align='center'><b>Search:</b></div></td><td width='80%'><input type='text' id='filter' name='filter_text' value='' style='width:100%;'></td></tr></table><hr>
<ol id='vars'>"}
// END AUTOFIX
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, D)
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 += {"
<script type='text/javascript'>
var vars_ol = document.getElementById("vars");
var complete_list = vars_ol.innerHTML;
</script>
"}
html += "</body></html>"
usr << browse(html, "window=variables\ref[D];size=475x650")
/client/proc/debug_reagents(datum/D in world)
set category = "Debug"
set name = "Add Reagent"
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_reagents() called tick#: [world.time]")
if(!usr.client || !usr.client.holder)
usr << "<span class='warning'>You need to be an administrator to access this.</span>"
return
proc/debug_variable(name, value, level, var/datum/DA = null)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_variable() called tick#: [world.time]")
var/html = ""
if(!D) return
if(istype(D, /atom))
var/atom/A = D
var/reagentDatum = input(usr,"Reagent","Insert Reagent","") as text|null
if(reagentDatum)
var/reagentAmount = input(usr, "Amount", "Insert Amount", "") as num
if(A.reagents.add_reagent(reagentDatum, reagentAmount))
usr << "<span class='warning'>[reagentDatum] doesn't exist.</span>"
return
log_admin("[key_name(usr)] added [reagentDatum] with [reagentAmount] units to [A] ")
message_admins("[key_name(usr)] added [reagentDatum] with [reagentAmount] units to [A] ")
if(DA)
html += "<li style='backgroundColor:white'>(<a href='?_src_=vars;datumedit=\ref[DA];varnameedit=[name]'>E</a>) (<a href='?_src_=vars;datumchange=\ref[DA];varnamechange=[name]'>C</a>) (<a href='?_src_=vars;datummass=\ref[DA];varnamemass=[name]'>M</a>) "
/client/proc/debug_variables(datum/D in world)
set category = "Debug"
set name = "View Variables"
//set src in world
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_variables() called tick#: [world.time]")
if(!usr.client || !usr.client.holder)
usr << "<span class='warning'>You need to be an administrator to access this.</span>"
return
var/title = ""
var/body = ""
if(!D) return
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
var/icon/sprite
if(istype(D,/atom))
var/atom/AT = D
if(AT.icon && AT.icon_state)
sprite = new /icon(AT.icon, AT.icon_state)
usr << browse_rsc(sprite, "view_vars_sprite.png")
title = "[D] (\ref[D]) = [D.type]"
body += {"<script type="text/javascript">
function updateSearch(){
var filter_text = document.getElementById('filter');
var filter = filter_text.value.toLowerCase();
if(event.keyCode == 13){ //Enter / return
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
alist = lis\[i\].getElementsByTagName("a")
if(alist.length > 0){
location.href=alist\[0\].href;
}
}
}catch(err) { }
}
return
}
if(event.keyCode == 38){ //Up arrow
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
if( (i-1) >= 0){
var li_new = lis\[i-1\];
li.style.backgroundColor = "white";
li_new.style.backgroundColor = "#ffee88";
return
}
}
}catch(err) { }
}
return
}
if(event.keyCode == 40){ //Down arrow
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.style.backgroundColor == "#ffee88" )
{
if( (i+1) < lis.length){
var li_new = lis\[i+1\];
li.style.backgroundColor = "white";
li_new.style.backgroundColor = "#ffee88";
return
}
}
}catch(err) { }
}
return
}
//This part here resets everything to how it was at the start so the filter is applied to the complete list. Screw efficiency, it's client-side anyway and it only looks through 200 or so variables at maximum anyway (mobs).
if(complete_list != null && complete_list != ""){
var vars_ol1 = document.getElementById("vars");
vars_ol1.innerHTML = complete_list
}
if(filter.value == ""){
return;
}else{
var vars_ol = document.getElementById('vars');
var lis = vars_ol.getElementsByTagName("li");
for ( var i = 0; i < lis.length; ++i )
{
try{
var li = lis\[i\];
if ( li.innerText.toLowerCase().indexOf(filter) == -1 )
{
vars_ol.removeChild(li);
i--;
}
}catch(err) { }
}
}
var lis_new = vars_ol.getElementsByTagName("li");
for ( var j = 0; j < lis_new.length; ++j )
{
var li1 = lis\[j\];
if (j == 0){
li1.style.backgroundColor = "#ffee88";
}else{
li1.style.backgroundColor = "white";
}
}
}
function selectTextField(){
var filter_text = document.getElementById('filter');
filter_text.focus();
filter_text.select();
}
function loadPage(list) {
if(list.options\[list.selectedIndex\].value == ""){
return;
}
location.href=list.options\[list.selectedIndex\].value;
}
</script> "}
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:162: body += "<body onload='selectTextField(); updateSearch()' onkeyup='updateSearch()'>"
body += {"<body onload='selectTextField(); updateSearch()' onkeyup='updateSearch()'>
<div align='center'><table width='100%'><tr><td width='50%'>"}
// END AUTOFIX
if(sprite)
body += "<table align='center' width='100%'><tr><td><img src='view_vars_sprite.png'></td><td>"
else
body += "<table align='center' width='100%'><tr><td>"
body += "<div align='center'>"
if(istype(D,/atom))
var/atom/A = D
if(isliving(A))
body += "<a href='?_src_=vars;rename=\ref[D]'><b>[D]</b></a>"
if(A.dir)
body += "<br><font size='1'><a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=left'><<</a> <a href='?_src_=vars;datumedit=\ref[D];varnameedit=dir'>[dir2text(A.dir)]</a> <a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=right'>>></a></font>"
var/mob/living/M = A
body += "<br><font size='1'><a href='?_src_=vars;datumedit=\ref[D];varnameedit=ckey'>[M.ckey ? M.ckey : "No ckey"]</a> / <a href='?_src_=vars;datumedit=\ref[D];varnameedit=real_name'>[M.real_name ? M.real_name : "No real name"]</a></font>"
body += {"
<br><font size='1'>
BRUTE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=brute'>[M.getBruteLoss()]</a>
FIRE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=fire'>[M.getFireLoss()]</a>
TOXIN:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=toxin'>[M.getToxLoss()]</a>
OXY:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=oxygen'>[M.getOxyLoss()]</a>
CLONE:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=clone'>[M.getCloneLoss()]</a>
BRAIN:<font size='1'><a href='?_src_=vars;mobToDamage=\ref[D];adjustDamage=brain'>[M.getBrainLoss()]</a>
</font>
"}
else
html += "<li>"
body += "<a href='?_src_=vars;datumedit=\ref[D];varnameedit=name'><b>[D]</b></a>"
if(A.dir)
body += "<br><font size='1'><a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=left'><<</a> <a href='?_src_=vars;datumedit=\ref[D];varnameedit=dir'>[dir2text(A.dir)]</a> <a href='?_src_=vars;rotatedatum=\ref[D];rotatedir=right'>>></a></font>"
else
body += "<b>[D]</b>"
if (isnull(value))
html += "[name] = <span class='value'>null</span>"
else if (istext(value))
html += "[name] = <span class='value'>\"[value]\"</span>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:200: body += "</div>"
body += {"</div>
</tr></td></table>"}
// END AUTOFIX
var/formatted_type = text("[D.type]")
if(length(formatted_type) > 25)
var/middle_point = length(formatted_type) / 2
var/splitpoint = findtext(formatted_type,"/",middle_point)
if(splitpoint)
formatted_type = "[copytext(formatted_type,1,splitpoint)]<br>[copytext(formatted_type,splitpoint)]"
else
formatted_type = "Type too long" //No suitable splitpoint (/) found.
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
body += "<div align='center'><b><font size='1'>[formatted_type]</font></b>"
if(src.holder && src.holder.marked_datum && src.holder.marked_datum == D)
body += "<br><font size='1' color='red'><b>Marked Object</b></font>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:218: body += "</div>"
body += {"</div>
</div></td>
<td width='50%'><div align='center'><a href='?_src_=vars;datumrefresh=\ref[D]'>Refresh</a>"}
// END AUTOFIX
//if(ismob(D))
// body += "<br><a href='?_src_=vars;mob_player_panel=\ref[D]'>Show player panel</a></div></td></tr></table></div><hr>"
body += {" <form>
<select name="file" size="1"
onchange="loadPage(this.form.elements\[0\])"
target="_parent._top"
onmouseclick="this.focus()"
style="background-color:#ffffff">
"}
body += {" <option value>Select option</option>
<option value> </option>
"}
body += "<option value='?_src_=vars;mark_object=\ref[D]'>Mark Object</option>"
if(ismob(D))
body += "<option value='?_src_=vars;mob_player_panel=\ref[D]'>Show player panel</option>"
if(istype(D,/atom/movable))
body += "<option value='?_src_=vars;teleport_here=\ref[D]'>Teleport Here</option>"
if(istype(D,/atom))
body += "<option value='?_src_=vars;teleport_to=\ref[D]'>Teleport To</option>"
body += "<option value='?_src_=vars;proc_call=\ref[D]'>Proc call</option>"
body += "<option value>---</option>"
if(ismob(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:247: body += "<option value='?_src_=vars;give_spell=\ref[D]'>Give Spell</option>"
body += {"<option value='?_src_=vars;give_spell=\ref[D]'>Give Spell</option>
<option value='?_src_=vars;give_disease=\ref[D]'>Give Disease</option>
<option value='?_src_=vars;godmode=\ref[D]'>Toggle Godmode</option>
<option value='?_src_=vars;build_mode=\ref[D]'>Toggle Build Mode</option>
<option value='?_src_=vars;make_skeleton=\ref[D]'>Make 2spooky</option>
<option value='?_src_=vars;direct_control=\ref[D]'>Assume Direct Control</option>
<option value='?_src_=vars;drop_everything=\ref[D]'>Drop Everything</option>
<option value='?_src_=vars;regenerateicons=\ref[D]'>Regenerate Icons</option>
<option value='?_src_=vars;addlanguage=\ref[D]'>Add Language</option>
<option value='?_src_=vars;remlanguage=\ref[D]'>Remove Language</option>"}
// END AUTOFIX
if(ishuman(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:262: body += "<option value>---</option>"
body += {"<option value>---</option>
<option value='?_src_=vars;setmutantrace=\ref[D]'>Set Mutantrace</option>
<option value='?_src_=vars;setspecies=\ref[D]'>Set Species</option>
<option value='?_src_=vars;makeai=\ref[D]'>Make AI</option>
<option value='?_src_=vars;makerobot=\ref[D]'>Make cyborg</option>
<option value='?_src_=vars;makemonkey=\ref[D]'>Make monkey</option>
<option value='?_src_=vars;makealien=\ref[D]'>Make alien</option>
<option value='?_src_=vars;makeslime=\ref[D]'>Make slime</option>
<option value='?_src_=vars;makecluwne=\ref[D]'>Make cluwne</option>"}
// END AUTOFIX
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:270: body += "<option value>---</option>"
body += {"<option value>---</option>
<option value='?_src_=vars;gib=\ref[D]'>Gib</option>"}
// END AUTOFIX
if(istype(D,/atom))
body += "<option value='?_src_=vars;delete=\ref[D]'>Delete</option>"
if(isobj(D))
body += "<option value='?_src_=vars;delall=\ref[D]'>Delete all of type</option>"
if(isobj(D) || ismob(D) || isturf(D))
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:275: body += "<option value='?_src_=vars;explode=\ref[D]'>Trigger explosion</option>"
body += {"<option value='?_src_=vars;explode=\ref[D]'>Trigger explosion</option>
<option value='?_src_=vars;emp=\ref[D]'>Trigger EM pulse</option>"}
// END AUTOFIX
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:278: body += "</select></form>"
body += {"</select></form>
</div></td></tr></table></div><hr>
<font size='1'><b>E</b> - Edit, tries to determine the variable type by itself.<br>
<b>C</b> - Change, asks you for the var type first.<br>
<b>M</b> - Mass modify: changes this variable for all objects of this type.</font><br>
<hr><table width='100%'><tr><td width='20%'><div align='center'><b>Search:</b></div></td><td width='80%'><input type='text' id='filter' name='filter_text' value='' style='width:100%;'></td></tr></table><hr>
<ol id='vars'>"}
// END AUTOFIX
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, D)
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 += {"
<script type='text/javascript'>
var vars_ol = document.getElementById("vars");
var complete_list = vars_ol.innerHTML;
</script>
"}
html += "</body></html>"
usr << browse(html, "window=variables\ref[D];size=475x650")
return
/client/proc/debug_variable(name, value, level, var/datum/DA = null)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\proc/debug_variable() called tick#: [world.time]")
var/html = ""
if(DA)
html += "<li style='backgroundColor:white'>(<a href='?_src_=vars;datumedit=\ref[DA];varnameedit=[name]'>E</a>) (<a href='?_src_=vars;datumchange=\ref[DA];varnamechange=[name]'>C</a>) (<a href='?_src_=vars;datummass=\ref[DA];varnamemass=[name]'>M</a>) "
else
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
#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
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 (isfile(value))
html += "[name] = <span class='value'>'[value]'</span>"
else if (istype(value, /datum))
var/datum/D = value
html += "<a href='?_src_=vars;Vars=\ref[value]'>[name] \ref[value]</a> = [D.type]"
else if (istype(value, /datum))
var/datum/D = value
html += "<a href='?_src_=vars;Vars=\ref[value]'>[name] \ref[value]</a> = [D.type]"
else if (istype(value, /client))
var/client/C = value
html += "<a href='?_src_=vars;Vars=\ref[value]'>[name] \ref[value]</a> = [C] [C.type]"
//
else if (istype(value, /list))
var/list/L = value
html += "[name] = /list ([L.len])"
else if (istype(value, /client))
var/client/C = value
html += "<a href='?_src_=vars;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)
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)
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:386: html += "<ol>"
html += {"<ol>
</ol>"}
// END AUTOFIX
else
html += "<ul>"
var/index = 1
for (var/entry in L)
if(istext(entry))
html += debug_variable(entry, L[entry], level + 1)
//html += debug_variable("[index]", L[index], level + 1)
else
html += debug_variable(index, L[index], level + 1)
index++
html += "</ul>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\\documents\\\projects\vgstation13\code\\datums\\datumvars.dm:386: html += "<ol>"
html += {"<ol>
</ol>"}
// END AUTOFIX
else
html += "<ul>"
var/index = 1
for (var/entry in L)
if(istext(entry))
html += debug_variable(entry, L[entry], level + 1)
//html += debug_variable("[index]", L[index], level + 1)
else
html += debug_variable(index, L[index], level + 1)
index++
html += "</ul>"
else
html += "[name] = <span class='value'>[value]</span>"
/*
// Bitfield stuff
if(round(value)==value) // Require integers.
var/idx=0
var/bit=0
var/bv=0
html += "<div class='value binary'>"
for(var/block=0;block<8;block++)
html += " <span class='block'>"
for(var/i=0;i<4;i++)
idx=(block*4)+i
bit=1 << idx
bv=value & bit
html += "<a href='?_src_=vars;togbit=[idx];var=[name];subject=\ref[DA]' title='bit [idx] ([bit])'>[bv?1:0]</a>"
html += "</span>"
html += "</div>"
*/
html += "</li>"
else
html += "[name] = <span class='value'>[value]</span>"
/*
// Bitfield stuff
if(round(value)==value) // Require integers.
var/idx=0
var/bit=0
var/bv=0
html += "<div class='value binary'>"
for(var/block=0;block<8;block++)
html += " <span class='block'>"
for(var/i=0;i<4;i++)
idx=(block*4)+i
bit=1 << idx
bv=value & bit
html += "<a href='?_src_=vars;togbit=[idx];var=[name];subject=\ref[DA]' title='bit [idx] ([bit])'>[bv?1:0]</a>"
html += "</span>"
html += "</div>"
*/
html += "</li>"
return html
return html
/client/proc/view_var_Topic(href, href_list, hsrc)
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/client/proc/view_var_Topic() called tick#: [world.time]")
@@ -987,10 +987,20 @@ client
message_admins("<span class='notice'>[key_name(usr)] dealt [amount] amount of [Text] damage to [L] </span>")
href_list["datumrefresh"] = href_list["mobToDamage"]
if(href_list["datumrefresh"])
else if(href_list["datumrefresh"])
var/datum/DAT = locate(href_list["datumrefresh"])
if(!istype(DAT, /datum))
return
src.debug_variables(DAT)
else if(href_list["proc_call"])
if(!check_rights(R_DEBUG))
return
var/datum/DAT = locate(href_list["proc_call"])
if(!DAT)
return
callatomproc(DAT) //Yes it could be a datum, technically but eh
return

View File

@@ -1268,7 +1268,6 @@ var/global/floorIsLava = 0
log_admin("[key_name(usr)] spawned [chosen] at ([usr.x],[usr.y],[usr.z])")
feedback_add_details("admin_verb","SA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/datum/admins/proc/show_traitor_panel(var/mob/M in mob_list)
set category = "Admin"
set desc = "Edit mobs's memory and role"

View File

@@ -117,7 +117,8 @@ var/list/admin_verbs_fun = list(
/client/proc/makepAI
)
var/list/admin_verbs_spawn = list(
/datum/admins/proc/spawn_atom, /*allows us to spawn instances*/
/datum/admins/proc/spawn_atom, /* Allows us to spawn instances. */
/client/proc/spawn_datum, /* Allows us to spawn datums to the marked datum buffer. */
/client/proc/respawn_character
)
var/list/admin_verbs_server = list(
@@ -279,7 +280,8 @@ var/list/admin_verbs_mod = list(
/client/proc/cmd_mod_window,
/datum/admins/proc/show_player_info,
/client/proc/player_panel_new,
/datum/admins/proc/show_skills
/datum/admins/proc/show_skills,
/client/proc/vv_marked_datum
)
/client/proc/add_admin_verbs()
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/client/proc/add_admin_verbs() called tick#: [world.time]")

View File

@@ -66,6 +66,10 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null
if(!procname) return
if(!hascall(target,procname))
usr << "<span style='color: red;'>Error: callproc(): target has no such call [procname].</span>"
return
var/argnum = input("Number of arguments","Number:",0) as num|null
if(!argnum && (argnum!=0)) return
@@ -75,10 +79,14 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
//this will protect us from a fair few errors ~Carn
var/i
for(i=1, i<argnum+1, i++) // Lists indexed from 1 forwards in byond
for(i = 1, i < argnum + 1, i++) // Lists indexed from 1 forwards in byond
// Make a list with each index containing one variable, to be given to the proc
class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area","CANCEL")
class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area", holder.marked_datum ? "marked datum ([holder.marked_datum.type])" : null, "CANCEL")
if(holder.marked_datum && class == "marked datum ([holder.marked_datum.type])")
class = "marked_datum"
switch(class)
if("CANCEL")
return
@@ -114,13 +122,14 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/mob/temp = input("Select mob", "Selection", usr) as mob in world
lst[i] = temp.loc
if("marked_datum")
lst[i] = holder.marked_datum
if(targetselected)
if(!target)
usr << "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>"
return
if(!hascall(target,procname))
usr << "<font color='red'>Error: callproc(): target has no such call [procname].</font>"
return
log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
returnval = call(target,procname)(arglist(lst)) // Pass the lst as an argument list to the proc
else
@@ -131,7 +140,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
usr << "<font color='blue'>[procname] returned: [returnval ? returnval : "null"]</font>"
feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/callatomproc(var/atom/target as anything)
/client/proc/callatomproc(var/datum/target as anything)
set category = "Debug"
set name = "Atom ProcCall"
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/client/proc/callatomproc() called tick#: [world.time]")
@@ -147,6 +156,9 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null
if(!procname) return
if(!hascall(target, procname))
usr << "<span style='color: red;'>Error: callatomproc(): target has no such call [procname].</span>"
var/argnum = input("Number of arguments","Number:",0) as num|null
if(!argnum && (argnum!=0)) return
@@ -156,10 +168,14 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
//this will protect us from a fair few errors ~Carn
var/i
for(i=1, i<argnum+1, i++) // Lists indexed from 1 forwards in byond
for(i = 1, i < argnum + 1, i++) // Lists indexed from 1 forwards in byond
// Make a list with each index containing one variable, to be given to the proc
class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area","CANCEL")
class = input("What kind of variable?","Variable Type") in list("text", "num", "type", "reference", "mob reference", "icon", "file", "client", "mob's area", holder.marked_datum ? "marked datum ([holder.marked_datum.type])" : null, "CANCEL")
if(holder.marked_datum && class == "marked datum ([holder.marked_datum.type])")
class = "marked_datum"
switch(class)
if("CANCEL")
return
@@ -195,6 +211,9 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/mob/temp = input("Select mob", "Selection", usr) as mob in world
lst[i] = temp.loc
if("marked_datum")
lst[i] = holder.marked_datum
log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
returnval = call(target,procname)(arglist(lst)) // Pass the lst as an argument list to the proc
@@ -1803,3 +1822,51 @@ client/proc/cure_disease()
src << "<span class='notice'>Cured [count] mob\s of [disease_name == "-Cure All-" ? "all diseases." : "[disease_name]"]</span>"
log_admin("[src]/([ckey(src.key)] Cured all mobs of [disease_name == "-Cure All-" ? "all diseases." : "[disease_name]"]")
message_admins("[src]/([ckey(src.key)] Cured all mobs of [disease_name == "-Cure All-" ? "all diseases." : "[disease_name]"]")
/client/proc/spawn_datum(var/object as text)
set category = "Debug"
set desc = "(datum path) Spawn a datum (turfs NOT supported)"
set name = "Spawn Datum"
//writepanic("[__FILE__].[__LINE__] ([src.type])([usr ? usr.ckey : ""]) \\/datum/admins/proc/spawn_atom() called tick#: [world.time]")
if(!check_rights(R_SPAWN))
return
var/list/matches[0]
for(var/path in typesof(/datum) - typesof(/turf))
if(findtext("[path]", object))
matches += path
if(matches.len == 0)
usr << "Unable to find any matches."
return
var/chosen
if(matches.len == 1)
chosen = matches[1]
else
chosen = input("Select a datum type", "Spawn Datum", matches[1]) as null|anything in matches
if(!chosen)
return
holder.marked_datum = new chosen()
usr << "<span class='notify'>A reference to the new [chosen] has been stored in your marked datum.</span>"
log_admin("[key_name(usr)] spawned the datum [chosen] to his marked datum.")
feedback_add_details("admin_verb","SD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/vv_marked_datum()
set category = "Debug"
set desc = "Opens a VV menu for your marked datum."
set name = "View Marked Datum's Vars"
if(!check_rights(R_DEBUG))
return
if(!holder.marked_datum)
usr << "<span class='warning'>You do not have a marked datum!</span>"
return
debug_variables(holder.marked_datum)

View File

@@ -0,0 +1,4 @@
author: PJB3005
delete-after: true
changes:
- tweak: Admins can now create any datums, call procs through VV, and use marked datums in proc calls.