diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index a6d62ec2e9..00a676664c 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -2,7 +2,7 @@ #define CONNECTION_SPACE 4 #define CONNECTION_INVALID 8 -/turf/simulated/var/tmp/connection_manager/connections = new +/turf/var/tmp/connection_manager/connections /connection_manager/var/connection/N @@ -61,6 +61,16 @@ if(check(D)) D.update() #endif +/connection_manager/proc/erase_all() + if(check(N)) N.erase() + if(check(S)) S.erase() + if(check(E)) E.erase() + if(check(W)) W.erase() + #ifdef ZLEVELS + if(check(U)) U.erase() + if(check(D)) D.erase() + #endif + /connection_manager/proc/check(connection/c) return c && c.valid() @@ -92,14 +102,12 @@ edge.add_connection(src) /connection/proc/mark_direct() - edge.remove_connection(src) state |= CONNECTION_DIRECT - edge.add_connection(src) + //world << "Marked direct." /connection/proc/mark_indirect() - edge.remove_connection(src) state &= ~CONNECTION_DIRECT - edge.add_connection(src) + //world << "Marked indirect." /connection/proc/mark_space() state |= CONNECTION_SPACE @@ -113,6 +121,7 @@ /connection/proc/erase() edge.remove_connection(src) state |= CONNECTION_INVALID + //world << "Connection Erased: [state]" /connection/proc/update() //world << "Updated, \..." diff --git a/code/ZAS/ConnectionGroup.dm b/code/ZAS/ConnectionGroup.dm index 2a4c374f78..bd100b8fdc 100644 --- a/code/ZAS/ConnectionGroup.dm +++ b/code/ZAS/ConnectionGroup.dm @@ -11,10 +11,10 @@ /connection_edge/proc/add_connection(connection/c) coefficient++ - //world << "Connection added. Coefficient: [coefficient]" + //world << "Connection added: [type] Coefficient: [coefficient]" /connection_edge/proc/remove_connection(connection/c) - //world << "Connection removed. Coefficient: [coefficient-1]" + //world << "Connection removed: [type] Coefficient: [coefficient-1]" coefficient-- if(coefficient <= 0) erase() @@ -23,7 +23,7 @@ /connection_edge/proc/erase() air_master.remove_edge(src) - //world << "Erased." + //world << "[type] Erased." /connection_edge/proc/tick() @@ -130,9 +130,15 @@ /connection_edge/unsimulated/add_connection(connection/c) . = ..() connecting_turfs.Add(c.B) + air.group_multiplier = coefficient /connection_edge/unsimulated/remove_connection(connection/c) connecting_turfs.Remove(c.B) + air.group_multiplier = coefficient + . = ..() + +/connection_edge/unsimulated/erase() + A.edges.Remove(src) . = ..() /connection_edge/unsimulated/contains_zone(zone/Z) diff --git a/code/ZAS/Controller.dm b/code/ZAS/Controller.dm index 32899b1556..b074358193 100644 --- a/code/ZAS/Controller.dm +++ b/code/ZAS/Controller.dm @@ -190,15 +190,19 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun a_to_b = get_dir(A,B) b_to_a = get_dir(B,A) + if(!A.connections) A.connections = new + if(!B.connections) B.connections = new + if(A.connections.get(a_to_b)) return + if(B.connections.get(b_to_a)) return if(!space) if(A.zone == B.zone) return - if(B.connections.get(b_to_a)) return + var/connection/c = new /connection(A,B) A.connections.place(c, a_to_b) - if(!space) B.connections.place(c, b_to_a) + B.connections.place(c, b_to_a) if(direct) c.mark_direct() diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index e9ac325d53..62db9d0eb8 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -14,6 +14,9 @@ var/image/mark = image('icons/Testing/Zone.dmi', icon_state = "mark") overlays += img dbg_img = img +proc/soft_assert(thing,fail) + if(!thing) message_admins(fail) + /turf/simulated/var/verbose = 0 /turf/simulated/verb/Verbose() set src in world diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 976379c06d..d3d98d720f 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -32,6 +32,11 @@ //unsim.dbg(air_blocked, turn(180,d)) continue + var/r_block = c_airblock(unsim) + + if(r_block & AIR_BLOCKED) + continue + if(istype(unsim, /turf/simulated)) var/turf/simulated/sim = unsim @@ -165,9 +170,7 @@ air_master.connect(src, T) /turf/proc/post_update_air_properties() - -/turf/simulated/post_update_air_properties() - connections.update_all() + if(connections) connections.update_all() /turf/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air del(giver) diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index cfaba5d082..4edfb2ecfb 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -33,7 +33,7 @@ ASSERT(!invalid) ASSERT(istype(T)) ASSERT(T.zone == src) - ASSERT(T in contents) + soft_assert(T in contents, "Lists are weird broseph") #endif contents.Remove(T) T.zone = null diff --git a/code/ZAS/_docs.dm b/code/ZAS/_docs.dm index 6283761550..2f763f2b1a 100644 --- a/code/ZAS/_docs.dm +++ b/code/ZAS/_docs.dm @@ -21,7 +21,7 @@ air_master.mark_for_update(turf) */ -//#define ZASDBG +#define ZASDBG //#define ZLEVELS #define AIR_BLOCKED 1 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 65231916c8..b172024579 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -216,8 +216,14 @@ var/old_lumcount = lighting_lumcount - initial(lighting_lumcount) - if(!ispath(N,/turf/simulated) && istype(src,/turf/simulated)) - src:zone:remove(src) + //world << "Replacing [src.type] with [N]" + + if(connections) connections.erase_all() + + if(istype(src,/turf/simulated)) + //world << "Removed from zone." + var/turf/simulated/S = src + if(S.zone) S.zone.remove(S) if(ispath(N, /turf/simulated/floor)) //if the old turf had a zone, connect the new turf to it as well - Cael