PoIs can be rotated in increments of 90 degrees

This commit is contained in:
atermonera
2018-08-30 18:55:22 -07:00
parent 0d0c43fde9
commit a20085ccff
3 changed files with 117 additions and 31 deletions
+12 -12
View File
@@ -37,8 +37,8 @@ var/list/global/map_templates = list()
if(rename)
name = rename
/datum/map_template/proc/preload_size(path)
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=FALSE, measureOnly=TRUE)
/datum/map_template/proc/preload_size(path, orientation = SOUTH)
var/bounds = maploader.load_map(file(path), 1, 1, 1, cropMap=FALSE, measureOnly=TRUE, orientation=orientation)
if(bounds)
width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
height = bounds[MAP_MAXY]
@@ -82,7 +82,7 @@ var/list/global/map_templates = list()
admin_notice("<span class='danger'>Submap initializations finished.</span>", R_DEBUG)
/datum/map_template/proc/load_new_z(var/centered = FALSE)
/datum/map_template/proc/load_new_z(var/centered = FALSE, var/orientation = SOUTH)
var/x = 1
var/y = 1
@@ -90,7 +90,7 @@ var/list/global/map_templates = list()
x = round((world.maxx - width)/2)
y = round((world.maxy - height)/2)
var/list/bounds = maploader.load_map(file(mappath), x, y, no_changeturf = TRUE)
var/list/bounds = maploader.load_map(file(mappath), x, y, no_changeturf = TRUE, orientation=orientation)
if(!bounds)
return FALSE
@@ -101,7 +101,7 @@ var/list/global/map_templates = list()
log_game("Z-level [name] loaded at at [x],[y],[world.maxz]")
return TRUE
/datum/map_template/proc/load(turf/T, centered = FALSE)
/datum/map_template/proc/load(turf/T, centered = FALSE, orientation = SOUTH)
var/old_T = T
if(centered)
T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z)
@@ -115,7 +115,7 @@ var/list/global/map_templates = list()
if(annihilate)
annihilate_bounds(old_T, centered)
var/list/bounds = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE)
var/list/bounds = maploader.load_map(file(mappath), T.x, T.y, T.z, cropMap=TRUE, orientation = orientation)
if(!bounds)
return
@@ -129,13 +129,13 @@ var/list/global/map_templates = list()
loaded++
return TRUE
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE)
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE, orientation = SOUTH)
var/turf/placement = T
if(centered)
var/turf/corner = locate(placement.x - round(width/2), placement.y - round(height/2), placement.z)
var/turf/corner = locate(placement.x - round(((orientation & NORTH|SOUTH) ? width : height)/2), placement.y - round(((orientation & NORTH|SOUTH) ? height : width)/2), placement.z)
if(corner)
placement = corner
return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z))
return block(placement, locate(placement.x+((orientation & NORTH|SOUTH) ? width : height)-1, placement.y+((orientation & NORTH|SOUTH) ? height : width)-1, placement.z))
/datum/map_template/proc/annihilate_bounds(turf/origin, centered = FALSE)
var/deleted_atoms = 0
@@ -151,9 +151,9 @@ var/list/global/map_templates = list()
//for your ever biggening badminnery kevinz000
//❤ - Cyberboss
/proc/load_new_z_level(var/file, var/name)
/proc/load_new_z_level(var/file, var/name, var/orientation = SOUTH)
var/datum/map_template/template = new(file, name)
template.load_new_z()
template.load_new_z(orientation)
// Very similar to the /tg/ version.
/proc/seed_submaps(var/list/z_levels, var/budget = 0, var/whitelist = /area/space, var/desired_map_template_type = null)
@@ -247,7 +247,7 @@ var/list/global/map_templates = list()
admin_notice("Submap \"[chosen_template.name]\" placed at ([T.x], [T.y], [T.z])", R_DEBUG)
// Do loading here.
chosen_template.load(T, centered = TRUE) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
chosen_template.load(T, centered = TRUE, pick(cardinal)) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
CHECK_TICK