Areas can be used to create large parts of the map (spanning multiple turfs) that respond to Entered and Exited events. For example, you can place a certain type of area over a whole room and use the Entered event to make something happen when you step into the room.
The problem is, what happens if you have a room inside of that room that you need to define a similar Entered event for? Each turf can only be inside of one area, so if you use areas you'll exit the outer room when you enter the inner one. Sometimes this is ok, sometimes it's not.
This library solves the problem by creating an object type called /region. You can create sub-types of /region (ex: /region/my_region) and place them on the map. The object has Entered and Exited events that are called when a mob enters the region, but since they aren't areas a turf can be inside any number of regions.
Version 9 (posted 03-07-2012)
* Added roof-demo which shows how to hide regions of the map until the player enters the region.
Version 8 (posted 03-03-2012)
* Added #define FA_REGION to the .dme file. This can be used outside of this project to detect when the Region library has been included.
* Added the get() and get_list() procs for region objects. The global region.get and region.get_list procs simply call these procs for each region the source turf is in.
* Added the add, remove, added, and removed procs for the /region object. Each proc takes a turf as an argument. The add/remove procs add or remove a turf from the region. The added/removed procs are called when a turf is added or removed from a region.
* Added wire-demo which shows how to create a graphical effect associated with a region. It uses a region to manage which turfs have wires placed on them. It also uses the get_list() proc to find all doors that are connected to a button.
* Moved some code from region.dm into the new movement.dm.
Version 7 (posted 02-29-2012)
* Added the global variable called region which is an object containing the get() and get_list() procs. These procs split the turfs within a region into disjoint sets and search the source atom's set for instances of a specified object type. For example, you can place region objects on the map connecting a switch object to a door object. Then, at runtime, you can call region.get(switch, /obj/door) to get a reference to the door.
* Added button-demo which is an example of what I just described. It uses the region.get() proc to associate buttons with doors.
* Added partition.dm which contains the new features.
* Added _readme.dm which contains a description of the library and a version history.
* Added support for the region's Entered() and Exited() procs when using pixel movement.
* Added support for Enter() and Exit() procs on the region. You can now restrict movement by overriding these procs. When you try to Enter a region, the region's Enter proc will be called. If it returns false the move isn't allowed. The same is done with the Exit proc when leaving a region.
* The library used to use both turf/Entered and mob/Move to detect the Entered and Exited events for regions. The library now only uses mob/Move. This is beneficial because previously, you could break the library by overriding turf/Entered but not call ..().
* To save memory, the turf's regions var is no longer initialized to be a list. If the turf is in any regions it will be set to a list, otherwise it'll be null.
* Fixed a mistake - the region's Entered/Exited procs were being passed the turf, not the mob.
* The /region object now has a list of turfs that it contains.
* Cleaned up the code a little and added some more comments to it.
* Initial post, the library defines the /region
Apr 18 2011, 12:00 am