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
+6 -2
View File
@@ -180,7 +180,8 @@ Class Procs:
air_master.mark_zone_update(B)
/connection_edge/zone/recheck()
if(!A.air.compare(B.air))
// Edges with only one side being vacuum need processing no matter how close.
if(!A.air.compare(B.air, vacuum_exception = 1))
air_master.mark_edge_active(src)
//Helper proc to get connections for a zone.
@@ -235,7 +236,10 @@ Class Procs:
air_master.mark_zone_update(A)
/connection_edge/unsimulated/recheck()
if(!A.air.compare(air))
// Edges with only one side being vacuum need processing no matter how close.
// Note: This handles the glaring flaw of a room holding pressure while exposed to space, but
// does not specially handle the less common case of a simulated room exposed to an unsimulated pressurized turf.
if(!A.air.compare(air, vacuum_exception = 1))
air_master.mark_edge_active(src)
proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles)
+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) && \