Files
Bubberstation/code/modules/mapping/space_management/multiz_helpers.dm
Zephyr 1b96345e44 Multi-Z Support for Lazy Templates | Cleans up some turf flag misuse (#77786)
## About The Pull Request

Adds multi-z support for lazy templates
Also fixes some improper use and placement for turf flags
## Why It's Good For The Game

Shadow needs/wants this for bit runner maps.
Turf flags are also why lava has been generating in places it shouldnt.
(inside of ruins)
## Changelog
🆑
fix: Lava can no longer occasionally generate inside of previously
loaded templates and breach and/or destroy shit
/🆑

---------

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
2023-09-19 01:06:08 +00:00

47 lines
988 B
Plaintext

/proc/get_step_multiz(ref, dir)
var/turf/us = get_turf(ref)
if(dir & UP)
dir &= ~UP
return get_step(GET_TURF_ABOVE(us), dir)
if(dir & DOWN)
dir &= ~DOWN
return get_step(GET_TURF_BELOW(us), dir)
return get_step(ref, dir)
/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 = GET_TURF_ABOVE(us)
var/dir = NONE
if(T && (T.z == them.z))
dir = UP
else
T = GET_TURF_BELOW(us)
if(T && (T.z == them.z))
dir = DOWN
else
return get_dir(us, them)
return (dir | get_dir(us, them))
/proc/get_lowest_turf(atom/ref)
var/turf/us = get_turf(ref)
var/turf/next = GET_TURF_BELOW(us)
while(next)
us = next
next = GET_TURF_BELOW(us)
return us
// I wish this was lisp
/proc/get_highest_turf(atom/ref)
var/turf/us = get_turf(ref)
var/turf/next = GET_TURF_ABOVE(us)
while(next)
us = next
next = GET_TURF_ABOVE(us)
return us