|NODE_STATE_FREE||Allocation of map regions.|
|/datum/allocated_region||Represents a map region you have allocated access to. While you hold a reference to this region you are free to assume nothing else will allocate this part of the map and touch your region. You should also not go out of its bounds of course. Deallocate the region by qdel()ing it or dropping all references to it.|
Allocation of map regions.
The system written in this file is used to get access to rectangular regions of the map space where you can place whatever you want to. Intended usage is for map structures that either don't need to be loaded at all times or of which there can be multiples of. For example if you wanted to make a locker that leads to its pocket dimension you will need to create a new pocket dimension for each locker. That's where allocating a region for each of them would come in handy.
var/datum/allocated_region/region = global.region_allocator.allocate(width=10, height=8) for(var/x in 1 to region.width) for(var/y in 1 to region.height) if(x == 1 || y == 1 || x == region.width || y == region.height) region.turf_at(x, y).ReplaceWith(/turf/unsimulated/wall) else region.turf_at(x, y).ReplaceWith(/turf/unsimulated/floor) mob.set_loc(region.turf_at(2, 2)) boutput(mob, "You are in prison now.") SPAWN(60 SECONDS) mob.set_loc(whatever) qdel(region)