diff --git a/code/ZAS/FEA_gas_mixture.dm b/code/ZAS/FEA_gas_mixture.dm index a4bdb022068..cea0efc3ab7 100644 --- a/code/ZAS/FEA_gas_mixture.dm +++ b/code/ZAS/FEA_gas_mixture.dm @@ -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) diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm index 7ba40ef715a..12ac2df2445 100644 --- a/code/ZAS/ZAS_Turfs.dm +++ b/code/ZAS/ZAS_Turfs.dm @@ -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) || \ diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 371be846a9c..b58cdd1903a 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -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) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 6cf4a99b6b6..ae544c43d54 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -74,7 +74,7 @@ Works together with spawning an observer, noted above. if(key) var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc. ghost.can_reenter_corpse = can_reenter_corpse - ghost.timeofdeath = timeofdeath //BS12 EDIT + ghost.timeofdeath = src.timeofdeath //BS12 EDIT ghost.key = key return ghost @@ -89,10 +89,11 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp if(stat == DEAD) ghostize(1) else - var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost whilst still alive you may not play again this round! You can't change your mind so choose wisely!!)","Are you sure you want to ghost?","Ghost","Stay in body") + var/response = alert(src, "Are you -sure- you want to ghost?\n(You are alive. If you ghost, you won't be able to play this round for another 30 minutes! You can't change your mind so choose wisely!)","Are you sure you want to ghost?","Ghost","Stay in body") if(response != "Ghost") return //didn't want to ghost after-all resting = 1 - ghostize(0) //0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3 + var/mob/dead/observer/ghost = ghostize(0) //0 parameter is so we can never re-enter our body, "Charlie, you can never come baaaack~" :3 + ghost.timeofdeath = world.time // Because the living mob won't have a time of death and we want the respawn timer to work properly. return diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index a0bf7f2ed31..77b4dbd884d 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -119,6 +119,7 @@ var/obj/O = locate("landmark*Observer-Start") src << "\blue Now teleporting." observer.loc = O.loc + observer.timeofdeath = world.time // Set the time of death so that the respawn timer works correctly. client.prefs.update_preview_icon() observer.icon = client.prefs.preview_icon diff --git a/code/modules/projectiles/projectile/beams.dm b/code/modules/projectiles/projectile/beams.dm index f513c83da33..3024ea1aa41 100644 --- a/code/modules/projectiles/projectile/beams.dm +++ b/code/modules/projectiles/projectile/beams.dm @@ -71,13 +71,13 @@ var/list/beam_master = list() ..() proc/cleanup(reference) //Waits .3 seconds then removes the overlay. - src = null - sleep(3) - var/list/turf_master = beam_master[reference] - for(var/laser_state in turf_master) - var/list/turfs = turf_master[laser_state] - for(var/turf/T in turfs) - T.overlays -= beam_master[laser_state] + src = null //we're getting deleted! this will keep the code running + spawn(3) + var/list/turf_master = beam_master[reference] + for(var/laser_state in turf_master) + var/list/turfs = turf_master[laser_state] + for(var/turf/T in turfs) + T.overlays -= beam_master[laser_state] return /obj/item/projectile/beam/practice