diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm
index 6586cbaaecf..69047b56b61 100644
--- a/code/ZAS/Debug.dm
+++ b/code/ZAS/Debug.dm
@@ -1,3 +1,14 @@
+client/proc/ZoneTick()
+ set category = "Debug"
+ set name = "Process Atmos"
+
+ var/result = air_master.Tick()
+ if(result)
+ src << "Sucessfully Processed."
+
+ else
+ src << "Failed to process! ([air_master.tick_progress])"
+
client/proc/Zone_Info(turf/T as null|turf)
set category = "Debug"
diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm
index 0f246fa6ee3..0f5351ce1ba 100644
--- a/code/ZAS/FEA_system.dm
+++ b/code/ZAS/FEA_system.dm
@@ -53,7 +53,6 @@ Important Procedures
*/
-var/kill_air = 0
var/tick_multiplier = 2
atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
@@ -113,7 +112,7 @@ var/datum/controller/air_system/air_master
var/tick_progress = 0
-/datum/controller/air_system/proc/Tetup()
+/datum/controller/air_system/proc/Setup()
//Purpose: Call this at the start to setup air groups geometry
// (Warning: Very processor intensive but only must be done once per round)
//Called by: Gameticker/Master controller
@@ -155,20 +154,21 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
set background = 1
while(1)
- if(!kill_air)
- current_cycle++
+ if(!air_processing_killed)
var/success = Tick() //Changed so that a runtime does not crash the ticker.
if(!success) //Runtimed.
failed_ticks++
if(failed_ticks > 20)
world << "ERROR IN ATMOS TICKER. Killing air simulation!"
- kill_air = 1
+ air_processing_killed = 1
sleep(max(5,update_delay*tick_multiplier))
/datum/controller/air_system/proc/Tick()
. = 1 //Set the default return value, for runtime detection.
+ current_cycle++
+
//If there are tiles to update, do so.
tick_progress = "update_air_properties"
if(tiles_to_update.len)
@@ -184,28 +184,48 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
if(.)
if(tiles_to_update_alternate)
tiles_to_update = tiles_to_update_alternate
+ tiles_to_update_alternate = null
else
tiles_to_update = list()
else if(tiles_to_update_alternate)
tiles_to_update |= tiles_to_update_alternate
+ tiles_to_update_alternate = null
//Check sanity on connection objects.
if(.)
tick_progress = "connections_to_check"
if(connections_to_check.len)
+ checking_connections = TRUE
+
for(var/connection/C in connections_to_check)
C.CheckPassSanity()
- connections_to_check = list()
+
+ checking_connections = FALSE
+
+ if(connections_to_check_alternate)
+ connections_to_check = connections_to_check_alternate
+ connections_to_check_alternate = null
+ else
+ connections_to_check = list()
//Ensure tiles still have zones.
if(.)
tick_progress = "tiles_to_reconsider_zones"
if(tiles_to_reconsider_zones.len)
+ reconsidering_zones = TRUE
+
for(var/turf/simulated/T in tiles_to_reconsider_zones)
if(!T.zone)
new /zone(T)
- tiles_to_reconsider_zones = list()
+
+ reconsidering_zones = FALSE
+
+ if(tiles_to_reconsider_alternate)
+ tiles_to_reconsider_zones = tiles_to_reconsider_alternate
+ tiles_to_reconsider_alternate = null
+ else
+ tiles_to_reconsider_zones = list()
//Process zones.
if(.)
@@ -217,6 +237,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
Z.last_update = current_cycle
if(. && Z && !output)
. = 0
+
//Process fires.
if(.)
tick_progress = "active_hotspots (fire)"
@@ -246,4 +267,33 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
else
tiles_to_update_alternate |= tiles_to_check
else
- tiles_to_update |= tiles_to_check
\ No newline at end of file
+ tiles_to_update |= tiles_to_check
+
+
+/datum/controller/air_system/proc/AddConnectionToCheck(connection/connection)
+ if(checking_connections)
+ if(istype(connection, /list))
+ if(!connections_to_check_alternate)
+ connections_to_check_alternate = connection
+
+ else if(!connections_to_check_alternate)
+ connections_to_check_alternate = list()
+
+ connections_to_check_alternate |= connection
+
+ else
+ connections_to_check |= connection
+
+
+/datum/controller/air_system/proc/ReconsiderTileZone(var/turf/simulated/zoneless_turf)
+ if(zoneless_turf.zone)
+ return
+
+ if(reconsidering_zones)
+ if(!tiles_to_reconsider_alternate)
+ tiles_to_reconsider_alternate = list()
+
+ tiles_to_reconsider_alternate |= zoneless_turf
+
+ else
+ tiles_to_reconsider_zones |= zoneless_turf
diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm
index 9851eb2fa5e..136a77118fd 100644
--- a/code/ZAS/ZAS_Turfs.dm
+++ b/code/ZAS/ZAS_Turfs.dm
@@ -158,10 +158,9 @@
//Check pass sanity of the connections.
if("\ref[src]" in air_master.turfs_with_connections)
- for(var/connection/C in air_master.turfs_with_connections["\ref[src]"])
- air_master.connections_to_check |= C
+ air_master.AddConnectionToCheck(air_master.turfs_with_connections["\ref[src]"])
- if(zone && !zone.rebuild && CanPass(null, src, 0, 0))
+ if(zone && CanPass(null, src, 0, 0))
for(var/direction in cardinal)
var/turf/T = get_step(src,direction)
diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm
index a3667a0180d..b2d68934f76 100644
--- a/code/ZAS/ZAS_Zones.dm
+++ b/code/ZAS/ZAS_Zones.dm
@@ -54,12 +54,11 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
- air_master.tiles_to_reconsider_zones += T
+ air_master.ReconsiderTileZone(T)
for(var/zone/Z in connected_zones)
if(src in Z.connected_zones)
Z.connected_zones.Remove(src)
- for(var/connection/C in connections)
- air_master.connections_to_check += C
+ air_master.AddConnectionToCheck(connections)
zones.Remove(src)
air = null
. = ..()
@@ -73,7 +72,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
- air_master.tiles_to_reconsider_zones += T
+ air_master.ReconsiderTileZone(T)
//Removing zone connections and scheduling connection cleanup
for(var/zone/Z in connected_zones)
@@ -81,8 +80,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
Z.connected_zones.Remove(src)
connected_zones = null
- for(var/connection/C in connections)
- air_master.connections_to_check += C
+ air_master.AddConnectionToCheck(connections)
connections = null
return 1
diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm
index 1a543381da4..92170b01084 100644
--- a/code/controllers/master_controller.dm
+++ b/code/controllers/master_controller.dm
@@ -126,7 +126,6 @@ datum/controller/game_controller/proc/process()
timer = world.timeofday
last_thing_processed = air_master.type
- air_master.current_cycle++
if(!air_master.Tick()) //Runtimed.
air_master.failed_ticks++
if(air_master.failed_ticks > 5)
@@ -136,7 +135,8 @@ datum/controller/game_controller/proc/process()
log_admin("ZASALERT: unable run zone/process() -- [air_master.tick_progress]")
air_processing_killed = 1
air_master.failed_ticks = 0
- air_cost = (world.timeofday - timer) / 10
+
+ air_cost = (world.timeofday - timer) / 10
sleep(breather_ticks)
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 22d9c1a0b63..60799f618e3 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -318,7 +318,7 @@
/obj/structure/window/proc/update_nearby_tiles(need_rebuild)
if(!air_master)
return 0
- AddTurfToUpdate(
+ air_master.AddTurfToUpdate(get_turf(src))
return 1
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index dc15cc4c9d8..1a5675609c3 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -231,8 +231,8 @@
W.zone = src.zone
W.zone.AddTurf(W)
- for(var/turf/simulated/T in orange(src,1))
- air_master.tiles_to_update.Add(T)
+ if(air_master)
+ air_master.AddTurfToUpdate(src)
W.levelupdate()
return W
@@ -252,8 +252,7 @@
W.zone.AddTurf(W)
if(air_master)
- for(var/turf/simulated/T in orange(src,1))
- air_master.tiles_to_update.Add(T)
+ air_master.AddTurfToUpdate(src)
W.levelupdate()
return W
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 355fe221fc4..ef4eb53170f 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -580,11 +580,11 @@ var/list/admin_verbs_mod = list(
set category = "Debug"
set name = "Kill Air"
set desc = "Toggle Air Processing"
- if(kill_air)
- kill_air = 0
+ if(air_processing_killed)
+ air_processing_killed = 0
usr << "Enabled air processing."
else
- kill_air = 1
+ air_processing_killed = 1
usr << "Disabled air processing."
feedback_add_details("admin_verb","KA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
log_admin("[key_name(usr)] used 'kill air'.")
diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm
index af7f4f545e2..9872c5e5a09 100644
--- a/code/modules/admin/verbs/mapping.dm
+++ b/code/modules/admin/verbs/mapping.dm
@@ -161,6 +161,7 @@ var/intercom_range_display_status = 0
src.verbs += /client/proc/disable_movement
src.verbs += /client/proc/Zone_Info
src.verbs += /client/proc/Test_ZAS_Connection
+ src.verbs += /client/proc/ZoneTick
//src.verbs += /client/proc/cmd_admin_rejuvenate
feedback_add_details("admin_verb","mDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!