diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm deleted file mode 100644 index a7528459d1b..00000000000 --- a/code/datums/helper_datums/map_template.dm +++ /dev/null @@ -1,146 +0,0 @@ -/datum/map_template - var/name = "Default Template Name" - var/width = 0 - var/height = 0 - var/mappath = null - var/mapfile = null - var/loaded = 0 // Times loaded this round - -/datum/map_template/New(path = null, map = null, rename = null) - if(path) - mappath = path - if(mappath) - preload_size(mappath) - if(map) - mapfile = map - 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) - 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] - return bounds - -/proc/initTemplateBounds(var/list/bounds) - var/list/obj/machinery/atmospherics/atmos_machines = list() - var/list/obj/structure/cable/cables = list() - var/list/atom/atoms = list() - - for(var/L in block(locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]))) - var/turf/B = L - atoms += B - for(var/A in B) - atoms += A - if(istype(A,/obj/structure/cable)) - cables += A - continue - if(istype(A,/obj/machinery/atmospherics)) - atmos_machines += A - continue - - SSatoms.InitializeAtoms(atoms) - SSmachine.setup_template_powernets(cables) - SSair.setup_template_machinery(atmos_machines) - SSair.end_map_load() - -/datum/map_template/proc/load(turf/T, centered = FALSE) - if(centered) - T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z) - if(!T) - return - if(T.x+width > world.maxx) - return - if(T.y+height > world.maxy) - return - - SSair.begin_map_load() - var/list/bounds = maploader.load_map(get_file(), T.x, T.y, T.z, cropMap=TRUE) - if(!bounds) - SSair.end_map_load() - return 0 - - //initialize things that are normally initialized after map load - initTemplateBounds(bounds) - - log_game("[name] loaded at at [T.x],[T.y],[T.z]") - return 1 - -/datum/map_template/proc/get_file() - if(mapfile) - . = mapfile - else if(mappath) - . = file(mappath) - - if(!.) - log_world("The file of [src] appears to be empty/non-existent.") - -/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE) - var/turf/placement = T - if(centered) - var/turf/corner = locate(placement.x - round(width/2), placement.y - round(height/2), placement.z) - if(corner) - placement = corner - return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z)) - - -/proc/preloadTemplates(path = "_maps/templates/") //see master controller setup - var/list/filelist = flist(path) - for(var/map in filelist) - var/datum/map_template/T = new(path = "[path][map]", rename = "[map]") - map_templates[T.name] = T - - preloadRuinTemplates() - preloadShuttleTemplates() - preloadShelterTemplates() - -/proc/preloadRuinTemplates() - // Still supporting bans by filename - var/list/banned = generateMapList("config/lavaruinblacklist.txt") - banned += generateMapList("config/spaceruinblacklist.txt") - - for(var/item in subtypesof(/datum/map_template/ruin)) - var/datum/map_template/ruin/ruin_type = item - // screen out the abstract subtypes - if(!initial(ruin_type.id)) - continue - var/datum/map_template/ruin/R = new ruin_type() - - if(banned.Find(R.mappath)) - continue - - map_templates[R.name] = R - ruins_templates[R.name] = R - - if(istype(R, /datum/map_template/ruin/lavaland)) - lava_ruins_templates[R.name] = R - else if(istype(R, /datum/map_template/ruin/space)) - space_ruins_templates[R.name] = R - - -/proc/preloadShuttleTemplates() - var/list/unbuyable = generateMapList("config/unbuyableshuttles.txt") - - for(var/item in subtypesof(/datum/map_template/shuttle)) - var/datum/map_template/shuttle/shuttle_type = item - if(!(initial(shuttle_type.suffix))) - continue - - var/datum/map_template/shuttle/S = new shuttle_type() - if(unbuyable.Find(S.mappath)) - S.can_be_bought = FALSE - - shuttle_templates[S.shuttle_id] = S - map_templates[S.shuttle_id] = S - -/proc/preloadShelterTemplates() - for(var/item in subtypesof(/datum/map_template/shelter)) - var/datum/map_template/shelter/shelter_type = item - if(!(initial(shelter_type.mappath))) - continue - var/datum/map_template/shelter/S = new shelter_type() - - shelter_templates[S.shelter_id] = S - map_templates[S.shelter_id] = S diff --git a/code/modules/awaymissions/zlevel.dm b/code/modules/awaymissions/zlevel.dm index 8d32846f6b2..8a31bda0821 100644 --- a/code/modules/awaymissions/zlevel.dm +++ b/code/modules/awaymissions/zlevel.dm @@ -8,8 +8,7 @@ var/global/list/potentialRandomZlevels = generateMapList(filename = "config/away if(potentialRandomZlevels && potentialRandomZlevels.len) world << "Loading away mission..." var/map = pick(potentialRandomZlevels) - var/file = file(map) - load_new_z_level(file) + load_new_z_level(map) world << "Away mission loaded." /proc/reset_gateway_spawns(reset = FALSE)