Files
S.P.L.U.R.T-Station-13/code/modules/mapping/space_management/multiz_helpers.dm
silicons 803bff4e5f funny
2020-11-12 23:34:42 -07:00

50 lines
1.0 KiB
Plaintext

/proc/get_step_multiz(ref, dir)
if(dir & UP)
dir &= ~UP
return get_step(SSmapping.get_turf_above(get_turf(ref)), dir)
if(dir & DOWN)
dir &= ~DOWN
return get_step(SSmapping.get_turf_below(get_turf(ref)), dir)
return get_step(ref, dir)
/proc/get_multiz_accessible_levels(center_z)
. = list(center_z)
var/other_z = center_z
var/offset
while((offset = SSmapping.level_trait(other_z, ZTRAIT_DOWN)))
other_z += offset
. += other_z
other_z = center_z
while((offset = SSmapping.level_trait(other_z, ZTRAIT_UP)))
other_z += offset
. += other_z
return .
/proc/get_dir_multiz(turf/us, turf/them)
us = get_turf(us)
them = get_turf(them)
if(!us || !them)
return NONE
if(us.z == them.z)
return get_dir(us, them)
else
var/turf/T = us.above()
var/dir = NONE
if(T && (T.z == them.z))
dir = UP
else
T = us.below()
if(T && (T.z == them.z))
dir = DOWN
else
return get_dir(us, them)
return (dir | get_dir(us, them))
/turf/proc/above()
return get_step_multiz(src, UP)
/turf/proc/below()
return get_step_multiz(src, DOWN)