From fbede7a1931df4d093f048c5e73a89145ac2b2f2 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 28 Apr 2015 23:00:56 -0400 Subject: [PATCH 1/4] Minor ZAS-related cleanup --- code/ZAS/Atom.dm | 2 +- code/ZAS/Turf.dm | 7 +++++-- code/__HELPERS/unsorted.dm | 24 ------------------------ code/game/turfs/turf.dm | 12 +----------- 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/code/ZAS/Atom.dm b/code/ZAS/Atom.dm index 6f75f4ea29..e655295f78 100644 --- a/code/ZAS/Atom.dm +++ b/code/ZAS/Atom.dm @@ -50,7 +50,7 @@ atom/proc/c_airblock(turf/other) #ifdef ZASDBG ASSERT(isturf(other)) #endif - return !CanPass(null, other, 0, 0) + 2*!CanPass(null, other, 1.5, 1) + return (AIR_BLOCKED*!CanPass(null, other, 0, 0))|(ZONE_BLOCKED*!CanPass(null, other, 1.5, 1)) turf/c_airblock(turf/other) diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 9d031ce3d3..1b770590e1 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -46,6 +46,7 @@ air_master.connect(sim, src) /turf/simulated/update_air_properties() + if(zone && zone.invalid) c_copy_air() zone = null //Easier than iterating through the list at the zone. @@ -120,8 +121,10 @@ //Might have assigned a zone, since this happens for each direction. if(!zone) - //if((block & ZONE_BLOCKED) || (r_block & ZONE_BLOCKED && !(s_block & ZONE_BLOCKED))) - if(((block & ZONE_BLOCKED) && !(r_block & ZONE_BLOCKED)) || (r_block & ZONE_BLOCKED && !(s_block & ZONE_BLOCKED))) + //We do not merge if + // they are blocking us and we are not blocking them, or if + // we are blocking them and not blocking ourselves - this prevents tiny zones from forming on doorways. + if(((block & ZONE_BLOCKED) && !(r_block & ZONE_BLOCKED)) || ((r_block & ZONE_BLOCKED) && !(s_block & ZONE_BLOCKED))) #ifdef ZASDBG if(verbose) world << "[d] is zone blocked." //dbg(zone_blocked, d) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c65698933c..564910d3df 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -922,30 +922,6 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl refined_trg -= B continue moving - var/list/doors = new/list() - - if(toupdate.len) - for(var/turf/simulated/T1 in toupdate) - for(var/obj/machinery/door/D2 in T1) - doors += D2 - /*if(T1.parent) - air_master.groups_to_rebuild += T1.parent - else - air_master.tiles_to_update += T1*/ - - if(fromupdate.len) - for(var/turf/simulated/T2 in fromupdate) - for(var/obj/machinery/door/D2 in T2) - doors += D2 - /*if(T2.parent) - air_master.groups_to_rebuild += T2.parent - else - air_master.tiles_to_update += T2*/ - - for(var/obj/O in doors) - O:update_nearby_tiles(1) - - proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0) if(!original) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 29f425d4a3..5e8e5747c0 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -227,12 +227,6 @@ if(S.zone) S.zone.rebuild() if(ispath(N, /turf/simulated/floor)) - //if the old turf had a zone, connect the new turf to it as well - Cael - //Adjusted by SkyMarshal 5/10/13 - The air master will handle the addition of the new turf. - //if(zone) - // zone.RemoveTurf(src) - // if(!zone.CheckStatus()) - // zone.SetStatus(ZONE_ACTIVE) var/turf/simulated/W = new N( locate(src.x, src.y, src.z) ) //W.Assimilate_Air() @@ -249,7 +243,7 @@ W.RemoveLattice() if(air_master) - air_master.mark_for_update(src) + air_master.mark_for_update(src) //handle the addition of the new turf. for(var/turf/space/S in range(W,1)) S.update_starlight() @@ -258,10 +252,6 @@ return W else - //if(zone) - // zone.RemoveTurf(src) - // if(!zone.CheckStatus()) - // zone.SetStatus(ZONE_ACTIVE) var/turf/W = new N( locate(src.x, src.y, src.z) ) W.lighting_lumcount += old_lumcount From 277103f1cdfb149c08925809a1f2a59f06065e36 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 28 Apr 2015 23:06:07 -0400 Subject: [PATCH 2/4] Fixes tiny door zones Fixes #8987 by deferring the update of self-zone-blocked turfs until after non-self-zone-block turfs have updated (and thus have valid zones). --- code/ZAS/Controller.dm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/code/ZAS/Controller.dm b/code/ZAS/Controller.dm index 4ba30f47b3..d8cb87a740 100644 --- a/code/ZAS/Controller.dm +++ b/code/ZAS/Controller.dm @@ -154,7 +154,18 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun #ifdef ZASDBG var/updated = 0 #endif + + //defer updating of self-zone-blocked turfs until after all other turfs have been updated. + //this hopefully ensures that non-self-zone-blocked turfs adjacent to self-zone-blocked ones + //have valid zones when the self-zone-blocked turfs update. + var/list/deferred = list() + for(var/turf/T in updating) + //check if the turf is self-zone-blocked + if(T.c_airblock(T) & ZONE_BLOCKED) + deferred += T + continue + T.update_air_properties() T.post_update_air_properties() T.needs_air_update = 0 @@ -164,6 +175,15 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun #endif //sleep(1) + for(var/turf/T in deferred) + T.update_air_properties() + T.post_update_air_properties() + T.needs_air_update = 0 + #ifdef ZASDBG + T.overlays -= mark + updated++ + #endif + #ifdef ZASDBG if(updated != updating.len) tick_progress = "[updating.len - updated] tiles left unupdated." @@ -307,7 +327,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun /datum/controller/air_system/proc/mark_edge_sleeping(connection_edge/E) #ifdef ZASDBG - ASSERT(istype(E) + ASSERT(istype(E)) #endif if(E.sleeping) return active_edges.Remove(E) @@ -315,7 +335,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun /datum/controller/air_system/proc/mark_edge_active(connection_edge/E) #ifdef ZASDBG - ASSERT(istype(E) + ASSERT(istype(E)) #endif if(!E.sleeping) return active_edges.Add(E) From a80cb1b44eb481f08424c4a12a7fddda3e3546a3 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 29 Apr 2015 20:27:39 -0400 Subject: [PATCH 3/4] Fixes edges being lost when zones are merged --- code/ZAS/Zone.dm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index 7c9c5f32ed..7bb8afc8c5 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -105,6 +105,13 @@ Class Procs: #ifdef ZASDBG T.dbg(merged) #endif + + //rebuild the old zone's edges so that the will be possesed by the new zone + for(var/connection_edge/E in edges) + if(E.contains_zone(into)) + continue //don't need to rebuild this edge + for(var/turf/T in E.connecting_turfs) + air_master.mark_for_update(T) /zone/proc/c_invalidate() invalid = 1 From 03e88ca9a5475469b33123a5bbb0e4b37ff60bc8 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Wed, 29 Apr 2015 20:53:50 -0400 Subject: [PATCH 4/4] Updates locate(/obj/machinery/door/airlock) hack --- code/ZAS/Turf.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 1b770590e1..ab7360643f 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -59,7 +59,8 @@ #endif if(zone) var/zone/z = zone - if(locate(/obj/machinery/door/airlock) in src) //Hacky, but prevents normal airlocks from rebuilding zones all the time + + if(s_block & ZONE_BLOCKED) //Hacky, but prevents normal airlocks from rebuilding zones all the time z.remove(src) else z.rebuild()