region |
The region's added() and removed() procs are called each time a turf is added to the region or removed from it. To manage the graphical effect we simply create or delete an instance of /obj/wire. That wire object manages the autojoining, so the region is only responsible for creating and deleting these objects.
We can make use of the region's get_list() proc to find which objects are connected to another object through the wire. When the mob places a wire on the map or removes existing wire, we simply add or remove turfs from the wire region - it handles the rest (ex: placing the /obj/wire object).
client |
When you step on a button, you just need to call wire.get_list(button, /turf/door) to find the doors it's connected to.