mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Fixed inexplicable reversions.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier)
|
||||
B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier)
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
18
code/ZAS/_docs.dm
Normal file
18
code/ZAS/_docs.dm
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user