From fbcb1b924fba9c57b29271c58b6cd89bf6829cea Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Sat, 26 Jan 2019 12:22:43 -0800 Subject: [PATCH] [s]Advance proc call no longer allows you to call world/datum procs as global procs (#42529) * [s]Advance proc call no longer allows you to call world/datum procs as static procs * Update debug.dm --- code/modules/admin/verbs/debug.dm | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index c4c99e054e3..631e8cd6037 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -52,25 +52,22 @@ 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 - - //hascall() doesn't support proc paths (eg: /proc/gib(), it only supports "gib") - var/testname = procname - if(targetselected) - //Find one of the 3 possible ways they could have written /proc/PROCNAME - if(findtext(procname, "/proc/")) - testname = replacetext(procname, "/proc/", "") - else if(findtext(procname, "/proc")) - testname = replacetext(procname, "/proc", "") - else if(findtext(procname, "proc/")) - testname = replacetext(procname, "proc/", "") - //Clear out any parenthesis if they're a dummy - testname = replacetext(testname, "()", "") - - if(targetselected && !hascall(target,testname)) - to_chat(usr, "Error: callproc(): type [target.type] has no proc named [procname].") + + //strip away everything but the proc name + var/list/proclist = splittext(procname, "/") + if (!length(proclist)) + return + procname = proclist[proclist.len] + + var/proctype = "proc" + if ("verb" in proclist) + proctype = "verb" + + if(targetselected && !hascall(target, procname)) + to_chat(usr, "Error: callproc(): type [target.type] has no [proctype] named [procname].") return else - var/procpath = text2path(procname) + var/procpath = text2path("[proctype]/[procname]") if (!procpath) to_chat(usr, "Error: callproc(): proc [procname] does not exist. (Did you forget the /proc/ part?)") return