diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm index f05bf6f3e1..1f5b82f7bf 100644 --- a/code/__HELPERS/areas.dm +++ b/code/__HELPERS/areas.dm @@ -86,6 +86,8 @@ newA.contents += thing thing.change_area(old_area, newA) + newA.reg_in_areas_in_z() + var/list/firedoors = oldA.firedoors for(var/door in firedoors) var/obj/machinery/door/firedoor/FD = door diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index a2c60618ac..9eb71c9059 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -495,4 +495,9 @@ GLOBAL_LIST_EMPTY(the_station_areas) clearing |= used_turfs //used turfs is an associative list, BUT, reserve_turfs() can still handle it. If the code above works properly, this won't even be needed as the turfs would be freed already. unused_turfs.Cut() used_turfs.Cut() - reserve_turfs(clearing) \ No newline at end of file + reserve_turfs(clearing) + +/datum/controller/subsystem/mapping/proc/reg_in_areas_in_z(list/areas) + for(var/B in areas) + var/area/A = B + A.reg_in_areas_in_z() diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index 10650153d6..099b1b2f9c 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -120,6 +120,14 @@ GLOBAL_LIST_EMPTY(teleportlocs) if(!IS_DYNAMIC_LIGHTING(src)) add_overlay(/obj/effect/fullbright) + reg_in_areas_in_z() + + return INITIALIZE_HINT_LATELOAD + +/area/LateInitialize() + power_change() // all machines set to current power level, also updates icon + +/area/proc/reg_in_areas_in_z() if(contents.len) var/list/areas_in_z = SSmapping.areas_in_z var/z @@ -137,11 +145,6 @@ GLOBAL_LIST_EMPTY(teleportlocs) areas_in_z["[z]"] = list() areas_in_z["[z]"] += src - return INITIALIZE_HINT_LATELOAD - -/area/LateInitialize() - power_change() // all machines set to current power level, also updates icon - /area/Destroy() if(GLOB.areas_by_type[type] == src) GLOB.areas_by_type[type] = null diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index ceba29baec..1f55f18823 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -29,6 +29,7 @@ var/list/obj/machinery/atmospherics/atmos_machines = list() var/list/obj/structure/cable/cables = list() var/list/atom/atoms = list() + var/list/area/areas = list() var/list/turfs = block( locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) @@ -37,6 +38,7 @@ for(var/L in turfs) var/turf/B = L atoms += B + areas |= B.loc for(var/A in B) atoms += A if(istype(A, /obj/structure/cable)) @@ -48,6 +50,7 @@ var/turf/T = L T.air_update_turf(TRUE) //calculate adjacent turfs along the border to prevent runtimes + SSmapping.reg_in_areas_in_z(areas) SSatoms.InitializeAtoms(atoms) SSmachines.setup_template_powernets(cables) SSair.setup_template_machinery(atmos_machines)