diff --git a/code/ZAS/Airflow.dm b/code/ZAS/Airflow.dm index 390373c5f8..896cda8440 100644 --- a/code/ZAS/Airflow.dm +++ b/code/ZAS/Airflow.dm @@ -1,3 +1,8 @@ +/* +Contains helper procs for airflow, handled in /connection_group. +*/ + + mob/var/tmp/last_airflow_stun = 0 mob/proc/airflow_stun() if(stat == 2) diff --git a/code/ZAS/Atom.dm b/code/ZAS/Atom.dm index 2630b99bef..38e57d6165 100644 --- a/code/ZAS/Atom.dm +++ b/code/ZAS/Atom.dm @@ -1,4 +1,4 @@ -//#define ZASDBG + /atom/var/pressure_resistance = ONE_ATMOSPHERE @@ -30,17 +30,19 @@ atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) return 1 +//Basically another way of calling CanPass(null, other, 0, 0) and CanPass(null, other, 1.5, 1). +//Returns: +// 0 - Not blocked +// AIR_BLOCKED - Blocked +// ZONE_BLOCKED - Not blocked, but zone boundaries will not cross. +// BLOCKED - Blocked, zone boundaries will not cross even if opened. atom/proc/c_airblock(turf/other) #ifdef ZASDBG ASSERT(isturf(other)) #endif return !CanPass(null, other, 0, 0) + 2*!CanPass(null, other, 1.5, 1) -//Returns: -// 0 - Not blocked -// AIR_BLOCKED - Blocked -// ZONE_BLOCKED - Not blocked, but zone boundaries will not cross. -// BLOCKED - Blocked, zone boundaries will not cross even if opened. + turf/c_airblock(turf/other) #ifdef ZASDBG ASSERT(isturf(other)) diff --git a/code/ZAS/Controller.dm b/code/ZAS/Controller.dm index b02e256033..32899b1556 100644 --- a/code/ZAS/Controller.dm +++ b/code/ZAS/Controller.dm @@ -42,7 +42,7 @@ var/tick_multiplier = 2 for(var/turf/simulated/S in world) simulated_turf_count++ - S.c_update_air_properties() + S.update_air_properties() world << {"Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds. Total Simulated Turfs: [simulated_turf_count] @@ -85,7 +85,8 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun var/updated = 0 #endif for(var/turf/T in updating) - T.c_update_air_properties() + T.update_air_properties() + T.post_update_air_properties() T.needs_air_update = 0 #ifdef ZASDBG T.overlays -= mark @@ -100,24 +101,23 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun . = 0 #endif - //Rebuild zones. + //Where gas exchange happens. if(.) - tick_progress = "rebuilding zones" - - //Check sanity on connection objects. - if(.) - tick_progress = "checking/creating connections" - - //for(var/connection/c in connections) - //if(c.valid()) c.tick() - //else connections.Remove(c) + tick_progress = "processing edges" for(var/connection_edge/edge in edges) edge.tick() + //Process fires. + if(.) + tick_progress = "processing fire" + + for(var/obj/fire/fire in active_hotspots) + fire.process() + //Process zones. if(.) - tick_progress = "processing zones" + tick_progress = "updating zones" active_zones = zones_to_update.len if(zones_to_update.len) @@ -127,20 +127,6 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun zone.tick() zone.needs_update = 0 - /*for(var/zone/zone in zones) - zone.tick()*/ - - //Ensure tiles still have zones. - if(.) - tick_progress = "reconsidering zones on turfs" - - //Process fires. - if(.) - tick_progress = "processing fire" - - for(var/obj/fire/fire in active_hotspots) - fire.process() - if(.) tick_progress = "success" @@ -221,7 +207,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun ASSERT(isturf(T)) #endif if(T.needs_air_update) return - tiles_to_update.Add(T) + tiles_to_update |= T #ifdef ZASDBG T.overlays += mark #endif diff --git a/code/ZAS/_docs.dm b/code/ZAS/_docs.dm index 1df7759fcc..53b3792985 100644 --- a/code/ZAS/_docs.dm +++ b/code/ZAS/_docs.dm @@ -6,13 +6,23 @@ This air system divides the station into impermeable areas called zones. When something happens, i.e. a door opening or a wall being taken down, zones equalize and eventually merge. Making an airtight area closes the connection again. +Control Flow: +Every air tick: + Marked turfs are updated with update_air_properties(), followed by post_update_air_properties(). + Edges, including those generated by connections in the previous step, are processed. This is where gas is exchanged. + Fire is processed. + Marked zones have their air archived. + Important Functions: air_master.mark_for_update(turf) - When stuff happens, call this. It works on everything. + When stuff happens, call this. It works on everything. You basically don't need to worry about any other + functions besides CanPass(). */ +#define ZASDBG + #define AIR_BLOCKED 1 #define ZONE_BLOCKED 2 #define BLOCKED 3 \ No newline at end of file