Fixes the sanity check used by atmos to only be run on init (#17876)

* Fixes the sanity check used by atmos to only be run on init

- A few years ago, an optimization was added to cut the list of active
  turfs when setup_allturfs was added, which assumed the proc would only
  be run once, during atmos initialization. However, at this point in time
  this optimization is obsolete, and it's since been changed to a sanity check.
  Since this entire aspect of the code expects only to be run once,
  during atmos setup, we can safely move it to atmos init instead, which
  allows us to use the setup_allturfs function to also load maps without
  issue, useful for quick loads like mining capsules or other such
  things.

* Affected's tweak

* Fixes my tunnel vision

* Trivial casing tweak
This commit is contained in:
Marlyn
2022-05-27 10:30:28 -06:00
committed by GitHub
parent 18554b52c3
commit 991d0124f5

View File

@@ -76,6 +76,8 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/Initialize(timeofday)
setup_overlays() // Assign icons and such for gas-turf-overlays
icon_manager = new() // Sets up icon manager for pipes
if(length(active_turfs))
log_debug("Failed sanity check: active_turfs is not empty before initialization ([length(active_turfs)])")
setup_allturfs()
setup_atmos_machinery(GLOB.machines)
setup_pipenets(GLOB.machines)
@@ -298,9 +300,6 @@ SUBSYSTEM_DEF(air)
add_to_active(S)
/datum/controller/subsystem/air/proc/setup_allturfs(list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz)))
if(active_turfs.len)
log_debug("failed sanity check: active_turfs is not empty before initialization ([active_turfs.len])")
for(var/thing in turfs_to_init)
var/turf/T = thing
if(T.blocks_air)