Merge pull request #14674 from silicons/atmosstuffs
[ATMOS CHANGE TESTMERGE THIS OH GOD] adds multiz_accessible_levels infinite loop guard, reworks atmos adjacent turfs proc
This commit is contained in:
@@ -79,31 +79,27 @@
|
||||
if (atmos_adjacent_turfs)
|
||||
adjacent_turfs = atmos_adjacent_turfs.Copy()
|
||||
else
|
||||
adjacent_turfs = list()
|
||||
return list() // don't bother checking diagonals, diagonals are going to be cardinal checks anyways.
|
||||
|
||||
if (!alldir)
|
||||
return adjacent_turfs
|
||||
|
||||
var/turf/curloc = src
|
||||
|
||||
for (var/direction in GLOB.diagonals_multiz)
|
||||
var/matchingDirections = 0
|
||||
var/turf/S = get_step_multiz(curloc, direction)
|
||||
if(!S)
|
||||
var/turf/other
|
||||
var/turf/mid
|
||||
for (var/d in GLOB.diagonals)
|
||||
other = get_step(src, d)
|
||||
if(!other)
|
||||
continue
|
||||
// NS step
|
||||
mid = get_step(src, NSCOMPONENT(d))
|
||||
if((mid in adjacent_turfs) && (get_step(mid, EWCOMPONENT(d)) in adjacent_turfs))
|
||||
adjacent_turfs += other
|
||||
continue
|
||||
// EW step
|
||||
mid = get_step(src, EWCOMPONENT(d))
|
||||
if((mid in adjacent_turfs) && (get_step(mid, NSCOMPONENT(d)) in adjacent_turfs))
|
||||
adjacent_turfs += other
|
||||
continue
|
||||
|
||||
for (var/checkDirection in GLOB.cardinals_multiz)
|
||||
var/turf/checkTurf = get_step(S, checkDirection)
|
||||
if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
|
||||
continue
|
||||
|
||||
if (adjacent_turfs[checkTurf])
|
||||
matchingDirections++
|
||||
|
||||
if (matchingDirections >= 2)
|
||||
adjacent_turfs += S
|
||||
break
|
||||
|
||||
return adjacent_turfs
|
||||
|
||||
/atom/proc/air_update_turf(command = 0)
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
var/offset
|
||||
while((offset = SSmapping.level_trait(other_z, ZTRAIT_DOWN)))
|
||||
other_z += offset
|
||||
if(other_z in .)
|
||||
break // no infinite loops
|
||||
. += other_z
|
||||
other_z = center_z
|
||||
while((offset = SSmapping.level_trait(other_z, ZTRAIT_UP)))
|
||||
other_z += offset
|
||||
if(other_z in .)
|
||||
break // no infinite loops
|
||||
. += other_z
|
||||
return .
|
||||
|
||||
|
||||
/proc/get_dir_multiz(turf/us, turf/them)
|
||||
us = get_turf(us)
|
||||
@@ -46,4 +48,4 @@
|
||||
|
||||
/turf/proc/below()
|
||||
return get_step_multiz(src, DOWN)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user