proc/locate_all(tag)
. = list()
var datum/found
do
found = locate(tag)
if(found)
found.tag = null
. += found
while(found)
for(found in .) found.tag = tag
Returns a list of all datums with the given tag.
I used this to let a single switch on the map to unlock multiple doors.
e.g.:
/*
You would set up your doors and buttons on the map using the instance editor.
Edit a door instance and set its "tag" variable to some text identifier.
Then, make sure the button has its door_tag equal to the door's tag.
Normally, you would only be able to use one unique tag per door.
With locate_all(), tags no longer have to be unique.
*/
obj/button
var door_tag
Crossed(mob/M)
if(istype(M) && M.client)
for(var/obj/door/door in locate_all(door_tag))
door.Unlock()
loc = null