Skip to content

Commit af73460

Browse files
type filter
1 parent 221a819 commit af73460

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

code/modules/admin/verbs/debug.dm

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Call proc /mob/proc/Dizzy() for some player
2727
Because if you select a player mob as owner it tries to do the proc for
2828
/mob/living/carbon/human/ instead. And that gives a run-time error.
2929
But you can call procs that are of type /mob/living/carbon/human/proc/ for that player.
30+
14th oct 2024
31+
now actually filters to a type, redundant procs cut down
3032
*/
3133

3234
/client/proc/calladvproc()
@@ -39,30 +41,23 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
3941
var/target = null
4042
var/class = null
4143

42-
switch(alert("Proc owned by something?",,"Yes","No"))
43-
if("Yes")
44-
class = input("Proc owned by...","Owner",null) as null|anything in list("Obj","Mob","Area or Turf","Client")
45-
if(!class)
46-
return
47-
48-
var/list/stufftocall = list()
49-
if(class == "Client")
50-
for(var/client/C in clients)
51-
stufftocall += C
52-
else if(class == "Mob")
53-
stufftocall = mob_list
54-
else
55-
for(var/atom/A in world)
56-
if(class == "Obj")
57-
if(isobj(A))
58-
stufftocall += A
59-
else if(class == "Area or Turf")
60-
if(isarea(A) || isturf(A))
61-
stufftocall += A
62-
IN_ROUND_CHECK_TICK //bam. now it doesn't freeze the game anymore
63-
target = input("Enter target", "Target:", class == "Area or Turf" ? usr.loc : usr, null) as null|anything in stufftocall
64-
if(!target)
65-
return
44+
if(alert("Proc owned by something?","Proc call","Yes","No") == "Yes")
45+
class = input("Proc owned by what type of atom? (eg. /obj/machinery)","Owner",null) as text
46+
if(!class)
47+
return
48+
class = filter_typelist_input("Select an atom type", "Spawn Atom", get_matching_types(class, /atom))
49+
50+
var/list/stufftocall = list()
51+
if(class == "/client")
52+
stufftocall = clients
53+
else
54+
for(var/atom/A in world)
55+
if(istype(A,class))
56+
stufftocall |= A
57+
IN_ROUND_CHECK_TICK //bam. now it doesn't freeze the game anymore
58+
target = input("Enter target", "Target:", ispath(class,/area) || ispath(class,/turf) ? usr.loc : usr, null) as null|anything in stufftocall
59+
if(!target)
60+
return
6661

6762
callproc(usr,target)
6863
feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

0 commit comments

Comments
 (0)