. = list()
found = locate(tag)
found.tag = null
. += 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.
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.
if(istype(M) && M.client)
for(var/obj/door/door in locate_all(door_tag))
loc = null