Added some documentation.

This commit is contained in:
Aryn
2014-02-19 18:24:37 -07:00
parent a2d992ef5c
commit 0814bdb36f
4 changed files with 38 additions and 35 deletions

View File

@@ -1,3 +1,8 @@
/*
Contains helper procs for airflow, handled in /connection_group.
*/
mob/var/tmp/last_airflow_stun = 0 mob/var/tmp/last_airflow_stun = 0
mob/proc/airflow_stun() mob/proc/airflow_stun()
if(stat == 2) if(stat == 2)

View File

@@ -1,4 +1,4 @@
//#define ZASDBG
/atom/var/pressure_resistance = ONE_ATMOSPHERE /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 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) atom/proc/c_airblock(turf/other)
#ifdef ZASDBG #ifdef ZASDBG
ASSERT(isturf(other)) ASSERT(isturf(other))
#endif #endif
return !CanPass(null, other, 0, 0) + 2*!CanPass(null, other, 1.5, 1) 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) turf/c_airblock(turf/other)
#ifdef ZASDBG #ifdef ZASDBG
ASSERT(isturf(other)) ASSERT(isturf(other))

View File

@@ -42,7 +42,7 @@ var/tick_multiplier = 2
for(var/turf/simulated/S in world) for(var/turf/simulated/S in world)
simulated_turf_count++ simulated_turf_count++
S.c_update_air_properties() S.update_air_properties()
world << {"<font color='red'><b>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b> world << {"<font color='red'><b>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b>
Total Simulated Turfs: [simulated_turf_count] 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 var/updated = 0
#endif #endif
for(var/turf/T in updating) 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 T.needs_air_update = 0
#ifdef ZASDBG #ifdef ZASDBG
T.overlays -= mark T.overlays -= mark
@@ -100,24 +101,23 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
. = 0 . = 0
#endif #endif
//Rebuild zones. //Where gas exchange happens.
if(.) if(.)
tick_progress = "rebuilding zones" tick_progress = "processing edges"
//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)
for(var/connection_edge/edge in edges) for(var/connection_edge/edge in edges)
edge.tick() edge.tick()
//Process fires.
if(.)
tick_progress = "processing fire"
for(var/obj/fire/fire in active_hotspots)
fire.process()
//Process zones. //Process zones.
if(.) if(.)
tick_progress = "processing zones" tick_progress = "updating zones"
active_zones = zones_to_update.len active_zones = zones_to_update.len
if(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.tick()
zone.needs_update = 0 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(.) if(.)
tick_progress = "success" tick_progress = "success"
@@ -221,7 +207,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
ASSERT(isturf(T)) ASSERT(isturf(T))
#endif #endif
if(T.needs_air_update) return if(T.needs_air_update) return
tiles_to_update.Add(T) tiles_to_update |= T
#ifdef ZASDBG #ifdef ZASDBG
T.overlays += mark T.overlays += mark
#endif #endif

View File

@@ -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, 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. 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: Important Functions:
air_master.mark_for_update(turf) 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 AIR_BLOCKED 1
#define ZONE_BLOCKED 2 #define ZONE_BLOCKED 2
#define BLOCKED 3 #define BLOCKED 3