Merge pull request #3094 from Leshana/zas-settle-at-zero

Fix rooms holding pressure when exposed to space.
This commit is contained in:
Anewbe
2017-03-16 18:25:28 -05:00
committed by GitHub
2 changed files with 20 additions and 3 deletions
+14 -1
View File
@@ -96,10 +96,16 @@
update_values()
// Used to equalize the mixture between two zones before sleeping an edge.
/datum/gas_mixture/proc/equalize(datum/gas_mixture/sharer)
var/our_heatcap = heat_capacity()
var/share_heatcap = sharer.heat_capacity()
// Special exception: there isn't enough air around to be worth processing this edge next tick, zap both to zero.
if(total_moles + sharer.total_moles <= MINIMUM_AIR_TO_SUSPEND)
gas.Cut()
sharer.gas.Cut()
for(var/g in gas|sharer.gas)
var/comb = gas[g] + sharer.gas[g]
comb /= volume + sharer.volume
@@ -282,9 +288,16 @@
//Checks if we are within acceptable range of another gas_mixture to suspend processing or merge.
/datum/gas_mixture/proc/compare(const/datum/gas_mixture/sample)
/datum/gas_mixture/proc/compare(const/datum/gas_mixture/sample, var/vacuum_exception = 0)
if(!sample) return 0
if(vacuum_exception)
// Special case - If one of the two is zero pressure, the other must also be zero.
// This prevents suspending processing when an air-filled room is next to a vacuum,
// an edge case which is particually obviously wrong to players
if(total_moles == 0 && sample.total_moles != 0 || sample.total_moles == 0 && total_moles != 0)
return 0
var/list/marked = list()
for(var/g in gas)
if((abs(gas[g] - sample.gas[g]) > MINIMUM_AIR_TO_SUSPEND) && \