fixes reconcile_air(); makes gas flow properly through pipes

This commit is contained in:
duncathan
2016-01-14 14:02:01 -06:00
parent 31d9757e98
commit e20eee52ad
5 changed files with 17 additions and 20 deletions
+9 -8
View File
@@ -195,8 +195,8 @@ var/pipenetwarnings = 10
var/list/datum/pipeline/PL = list()
PL += src
for(var/i=1;i<=PL.len;i++)
var/datum/pipeline/P = PL[i]
for(var/i in PL)
var/datum/pipeline/P = i
GL += P.air
GL += P.other_airs
for(var/obj/machinery/atmospherics/components/binary/valve/V in P.other_atmosmch)
@@ -209,18 +209,18 @@ var/pipenetwarnings = 10
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/datum/gas_mixture/total_gas_mixture = new
var/datum/gas_mixture/total_gas_mixture = new(0)
for(var/datum/gas_mixture/G in GL)
for(var/i in GL)
var/datum/gas_mixture/G = i
total_gas_mixture.volume += G.volume
total_gas_mixture.merge(G)
total_thermal_energy += G.thermal_energy()
total_heat_capacity += G.heat_capacity()
if(total_heat_capacity > 0)
total_gas_mixture.temperature = total_thermal_energy/total_heat_capacity
else
total_gas_mixture.temperature = 0
total_gas_mixture.temperature = total_heat_capacity ? total_thermal_energy/total_heat_capacity : 0
if(total_gas_mixture.volume > 0)
//Update individual gas_mixtures by volume ratio
@@ -229,3 +229,4 @@ var/pipenetwarnings = 10
var/list/G_gases = G.gases
for(var/id in G_gases)
G_gases[id][MOLES] *= G.volume/total_gas_mixture.volume
+2 -6
View File
@@ -219,15 +219,11 @@
/turf/simulated/proc/update_visuals()
var/list/new_overlay_types = tile_graphic()
for(var/overlay in atmos_overlay_types)
if(overlay in new_overlay_types)
continue //doesn't remove overlays that would only be added
for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added
overlays -= overlay
atmos_overlay_types -= overlay
for(var/overlay in new_overlay_types)
if(overlay in atmos_overlay_types)
continue //doesn't add overlays that already exist
for(var/overlay in new_overlay_types-atmos_overlay_types) //doesn't add overlays that already exist
overlays += overlay
atmos_overlay_types = new_overlay_types
+2 -2
View File
@@ -15,8 +15,8 @@
//this is kinda hacky... but it means I don't have to change every single time they're called.
#define SPECIFIC_HEAT GAS_META][1
#define GAS_NAME GAS_META][2
#define GAS_OVERLAY GAS_META][3
#define MOLES_VISIBLE GAS_META][4
#define GAS_OVERLAY GAS_META][4
#define MOLES_VISIBLE GAS_META][3
//stuff you should probably leave well alone!
//ATMOS
-1
View File
@@ -174,7 +174,6 @@ var/list/cached_gases_list = null
//Prevents whatever mechanism is causing it to hit negative temperatures.
//world << "post [temperature], [procgases["plasma"][MOLES]], [procgases["co2"][MOLES]]
*/
fuel_burnt = 0
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
//world << "pre [temperature], [procgases["o2"][MOLES]], [procgases["plasma"][MOLES]]"
+4 -3
View File
@@ -22,7 +22,7 @@
use_power = 0
var/release_log = ""
var/update_flag = 0
var/gas_type
var/gas_type = ""
/obj/machinery/portable_atmospherics/canister/sleeping_agent
@@ -379,8 +379,9 @@ update_flag
return 1
/obj/machinery/portable_atmospherics/canister/proc/create_gas()
air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
if(gas_type)
air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0