mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-25 04:56:29 +01:00
Merge pull request #3771 from Mloc/newzasfix
Small work on making zones wake up on geometry changes.
This commit is contained in:
@@ -1007,6 +1007,18 @@ What are the archived variables for?
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/gas_mixture/proc/compare_unsim(turf/list/samples)
|
||||
//Purpose: Compares a list of unsimulated tiles to self to see if within acceptable ranges that group processing may be enabled
|
||||
//Called by: ZAS sleeping detection.
|
||||
//Inputs: List of unsimulated turfs to compare to
|
||||
//Outputs: 1 if within an acceptable range to sleep, 0 otherwise.
|
||||
var/datum/gas_mixture/after_share = new
|
||||
after_share.copy_from(src)
|
||||
|
||||
ShareSpace(after_share, samples)
|
||||
|
||||
return src.compare(after_share)
|
||||
|
||||
/datum/gas_mixture/proc/subtract(datum/gas_mixture/right_side)
|
||||
//Purpose: Subtracts right_side from air_mixture. Used to help turfs mingle
|
||||
//Called by: Pipelines ending in a break (or something)
|
||||
|
||||
@@ -179,6 +179,8 @@
|
||||
if((air_check_directions & direction && !(air_directions_archived & direction)) || \
|
||||
(unsim_check_directions & direction && !(unsim_directions_archived & direction)))
|
||||
ZConnect(src,T)
|
||||
zone.ActivateIfNeeded()
|
||||
if(T.zone) T.zone.ActivateIfNeeded()
|
||||
|
||||
//Something like a wall was built, changing the geometry.
|
||||
else if((!(air_check_directions & direction) && air_directions_archived & direction) || \
|
||||
|
||||
+29
-1
@@ -21,6 +21,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
var/last_rebuilt = 0
|
||||
var/status = ZONE_ACTIVE
|
||||
var/interactions_with_neighbors = 0
|
||||
var/interactions_with_unsim = 0
|
||||
var/progress = "nothing"
|
||||
|
||||
|
||||
@@ -185,10 +186,14 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
unsimulated_tiles -= T
|
||||
|
||||
if(unsimulated_tiles.len)
|
||||
var/old_pressure = air.return_pressure()
|
||||
var/moved_air = ShareSpace(air,unsimulated_tiles)
|
||||
|
||||
if(moved_air > vsc.airflow_lightest_pressure)
|
||||
AirflowSpace(src)
|
||||
|
||||
if(old_pressure && (moved_air / old_pressure) > MINIMUM_AIR_RATIO_TO_SUSPEND) //Check if we've moved enough air to be considered awake.
|
||||
interactions_with_unsim++
|
||||
else
|
||||
unsimulated_tiles = null
|
||||
|
||||
@@ -305,10 +310,11 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
Z.interactions_with_neighbors++
|
||||
interactions_with_neighbors++
|
||||
|
||||
if(!interactions_with_neighbors && !unsimulated_tiles)
|
||||
if(!interactions_with_neighbors && !interactions_with_unsim)
|
||||
SetStatus(ZONE_SLEEPING)
|
||||
|
||||
interactions_with_neighbors = 0
|
||||
interactions_with_unsim = 0
|
||||
|
||||
progress = "all components completed successfully, the problem is not here"
|
||||
|
||||
@@ -329,6 +335,28 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs
|
||||
/zone/proc/CheckStatus()
|
||||
return status
|
||||
|
||||
|
||||
/zone/proc/ActivateIfNeeded()
|
||||
if(status == ZONE_ACTIVE) return
|
||||
|
||||
var/difference = 0
|
||||
|
||||
if(unsimulated_tiles && unsimulated_tiles.len)
|
||||
if(air.compare_unsim(unsimulated_tiles))
|
||||
difference = 1
|
||||
|
||||
if(!difference)
|
||||
for(var/zone/Z in connected_zones) //Check adjacent zones for air difference.
|
||||
if(air.compare(Z.air))
|
||||
difference = 1
|
||||
break
|
||||
|
||||
if(difference) //We have a difference, activate the zone.
|
||||
SetStatus(ZONE_ACTIVE)
|
||||
|
||||
return
|
||||
|
||||
|
||||
/zone/proc/assume_air(var/datum/gas_mixture/giver)
|
||||
if(status == ZONE_ACTIVE)
|
||||
return air.merge(giver)
|
||||
|
||||
Reference in New Issue
Block a user