diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm index bdac4bacd68..1d78eb69c8e 100644 --- a/code/ZAS/FEA_system.dm +++ b/code/ZAS/FEA_system.dm @@ -142,7 +142,7 @@ datum if(S.CanPass(null, S, 0, 0)) new/zone(S) - tiles_to_update |= S + S.update_air_properties() world << "\red \b Geometry processed in [time2text(world.timeofday-start_time, "mm:ss")] minutes!" spawn start() diff --git a/code/ZAS/FEA_turf_tile.dm b/code/ZAS/FEA_turf_tile.dm index 76a9b4e7013..fa44ba20f73 100644 --- a/code/ZAS/FEA_turf_tile.dm +++ b/code/ZAS/FEA_turf_tile.dm @@ -219,7 +219,7 @@ turf if(NT && NT.zone && NT.zone == T.zone) T.zone.rebuild = 1 - else if((!T.CanPass(null, src, 1.5, 1) && T.CanPass(null, src, 0, 0)) || (!CanPass(null, T, 1.5, 1) && CanPass(null, T, 0, 0))) + else if(T.CanPass(null, src, 0, 0)) if(T.zone != zone) ZConnect(src,T) diff --git a/code/ZAS/Processing.dm b/code/ZAS/Processing.dm index e741b70f377..fd21d4168f4 100644 --- a/code/ZAS/Processing.dm +++ b/code/ZAS/Processing.dm @@ -1,5 +1,4 @@ #define QUANTIZE(variable) (round(variable,0.0001)) -var/explosion_halt = 0 vs_control/var/zone_share_percent = 10 vs_control/var/zone_share_percent_NAME = "Zone Share Percent" vs_control/var/zone_share_percent_DESC = "Percentage of air difference to move per tick" @@ -10,67 +9,8 @@ zone/proc/process() return 0 //Does rebuilding stuff. Not sure if used. if(rebuild) - - //Choose a random turf and regenerate the zone from it. - var - turf/simulated/sample = pick(contents) - list/new_contents - problem = 0 - - if(space_tiles) - del(space_tiles) - - contents.Remove(null) //I can't believe this is needed. - - if(!contents.len) - del src - - var/list/tried_turfs = list() - do - if(sample) - tried_turfs |= sample - var/list/turfs_to_consider = contents - tried_turfs - if(!turfs_to_consider.len) - break - sample = pick(turfs_to_consider) //Nor this. - while(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) - - if(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) //Not a single valid turf. - for(var/turf/simulated/T in contents) - air_master.tiles_to_update |= T - del src - - new_contents = FloodFill(sample) - - for(var/turf/space/S in new_contents) - if(!space_tiles) - space_tiles = list() - space_tiles |= S - - //If something isn't carried over, there was a complication. - for(var/turf/T in contents) - if(!(T in new_contents)) - problem = 1 - T.zone = null - - if(problem) - //Build some new zones for stuff that wasn't included. - var/list/turf/simulated/rebuild_turfs = contents - new_contents - var/list/turf/simulated/reconsider_turfs = list() - contents = new_contents - for(var/turf/T in rebuild_turfs) - if(istype(T,/turf/space)) - air_master.tiles_to_update |= T - else if(!T.zone && T.CanPass(null, T, 1.5, 1)) - var/zone/Z = new /zone(T) - Z.air.copy_from(air) - else - reconsider_turfs |= T - for(var/turf/T in reconsider_turfs) - if(!T.zone) - var/zone/Z = new /zone(T) - Z.air.copy_from(air) rebuild = 0 + Rebuild() //Shoving this into a proc. //Sometimes explosions will cause the air to be deleted for some reason. if(!air) @@ -272,4 +212,78 @@ zone/proc/connected_zones() .[Z]++ else . += Z - .[Z] = 1 \ No newline at end of file + .[Z] = 1 + +zone/proc/Rebuild() + //Choose a random turf and regenerate the zone from it. + var + turf/simulated/sample = pick(contents) + list/new_contents + problem = 0 + + if(space_tiles) + del(space_tiles) + + contents.Remove(null) //I can't believe this is needed. + + if(!contents.len) + del src + + var/list/tried_turfs = list() + do + if(sample) + tried_turfs |= sample + var/list/turfs_to_consider = contents - tried_turfs + if(!turfs_to_consider.len) + break + sample = pick(turfs_to_consider) //Nor this. + while(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) + + if(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) //Not a single valid turf. + for(var/turf/simulated/T in contents) + air_master.tiles_to_update |= T + del src + + new_contents = FloodFill(sample) + + for(var/turf/space/S in new_contents) + if(!space_tiles) + space_tiles = list() + space_tiles |= S + + if(contents.len != new_contents.len) + problem = 1 + + //If something isn't carried over, there was a complication. + for(var/turf/T in contents) + if(!(T in new_contents)) + T.zone = null + problem = 1 + + for(var/turf/T in new_contents) + + if(problem) + //Build some new zones for stuff that wasn't included. + var/list/turf/simulated/rebuild_turfs = contents - new_contents + var/list/turf/simulated/reconsider_turfs = list() + contents = new_contents + for(var/turf/T in rebuild_turfs) + if(istype(T,/turf/space)) + air_master.tiles_to_update |= T + else if(!T.zone && T.CanPass(null, T, 1.5, 1)) + var/zone/Z = new /zone(T) + Z.air.copy_from(air) + else + reconsider_turfs |= T + for(var/turf/T in reconsider_turfs) + if(!T.zone) + var/zone/Z = new /zone(T) + Z.air.copy_from(air) + + for(var/turf/T in contents) + if(T.zone && T.zone != src) + T.zone.RemoveTurf(T) + T.zone = src + else if(!T.zone) + T.zone = src + air.group_multiplier = contents.len \ No newline at end of file diff --git a/code/game/master_controller.dm b/code/game/master_controller.dm index ea4e897f801..1a404e2c3a5 100644 --- a/code/game/master_controller.dm +++ b/code/game/master_controller.dm @@ -167,6 +167,7 @@ datum/controller/game_controller if(!kill_air) src.set_debug_state("Air Master") + air_master.current_cycle++ var/success = air_master.tick() //Changed so that a runtime does not crash the ticker. if(!success) //Runtimed. world << "ERROR IN ATMOS TICKER. Killing air simulation!" diff --git a/code/game/objects/window.dm b/code/game/objects/window.dm index f4924f25ec4..85b155de4ef 100644 --- a/code/game/objects/window.dm +++ b/code/game/objects/window.dm @@ -322,7 +322,7 @@ /obj/structure/window/Del() density = 0 - update_nearby_tiles() + update_nearby_tiles(need_rebuild=1) playsound(src, "shatter", 70, 1) @@ -343,6 +343,14 @@ //This proc has to do with airgroups and atmos, it has nothing to do with smoothwindows, that's update_nearby_tiles(). /obj/structure/window/proc/update_nearby_tiles(need_rebuild) if(!air_master) return 0 + if(!dir in cardinal) + var/turf/simulated/source = get_turf(src) + if(istype(source)) + air_master.tiles_to_update |= source + for(var/dir in cardinal) + var/turf/simulated/target = get_step(source,dir) + if(istype(target)) air_master.tiles_to_update |= target + return 1 var/turf/simulated/source = get_turf(src) var/turf/simulated/target = get_step(source,dir)