areas_in_z after start population fix (#41452)

Fixes areas_in_z after start population. Now it get areas spawned by templates and blueprints.
This commit is contained in:
Dennok
2018-11-14 01:15:14 +02:00
committed by yogstation13-bot
parent 6bb85c340e
commit fc7f6bbfcf
4 changed files with 20 additions and 5 deletions

View File

@@ -86,6 +86,8 @@
newA.contents += thing newA.contents += thing
thing.change_area(old_area, newA) thing.change_area(old_area, newA)
newA.reg_in_areas_in_z()
var/list/firedoors = oldA.firedoors var/list/firedoors = oldA.firedoors
for(var/door in firedoors) for(var/door in firedoors)
var/obj/machinery/door/firedoor/FD = door var/obj/machinery/door/firedoor/FD = door

View File

@@ -504,3 +504,10 @@ GLOBAL_LIST_EMPTY(the_station_areas)
unused_turfs.Cut() unused_turfs.Cut()
used_turfs.Cut() used_turfs.Cut()
reserve_turfs(clearing) 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()

View File

@@ -119,6 +119,14 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!IS_DYNAMIC_LIGHTING(src)) if(!IS_DYNAMIC_LIGHTING(src))
add_overlay(/obj/effect/fullbright) 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) if(contents.len)
var/list/areas_in_z = SSmapping.areas_in_z var/list/areas_in_z = SSmapping.areas_in_z
var/z var/z
@@ -136,11 +144,6 @@ GLOBAL_LIST_EMPTY(teleportlocs)
areas_in_z["[z]"] = list() areas_in_z["[z]"] = list()
areas_in_z["[z]"] += src 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() /area/Destroy()
if(GLOB.areas_by_type[type] == src) if(GLOB.areas_by_type[type] == src)
GLOB.areas_by_type[type] = null GLOB.areas_by_type[type] = null

View File

@@ -29,6 +29,7 @@
var/list/obj/machinery/atmospherics/atmos_machines = list() var/list/obj/machinery/atmospherics/atmos_machines = list()
var/list/obj/structure/cable/cables = list() var/list/obj/structure/cable/cables = list()
var/list/atom/atoms = 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]), var/list/turfs = block( locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]),
locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]))
@@ -37,6 +38,7 @@
for(var/L in turfs) for(var/L in turfs)
var/turf/B = L var/turf/B = L
atoms += B atoms += B
areas |= B.loc
for(var/A in B) for(var/A in B)
atoms += A atoms += A
if(istype(A, /obj/structure/cable)) if(istype(A, /obj/structure/cable))
@@ -48,6 +50,7 @@
var/turf/T = L var/turf/T = L
T.air_update_turf(TRUE) //calculate adjacent turfs along the border to prevent runtimes T.air_update_turf(TRUE) //calculate adjacent turfs along the border to prevent runtimes
SSmapping.reg_in_areas_in_z(areas)
SSatoms.InitializeAtoms(atoms) SSatoms.InitializeAtoms(atoms)
SSmachines.setup_template_powernets(cables) SSmachines.setup_template_powernets(cables)
SSair.setup_template_machinery(atmos_machines) SSair.setup_template_machinery(atmos_machines)