diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 76e25931bc9..7574ddee5fd 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -21,6 +21,11 @@ var/list/created_atoms = list() //make sure this list is accounted for/cleared if you request it from ssatoms! + // vars for automatic ceiling generation + var/has_ceiling = FALSE + var/turf/ceiling_turf = /turf/open/floor/plating + var/list/ceiling_baseturfs = list() + /datum/map_template/New(path = null, rename = null, cache = FALSE) if(path) mappath = path @@ -28,6 +33,7 @@ preload_size(mappath, cache) if(rename) name = rename + ceiling_baseturfs.Insert(1, /turf/baseturf_bottom) /datum/map_template/proc/preload_size(path, cache = FALSE) var/datum/parsed_map/parsed = new(file(path)) @@ -176,9 +182,20 @@ //initialize things that are normally initialized after map load initTemplateBounds(bounds) + if(has_ceiling) + var/affected_turfs = get_affected_turfs(T, FALSE) + generate_ceiling(affected_turfs) + log_game("[name] loaded at [T.x],[T.y],[T.z]") return bounds +/datum/map_template/proc/generate_ceiling(affected_turfs) + for (var/turf/turf in affected_turfs) + var/turf/ceiling = get_step_multiz(turf, UP) + if (ceiling) + if (istype(ceiling, /turf/open/openspace) || istype(ceiling, /turf/open/space/openspace)) + ceiling.ChangeTurf(ceiling_turf, ceiling_baseturfs, CHANGETURF_INHERIT_AIR) + /datum/map_template/proc/post_load() return diff --git a/code/modules/mining/shelters.dm b/code/modules/mining/shelters.dm index 992d769c63a..29d6a099490 100644 --- a/code/modules/mining/shelters.dm +++ b/code/modules/mining/shelters.dm @@ -5,6 +5,9 @@ var/list/whitelisted_turfs var/list/banned_areas var/list/banned_objects + has_ceiling = TRUE + ceiling_turf = /turf/open/floor/engine/hull + ceiling_baseturfs = list(/turf/open/floor/plating) /datum/map_template/shelter/New() . = ..()