diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 8844b5c5be4..976ce7085e3 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -40,7 +40,12 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that switch(alert("Proc owned by something?",,"Yes","No")) if("Yes") targetselected = 1 - class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client") + if(src.holder && src.holder.marked_datum) + class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client","Marked datum ([holder.marked_datum.type])") + if(class == "Marked datum ([holder.marked_datum.type])") + class = "Marked datum" + else + class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client") switch(class) if("Obj") target = input("Enter target:","Target",usr) as obj in world @@ -53,6 +58,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that for(var/client/C) keys += C target = input("Please, select a player!", "Selection", null, null) as null|anything in keys + if("Marked datum") + target = holder.marked_datum else return if("No") @@ -61,7 +68,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(targetselected && !hascall(target,procname)) + usr << "Error: callproc(): target has no such call [procname]." + return var/list/lst = get_callproc_args() if(!lst) return @@ -70,9 +79,6 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(!target) usr << "Error: callproc(): owner of proc no longer exists." return - if(!hascall(target,procname)) - usr << "Error: callproc(): target has no such call [procname]." - 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 @@ -93,7 +99,9 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that var/procname = input("Proc name, eg: fake_blood","Proc:", null) as text|null if(!procname) return - + if(!hascall(A,procname)) + usr << "Error: callproc_datum(): target has no such call [procname]." + return var/list/lst = get_callproc_args() if(!lst) return @@ -101,9 +109,6 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if(!A || !IsValidSrc(A)) usr << "Error: callproc_datum(): owner of proc no longer exists." return - if(!hascall(A,procname)) - usr << "Error: callproc_datum(): target has no such call [procname]." - return log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].") spawn() @@ -115,15 +120,21 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that /client/proc/get_callproc_args() var/argnum = input("Number of arguments","Number:",0) as num|null if(!argnum && (argnum!=0)) return - + var/list/lst = list() //TODO: make a list to store whether each argument was initialised as null. //Reason: So we can abort the proccall if say, one of our arguments was a mob which no longer exists //this will protect us from a fair few errors ~Carn while(argnum--) + var/class = null // Make a list with each index containing one variable, to be given to the proc - var/class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area","CANCEL") + if(src.holder && src.holder.marked_datum) + class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area","Marked datum ([holder.marked_datum.type])","CANCEL") + if(holder.marked_datum && class == "Marked datum ([holder.marked_datum.type])") + class = "Marked datum" + else + class = input("What kind of variable?","Variable Type") in list("text","num","type","reference","mob reference","icon","file","client","mob's area","CANCEL") switch(class) if("CANCEL") return null @@ -158,6 +169,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that if("mob's area") var/mob/temp = input("Select mob", "Selection", usr) as mob in world lst += temp.loc + if("Marked datum") + lst += holder.marked_datum return lst