From 4badcbbe244c13afa3327e8cc5767ea8caab96fe Mon Sep 17 00:00:00 2001 From: Dennok Date: Wed, 23 Sep 2020 08:49:02 +0300 Subject: [PATCH] map_template load fix (#53846) --- code/modules/mapping/map_template.dm | 38 ++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 7662461628a..4566507c29a 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -31,13 +31,20 @@ 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])) - var/list/border = block(locate(max(bounds[MAP_MINX]-1, 1), max(bounds[MAP_MINY]-1, 1), bounds[MAP_MINZ]), - locate(min(bounds[MAP_MAXX]+1, world.maxx), min(bounds[MAP_MAXY]+1, world.maxy), bounds[MAP_MAXZ])) - turfs + var/list/turfs = block( + locate( + bounds[MAP_MINX], + bounds[MAP_MINY], + bounds[MAP_MINZ] + ), + locate( + bounds[MAP_MAXX], + bounds[MAP_MAXY], + bounds[MAP_MAXZ] + ) + ) for(var/L in turfs) var/turf/B = L - atoms += B areas |= B.loc for(var/A in B) atoms += A @@ -46,15 +53,30 @@ continue if(istype(A, /obj/machinery/atmospherics)) atmos_machines += A - for(var/L in border) - 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(turfs) SSatoms.InitializeAtoms(atoms) SSmachines.setup_template_powernets(cables) SSair.setup_template_machinery(atmos_machines) + //calculate all turfs inside the border + var/list/template_and_bordering_turfs = block( + locate( + max(bounds[MAP_MINX]-1, 1), + max(bounds[MAP_MINY]-1, 1), + bounds[MAP_MINZ] + ), + locate( + min(bounds[MAP_MAXX]+1, world.maxx), + min(bounds[MAP_MAXY]+1, world.maxy), + bounds[MAP_MAXZ] + ) + ) + for(var/t in template_and_bordering_turfs) + var/turf/affected_turf = t + affected_turf.air_update_turf(TRUE) + /datum/map_template/proc/load_new_z() var/x = round((world.maxx - width)/2) var/y = round((world.maxy - height)/2)