Made defineRegion() procs additive instead of overwriting, overwriting has been moved to a "replace" argument, adds undefineRegion() which makes the map list a new list.

This commit is contained in:
Remie Richards
2015-05-01 01:38:39 +01:00
committed by Tigercat2000
parent 7a0a724d6c
commit baa758921b
2 changed files with 24 additions and 9 deletions
@@ -13,17 +13,20 @@
//Defines the region the map represents, sets map
//Returns the map
/datum/mapGenerator/proc/defineRegion(var/turf/Start, var/turf/End)
/datum/mapGenerator/proc/defineRegion(var/turf/Start, var/turf/End, var/replace = 0)
if(!checkRegion(Start, End))
return 0
map = block(Start,End)
if(replace)
undefineRegion()
map |= block(Start,End)
return map
//Defines the region the map represents, as a CIRCLE!, sets map
//Returns the map
/datum/mapGenerator/proc/defineCircularRegion(var/turf/Start, var/turf/End)
/datum/mapGenerator/proc/defineCircularRegion(var/turf/Start, var/turf/End, var/replace = 0)
if(!checkRegion(Start, End))
return 0
@@ -34,10 +37,18 @@
var/turf/center = locate(centerX, centerY, centerZ) //spherical maps! because Idk
map = circlerange(center,radius)
if(replace)
undefineRegion()
map |= circlerange(center,radius)
return map
//Empties the map list, he's dead jim.
/datum/mapGenerator/proc/undefineRegion()
map = list() //bai bai
//Checks for and Rejects bad region coordinates
//Returns 1/0
/datum/mapGenerator/proc/checkRegion(var/turf/Start, var/turf/End)
@@ -11,18 +11,22 @@ mapGenerator:
Desc: a mapGenerator is a master datum that collects
and syncs all mapGeneratorModules in it's modules list
defineRegion(var/turf/Start, var/turf/End)
Example: defineRegion(locate(1,1,1),locate(5,5,5))
defineRegion(var/turf/Start, var/turf/End, var/replace = 0)
Example: defineRegion(locate(1,1,1),locate(5,5,5),0)
Desc: Sets the bounds of the mapGenerator's "map"
defineCircularRegion(var/turf/Start, var/turf/End)
Example: defineCircularRegion(locate(1,1,1),locate(5,5,5))
defineCircularRegion(var/turf/Start, var/turf/End, var/replace = 0)
Example: defineCircularRegion(locate(1,1,1),locate(5,5,5),0)
Desc: Sets the mapGenerator's "map" as a circle, with center in the middle of Start and End's X,Y,Z coordinates
undefineRegion()
Example: undefineRegion()
Desc: Empties the map generator list
checkRegion(var/turf/Start, var/turf/End)
Example: checkRegion(locate(1,1,1), locate(5,5,5))
Desc: Checks if a rectangle between Start's coords and End's coords is valid
Existing Calls: mapGenerator/defineRegion()
Existing Calls: mapGenerator/defineRegion(), mapGenerator/defineCircularRegion()
generate()
Example: generate()