diff --git a/baystation12.dme b/baystation12.dme index 712a0adaaf..430d3b1377 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1325,14 +1325,20 @@ #include "code\WorkInProgress\Ported\policetape.dm" #include "code\WorkInProgress\SkyMarshal\officer_stuff.dm" #include "code\WorkInProgress\SkyMarshal\Ultralight_procs.dm" +#include "code\ZAS\_docs.dm" +#include "code\ZAS\_gas_mixture.dm" #include "code\ZAS\Airflow.dm" +#include "code\ZAS\Atom.dm" #include "code\ZAS\Connection.dm" +#include "code\ZAS\ConnectionGroup.dm" +#include "code\ZAS\Controller.dm" #include "code\ZAS\Debug.dm" +#include "code\ZAS\Diagnostic.dm" #include "code\ZAS\Fire.dm" -#include "code\ZAS\Functions.dm" #include "code\ZAS\Plasma.dm" +#include "code\ZAS\Turf.dm" #include "code\ZAS\Variable Settings.dm" -#include "code\ZAS\ZAS_Zones.dm" +#include "code\ZAS\Zone.dm" #include "interface\interface.dm" #include "interface\skin.dmf" #include "maps\tgstation2.dmm" diff --git a/baystation12.int b/baystation12.int index 4be4a21dee..27f246accb 100644 --- a/baystation12.int +++ b/baystation12.int @@ -1,7 +1,9 @@ // BEGIN_INTERNALS /* MAP_ICON_TYPE: 0 -DIR: code +WINDOW: code\ZAS\_gas_mixture.dm;code\ZAS\Airflow.dm;code\ZAS\Atom.dm;code\ZAS\Connection.dm;code\ZAS\ConnectionGroup.dm;code\ZAS\Controller.dm;code\ZAS\Debug.dm;code\ZAS\Diagnostic.dm;code\ZAS\Fire.dm;code\ZAS\Plasma.dm;code\ZAS\Turf.dm;code\ZAS\Variable Settings.dm;code\ZAS\Zone.dm;code\ZAS\_docs.dm;code\modules\admin\verbs\mapping.dm;code\game\turfs\turf.dm;code\modules\admin\verbs\diagnostics.dm;code\game\machinery\shieldgen.dm;code\game\machinery\doors\door.dm;code\game\machinery\doors\windowdoor.dm;code\game\objects\effects\effect_system.dm;code\game\objects\structures\mineral_doors.dm;code\game\objects\structures\windoor_assembly.dm;code\game\objects\structures\window.dm +DIR: code code\game\machinery code\game\machinery\doors code\game\objects code\game\objects\effects code\game\objects\structures code\modules\admin\verbs code\ZAS +FILE: code\ZAS\Zone.dm AUTO_FILE_DIR: OFF */ // END_INTERNALS diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index 2615effaa2..64f6faba14 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -32,12 +32,6 @@ if(EAST) E = c if(WEST) W = c -/connection_managerproc/close(d) - if(check(N) && (NORTH & d) && !N.direct()) N.erase() - if(check(S) && (SOUTH & d) && !S.direct()) S.erase() - if(check(E) && (EAST & d) && !E.direct()) E.erase() - if(check(W) && (WEST & d) && !W.direct()) W.erase() - /connection_manager/proc/update_all() if(check(N)) N.update() if(check(S)) S.update() diff --git a/code/ZAS/ConnectionGroup.dm b/code/ZAS/ConnectionGroup.dm index 360372a83a..2a4c374f78 100644 --- a/code/ZAS/ConnectionGroup.dm +++ b/code/ZAS/ConnectionGroup.dm @@ -153,192 +153,192 @@ var/list/sharing_lookup_table = list(0.30, 0.40, 0.48, 0.54, 0.60, 0.66) proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) -//Shares a specific ratio of gas between mixtures using simple weighted averages. -var + //Shares a specific ratio of gas between mixtures using simple weighted averages. + var + //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD + ratio = sharing_lookup_table[6] + //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD + + size = max(1,A.group_multiplier) + share_size = max(1,B.group_multiplier) + + full_oxy = A.oxygen * size + full_nitro = A.nitrogen * size + full_co2 = A.carbon_dioxide * size + full_plasma = A.toxins * size + + full_heat_capacity = A.heat_capacity() * size + + s_full_oxy = B.oxygen * share_size + s_full_nitro = B.nitrogen * share_size + s_full_co2 = B.carbon_dioxide * share_size + s_full_plasma = B.toxins * share_size + + s_full_heat_capacity = B.heat_capacity() * share_size + + oxy_avg = (full_oxy + s_full_oxy) / (size + share_size) + nit_avg = (full_nitro + s_full_nitro) / (size + share_size) + co2_avg = (full_co2 + s_full_co2) / (size + share_size) + plasma_avg = (full_plasma + s_full_plasma) / (size + share_size) + + temp_avg = (A.temperature * full_heat_capacity + B.temperature * s_full_heat_capacity) / (full_heat_capacity + s_full_heat_capacity) + //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD - ratio = sharing_lookup_table[6] + if(sharing_lookup_table.len >= connecting_tiles) //6 or more interconnecting tiles will max at 42% of air moved per tick. + ratio = sharing_lookup_table[connecting_tiles] //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD - size = max(1,A.group_multiplier) - share_size = max(1,B.group_multiplier) + A.oxygen = max(0, (A.oxygen - oxy_avg) * (1-ratio) + oxy_avg ) + A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1-ratio) + nit_avg ) + A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg ) + A.toxins = max(0, (A.toxins - plasma_avg) * (1-ratio) + plasma_avg ) - full_oxy = A.oxygen * size - full_nitro = A.nitrogen * size - full_co2 = A.carbon_dioxide * size - full_plasma = A.toxins * size + A.temperature = max(0, (A.temperature - temp_avg) * (1-ratio) + temp_avg ) - full_heat_capacity = A.heat_capacity() * size + B.oxygen = max(0, (B.oxygen - oxy_avg) * (1-ratio) + oxy_avg ) + B.nitrogen = max(0, (B.nitrogen - nit_avg) * (1-ratio) + nit_avg ) + B.carbon_dioxide = max(0, (B.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg ) + B.toxins = max(0, (B.toxins - plasma_avg) * (1-ratio) + plasma_avg ) - s_full_oxy = B.oxygen * share_size - s_full_nitro = B.nitrogen * share_size - s_full_co2 = B.carbon_dioxide * share_size - s_full_plasma = B.toxins * share_size + B.temperature = max(0, (B.temperature - temp_avg) * (1-ratio) + temp_avg ) - s_full_heat_capacity = B.heat_capacity() * share_size + for(var/datum/gas/G in A.trace_gases) + var/datum/gas/H = locate(G.type) in B.trace_gases + if(H) + var/G_avg = (G.moles*size + H.moles*share_size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg - oxy_avg = (full_oxy + s_full_oxy) / (size + share_size) - nit_avg = (full_nitro + s_full_nitro) / (size + share_size) - co2_avg = (full_co2 + s_full_co2) / (size + share_size) - plasma_avg = (full_plasma + s_full_plasma) / (size + share_size) + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg + else + H = new G.type + B.trace_gases += H + var/G_avg = (G.moles*size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg - temp_avg = (A.temperature * full_heat_capacity + B.temperature * s_full_heat_capacity) / (full_heat_capacity + s_full_heat_capacity) + for(var/datum/gas/G in B.trace_gases) + var/datum/gas/H = locate(G.type) in A.trace_gases + if(!H) + H = new G.type + A.trace_gases += H + var/G_avg = (G.moles*size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg -//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD -if(sharing_lookup_table.len >= connecting_tiles) //6 or more interconnecting tiles will max at 42% of air moved per tick. - ratio = sharing_lookup_table[connecting_tiles] -//WOOT WOOT TOUCH THIS AND YOU ARE A RETARD + A.update_values() + B.update_values() -A.oxygen = max(0, (A.oxygen - oxy_avg) * (1-ratio) + oxy_avg ) -A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1-ratio) + nit_avg ) -A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg ) -A.toxins = max(0, (A.toxins - plasma_avg) * (1-ratio) + plasma_avg ) - -A.temperature = max(0, (A.temperature - temp_avg) * (1-ratio) + temp_avg ) - -B.oxygen = max(0, (B.oxygen - oxy_avg) * (1-ratio) + oxy_avg ) -B.nitrogen = max(0, (B.nitrogen - nit_avg) * (1-ratio) + nit_avg ) -B.carbon_dioxide = max(0, (B.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg ) -B.toxins = max(0, (B.toxins - plasma_avg) * (1-ratio) + plasma_avg ) - -B.temperature = max(0, (B.temperature - temp_avg) * (1-ratio) + temp_avg ) - -for(var/datum/gas/G in A.trace_gases) - var/datum/gas/H = locate(G.type) in B.trace_gases - if(H) - var/G_avg = (G.moles*size + H.moles*share_size) / (size+share_size) - G.moles = (G.moles - G_avg) * (1-ratio) + G_avg - - H.moles = (H.moles - G_avg) * (1-ratio) + G_avg - else - H = new G.type - B.trace_gases += H - var/G_avg = (G.moles*size) / (size+share_size) - G.moles = (G.moles - G_avg) * (1-ratio) + G_avg - H.moles = (H.moles - G_avg) * (1-ratio) + G_avg - -for(var/datum/gas/G in B.trace_gases) - var/datum/gas/H = locate(G.type) in A.trace_gases - if(!H) - H = new G.type - A.trace_gases += H - var/G_avg = (G.moles*size) / (size+share_size) - G.moles = (G.moles - G_avg) * (1-ratio) + G_avg - H.moles = (H.moles - G_avg) * (1-ratio) + G_avg - -A.update_values() -B.update_values() - -if(A.compare(B)) return 1 -else return 0 + if(A.compare(B)) return 1 + else return 0 proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) -//A modified version of ShareRatio for spacing gas at the same rate as if it were going into a large airless room. -if(!unsimulated_tiles) - return 0 - -var - unsim_oxygen = 0 - unsim_nitrogen = 0 - unsim_co2 = 0 - unsim_plasma = 0 - unsim_heat_capacity = 0 - unsim_temperature = 0 - - size = max(1,A.group_multiplier) - -var/tileslen -var/share_size - -if(istype(unsimulated_tiles, /datum/gas_mixture)) - var/datum/gas_mixture/avg_unsim = unsimulated_tiles - unsim_oxygen = avg_unsim.oxygen - unsim_co2 = avg_unsim.carbon_dioxide - unsim_nitrogen = avg_unsim.nitrogen - unsim_plasma = avg_unsim.toxins - unsim_temperature = avg_unsim.temperature - share_size = max(1, max(size + 3, 1) + avg_unsim.group_multiplier) - tileslen = avg_unsim.group_multiplier - -else if(istype(unsimulated_tiles, /list)) - if(!unsimulated_tiles.len) + //A modified version of ShareRatio for spacing gas at the same rate as if it were going into a large airless room. + if(!unsimulated_tiles) return 0 - // We use the same size for the potentially single space tile - // as we use for the entire room. Why is this? - // Short answer: We do not want larger rooms to depressurize more - // slowly than small rooms, preserving our good old "hollywood-style" - // oh-shit effect when large rooms get breached, but still having small - // rooms remain pressurized for long enough to make escape possible. - share_size = max(1, max(size + 3, 1) + unsimulated_tiles.len) - var/correction_ratio = share_size / unsimulated_tiles.len - for(var/turf/T in unsimulated_tiles) - unsim_oxygen += T.oxygen - unsim_co2 += T.carbon_dioxide - unsim_nitrogen += T.nitrogen - unsim_plasma += T.toxins - unsim_temperature += T.temperature/unsimulated_tiles.len + var + unsim_oxygen = 0 + unsim_nitrogen = 0 + unsim_co2 = 0 + unsim_plasma = 0 + unsim_heat_capacity = 0 + unsim_temperature = 0 - //These values require adjustment in order to properly represent a room of the specified size. - unsim_oxygen *= correction_ratio - unsim_co2 *= correction_ratio - unsim_nitrogen *= correction_ratio - unsim_plasma *= correction_ratio - tileslen = unsimulated_tiles.len + size = max(1,A.group_multiplier) -else //invalid input type - return 0 + var/tileslen + var/share_size -unsim_heat_capacity = HEAT_CAPACITY_CALCULATION(unsim_oxygen, unsim_co2, unsim_nitrogen, unsim_plasma) + if(istype(unsimulated_tiles, /datum/gas_mixture)) + var/datum/gas_mixture/avg_unsim = unsimulated_tiles + unsim_oxygen = avg_unsim.oxygen + unsim_co2 = avg_unsim.carbon_dioxide + unsim_nitrogen = avg_unsim.nitrogen + unsim_plasma = avg_unsim.toxins + unsim_temperature = avg_unsim.temperature + share_size = max(1, max(size + 3, 1) + avg_unsim.group_multiplier) + tileslen = avg_unsim.group_multiplier -var - ratio = sharing_lookup_table[6] + else if(istype(unsimulated_tiles, /list)) + if(!unsimulated_tiles.len) + return 0 + // We use the same size for the potentially single space tile + // as we use for the entire room. Why is this? + // Short answer: We do not want larger rooms to depressurize more + // slowly than small rooms, preserving our good old "hollywood-style" + // oh-shit effect when large rooms get breached, but still having small + // rooms remain pressurized for long enough to make escape possible. + share_size = max(1, max(size + 3, 1) + unsimulated_tiles.len) + var/correction_ratio = share_size / unsimulated_tiles.len - old_pressure = A.return_pressure() + for(var/turf/T in unsimulated_tiles) + unsim_oxygen += T.oxygen + unsim_co2 += T.carbon_dioxide + unsim_nitrogen += T.nitrogen + unsim_plasma += T.toxins + unsim_temperature += T.temperature/unsimulated_tiles.len - full_oxy = A.oxygen * size - full_nitro = A.nitrogen * size - full_co2 = A.carbon_dioxide * size - full_plasma = A.toxins * size + //These values require adjustment in order to properly represent a room of the specified size. + unsim_oxygen *= correction_ratio + unsim_co2 *= correction_ratio + unsim_nitrogen *= correction_ratio + unsim_plasma *= correction_ratio + tileslen = unsimulated_tiles.len - full_heat_capacity = A.heat_capacity() * size + else //invalid input type + return 0 - oxy_avg = (full_oxy + unsim_oxygen) / (size + share_size) - nit_avg = (full_nitro + unsim_nitrogen) / (size + share_size) - co2_avg = (full_co2 + unsim_co2) / (size + share_size) - plasma_avg = (full_plasma + unsim_plasma) / (size + share_size) + unsim_heat_capacity = HEAT_CAPACITY_CALCULATION(unsim_oxygen, unsim_co2, unsim_nitrogen, unsim_plasma) - temp_avg = 0 + var + ratio = sharing_lookup_table[6] -if((full_heat_capacity + unsim_heat_capacity) > 0) - temp_avg = (A.temperature * full_heat_capacity + unsim_temperature * unsim_heat_capacity) / (full_heat_capacity + unsim_heat_capacity) + old_pressure = A.return_pressure() -if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick. - ratio = sharing_lookup_table[tileslen] + full_oxy = A.oxygen * size + full_nitro = A.nitrogen * size + full_co2 = A.carbon_dioxide * size + full_plasma = A.toxins * size -A.oxygen = max(0, (A.oxygen - oxy_avg) * (1 - ratio) + oxy_avg ) -A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1 - ratio) + nit_avg ) -A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1 - ratio) + co2_avg ) -A.toxins = max(0, (A.toxins - plasma_avg) * (1 - ratio) + plasma_avg ) + full_heat_capacity = A.heat_capacity() * size -A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg ) + oxy_avg = (full_oxy + unsim_oxygen) / (size + share_size) + nit_avg = (full_nitro + unsim_nitrogen) / (size + share_size) + co2_avg = (full_co2 + unsim_co2) / (size + share_size) + plasma_avg = (full_plasma + unsim_plasma) / (size + share_size) -for(var/datum/gas/G in A.trace_gases) - var/G_avg = (G.moles * size) / (size + share_size) - G.moles = (G.moles - G_avg) * (1 - ratio) + G_avg + temp_avg = 0 -A.update_values() + if((full_heat_capacity + unsim_heat_capacity) > 0) + temp_avg = (A.temperature * full_heat_capacity + unsim_temperature * unsim_heat_capacity) / (full_heat_capacity + unsim_heat_capacity) -return abs(old_pressure - A.return_pressure()) + if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick. + ratio = sharing_lookup_table[tileslen] + + A.oxygen = max(0, (A.oxygen - oxy_avg) * (1 - ratio) + oxy_avg ) + A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1 - ratio) + nit_avg ) + A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1 - ratio) + co2_avg ) + A.toxins = max(0, (A.toxins - plasma_avg) * (1 - ratio) + plasma_avg ) + + A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg ) + + for(var/datum/gas/G in A.trace_gases) + var/G_avg = (G.moles * size) / (size + share_size) + G.moles = (G.moles - G_avg) * (1 - ratio) + G_avg + + A.update_values() + + return abs(old_pressure - A.return_pressure()) proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) -//This implements a simplistic version of the Stefan-Boltzmann law. -var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5 -var/maximum_energy_delta = max(0, min(A.temperature * A.heat_capacity() * A.group_multiplier, B.temperature * B.heat_capacity() * B.group_multiplier)) -if(maximum_energy_delta > abs(energy_delta)) - if(energy_delta < 0) - maximum_energy_delta *= -1 - energy_delta = maximum_energy_delta + //This implements a simplistic version of the Stefan-Boltzmann law. + var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5 + var/maximum_energy_delta = max(0, min(A.temperature * A.heat_capacity() * A.group_multiplier, B.temperature * B.heat_capacity() * B.group_multiplier)) + if(maximum_energy_delta > abs(energy_delta)) + if(energy_delta < 0) + maximum_energy_delta *= -1 + energy_delta = maximum_energy_delta -A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier) -B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier) \ No newline at end of file + A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier) + B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier) \ No newline at end of file diff --git a/code/ZAS/Controller.dm b/code/ZAS/Controller.dm index a4ff7d6aaf..b02e256033 100644 --- a/code/ZAS/Controller.dm +++ b/code/ZAS/Controller.dm @@ -2,29 +2,25 @@ var/datum/controller/air_system/air_master var/tick_multiplier = 2 -var/tolerance_temp = 1 -var/tolerance_kpa = 1 -var/mimic_rate = 2 -/datum/controller/air_system - //Geometry lists - var/list/zones = list() - var/list/edges = list() +//Geometry lists +/datum/controller/air_system/var/list/zones = list() +/datum/controller/air_system/var/list/edges = list() - //Geometry updates lists - var/list/tiles_to_update = list() - var/list/zones_to_update = list() - var/list/active_hotspots = list() +//Geometry updates lists +/datum/controller/air_system/var/list/tiles_to_update = list() +/datum/controller/air_system/var/list/zones_to_update = list() +/datum/controller/air_system/var/list/active_hotspots = list() - var/active_zones = 0 +/datum/controller/air_system/var/active_zones = 0 - var/current_cycle = 0 - var/update_delay = 5 //How long between check should it try to process atmos again. - var/failed_ticks = 0 //How many ticks have runtimed? +/datum/controller/air_system/var/current_cycle = 0 +/datum/controller/air_system/var/update_delay = 5 //How long between check should it try to process atmos again. +/datum/controller/air_system/var/failed_ticks = 0 //How many ticks have runtimed? - var/tick_progress = 0 +/datum/controller/air_system/var/tick_progress = 0 - var/next_id = 1 +/datum/controller/air_system/var/next_id = 1 //Used to keep track of zone UIDs. /datum/controller/air_system/proc/Setup() //Purpose: Call this at the start to setup air groups geometry @@ -148,12 +144,12 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun if(.) tick_progress = "success" -/datum/controller/air_system/proc/new_zone(zone/z) +/datum/controller/air_system/proc/add_zone(zone/z) zones.Add(z) z.name = "Zone [next_id++]" mark_zone_update(z) -/datum/controller/air_system/proc/invalid_zone(zone/z) +/datum/controller/air_system/proc/remove_zone(zone/z) zones.Remove(z) /datum/controller/air_system/proc/air_blocked(turf/A, turf/B) @@ -169,7 +165,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun #ifdef ZASDBG ASSERT(istype(T)) #endif - return T.zone && !T.zone.invalid + return istype(T) && T.zone && !T.zone.invalid /datum/controller/air_system/proc/merge(zone/A, zone/B) #ifdef ZASDBG @@ -240,14 +236,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun Z.needs_update = 1 /datum/controller/air_system/proc/equivalent_pressure(zone/A, zone/B) - if(abs(A.air.return_pressure() - B.air.return_pressure()) > tolerance_kpa) return 0 - if(abs(A.air.temperature - B.air.temperature) > tolerance_temp) return 0 - return 1 - -/datum/controller/air_system/proc/equalize(zone/A, zone/B) - A.air.share(B.air) - mark_zone_update(A) - mark_zone_update(B) + return A.air.compare(B.air) /datum/controller/air_system/proc/active_zones() return active_zones diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index 605dfce30a..9567a31704 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -2,7 +2,6 @@ /zone/var/name /zone/var/invalid = 0 /zone/var/list/contents = list() -/zone/var/list/unsimulated_contents = list() /zone/var/needs_update = 0 @@ -11,7 +10,7 @@ /zone/var/datum/gas_mixture/air = new /zone/New() - air_master.new_zone(src) + air_master.add_zone(src) air.temperature = TCMB air.group_multiplier = 1 air.volume = CELL_VOLUME @@ -29,15 +28,6 @@ contents.Add(T) T.set_graphic(air.graphic) - -/zone/proc/add_unsimulated(turf/T) -#ifdef ZASDBG - ASSERT(!invalid) - ASSERT(istype(T)) - ASSERT(!istype(T,/turf/simulated)) -#endif - unsimulated_contents |= T - /zone/proc/remove(turf/simulated/T) #ifdef ZASDBG ASSERT(!invalid) @@ -64,11 +54,10 @@ #ifdef ZASDBG T.dbg(merged) #endif - into.unsimulated_contents |= unsimulated_contents /zone/proc/c_invalidate() invalid = 1 - air_master.invalid_zone(src) + air_master.remove_zone(src) #ifdef ZASDBG for(var/turf/simulated/T in contents) T.dbg(invalid_zone) diff --git a/code/ZAS/_docs.dm b/code/ZAS/_docs.dm new file mode 100644 index 0000000000..1df7759fcc --- /dev/null +++ b/code/ZAS/_docs.dm @@ -0,0 +1,18 @@ +/* + +Zone Air System: + +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. + +Important Functions: + +air_master.mark_for_update(turf) + When stuff happens, call this. It works on everything. + +*/ + +#define AIR_BLOCKED 1 +#define ZONE_BLOCKED 2 +#define BLOCKED 3 \ No newline at end of file diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index d3f276abe0..950871d983 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -268,7 +268,7 @@ for(var/turf/simulated/turf in locs) update_heat_protection(turf) - air_master.AddTurfToUpdate(turf) + air_master.mark_for_update(turf) return 1 diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index c8d0d4d110..152d6de60c 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -18,7 +18,7 @@ if(!air_master) return 0 - air_master.AddTurfToUpdate(get_turf(src)) + air_master.mark_for_update(get_turf(src)) return 1 diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 03d97e0e1f..972066d1fb 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -30,7 +30,7 @@ if(!air_master) return 0 - air_master.AddTurfToUpdate(get_turf(src)) + air_master.mark_for_update(get_turf(src)) return 1 diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm index 499bb2c22a..159a4266dd 100644 --- a/code/game/objects/effects/effect_system.dm +++ b/code/game/objects/effects/effect_system.dm @@ -833,7 +833,7 @@ steam.start() -- spawns the effect if(!air_master) return 0 - air_master.AddTurfToUpdate(get_turf(src)) + air_master.mark_for_update(get_turf(src)) return 1 diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 64e9623fca..3cdc4765e6 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -158,7 +158,7 @@ proc/update_nearby_tiles(need_rebuild) //Copypasta from airlock code if(!air_master) return 0 - air_master.AddTurfToUpdate(get_turf(src)) + air_master.mark_for_update(get_turf(src)) return 1 /obj/structure/mineral_door/iron diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index f13f3f1dec..e9ae0567bc 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -297,6 +297,6 @@ obj/structure/windoor_assembly/Del() if(!air_master) return 0 - air_master.AddTurfToUpdate(loc) + air_master.mark_for_update(loc) return 1 diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 482fdea6c0..7050808fb4 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -313,7 +313,7 @@ /obj/structure/window/proc/update_nearby_tiles(need_rebuild) if(!air_master) return 0 - air_master.AddTurfToUpdate(get_turf(src)) + air_master.mark_for_update(get_turf(src)) return 1 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 14b05c7298..ff47a1fa72 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -206,7 +206,7 @@ for(var/obj/effect/landmark/zcontroller/c in controller) if(c.down) var/turf/below = locate(src.x, src.y, c.down_target) - if((below.zone || zone) && !istype(below, /turf/space)) // dont make open space into space, its pointless and makes people drop out of the station + if((air_master.has_valid_zone(below) || air_master.has_valid_zone(src)) && !istype(below, /turf/space)) // dont make open space into space, its pointless and makes people drop out of the station var/turf/W = src.ChangeTurf(/turf/simulated/floor/open) var/list/temp = list() temp += W @@ -219,10 +219,10 @@ if(ispath(N, /turf/simulated/floor)) //if the old turf had a zone, connect the new turf to it as well - Cael //Adjusted by SkyMarshal 5/10/13 - The air master will handle the addition of the new turf. - if(zone) - zone.RemoveTurf(src) - if(!zone.CheckStatus()) - zone.SetStatus(ZONE_ACTIVE) + //if(zone) + // zone.RemoveTurf(src) + // if(!zone.CheckStatus()) + // zone.SetStatus(ZONE_ACTIVE) var/turf/simulated/W = new N( locate(src.x, src.y, src.z) ) //W.Assimilate_Air() @@ -236,16 +236,16 @@ W.RemoveLattice() if(air_master) - air_master.AddTurfToUpdate(src) + air_master.mark_for_update(src) W.levelupdate() return W else - if(zone) - zone.RemoveTurf(src) - if(!zone.CheckStatus()) - zone.SetStatus(ZONE_ACTIVE) + //if(zone) + // zone.RemoveTurf(src) + // if(!zone.CheckStatus()) + // zone.SetStatus(ZONE_ACTIVE) var/turf/W = new N( locate(src.x, src.y, src.z) ) W.lighting_lumcount += old_lumcount @@ -254,7 +254,7 @@ lighting_controller.changed_turfs += W if(air_master) - air_master.AddTurfToUpdate(src) + air_master.mark_for_update(src) W.levelupdate() return W diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index 29840d0e61..bbf74c9dbb 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -6,7 +6,7 @@ alert(usr,"Master_controller or air_master not found.","Air Report") return - var/active_groups = air_master.active_zones.len + var/active_groups = air_master.active_zones var/inactive_groups = air_master.zones.len - active_groups var/hotspots = 0 @@ -18,7 +18,7 @@ for(var/zone/zone in air_master.zones) var/turf/simulated/turf = locate() in zone.contents if(turf && turf.z == 1) - if(zone.status) + if(zone.needs_update) active_on_main_station++ else inactive_on_main_station++ diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 76f1b42046..7b952382a5 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -162,7 +162,7 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/Zone_Info src.verbs += /client/proc/Test_ZAS_Connection src.verbs += /client/proc/ZoneTick - src.verbs += /client/proc/TestZASRebuild + //src.verbs += /client/proc/TestZASRebuild //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!