Skip to content

Commit

Permalink
unfuck ZAS (#8537)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirRichardFrancis authored Dec 21, 2024
1 parent 3192f67 commit 389af8d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
15 changes: 7 additions & 8 deletions code/ZAS/Connection.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ Class Procs:
return !(state & CONNECTION_INVALID)

/connection/proc/erase()
edge.remove_connection(src)
if(edge)
edge.remove_connection(src)
state |= CONNECTION_INVALID
//world << "Connection Erased: [state]"

/connection/proc/update()
//world << "Updated, \..."
if(!istype(A,/turf))
if(!A.is_simulated)
//world << "Invalid A."
erase()
return
Expand All @@ -118,10 +119,8 @@ Class Procs:
else
mark_direct()

var/b_is_space = !istype(B,/turf)

if(state & CONNECTION_SPACE)
if(!b_is_space)
if(B.is_simulated)
//world << "Invalid B."
erase()
return
Expand All @@ -131,16 +130,16 @@ Class Procs:
erase()
//world << "erased."
return
else
if(edge)
edge.remove_connection(src)
edge = SSair.get_edge(A.zone, B)
edge.add_connection(src)
zoneA = A.zone
zoneA = A.zone

//world << "valid."
return

else if(b_is_space)
else if(!B.is_simulated)
//world << "Invalid B."
erase()
return
Expand Down
8 changes: 5 additions & 3 deletions code/ZAS/Turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

var/previously_open = open_directions
open_directions = 0
var/list/postponed
var/list/postponed = list()
#ifdef ZLEVELS
for(var/d = 1, d < 64, d *= 2)
#else
Expand Down Expand Up @@ -96,8 +96,6 @@
// 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)))
//Postpone this tile rather than exit, since a connection can still be made.
if(!postponed)
postponed = list()
postponed.Add(neighbour_turf)
else
neighbour_turf.zone.add(src)
Expand All @@ -106,6 +104,10 @@
#endif
else if(neighbour_turf.zone != zone)
SSair.connect(src, neighbour_turf)
else if(zone)
SSair.connect(src, neighbour_turf)
else // This tile does not yet have a valid zone, but likely to get one from other neighbours
postponed.Add(neighbour_turf)

if(!TURF_HAS_VALID_ZONE(src)) //Still no zone, make a new one.
var/zone/newzone = new/zone()
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystems/air.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ SUBSYSTEM_DEF(air)
#ifdef ZASDBG
ASSERT(isturf(A))
ASSERT(isturf(B))
if(istype(B, /turf/space))
return FALSE
#endif

var/ablock = A.c_airblock(B)
Expand Down

0 comments on commit 389af8d

Please sign in to comment.