Layers/Elevation in Design Philosophy
|
|
Here's something I've been playing with. It's untested, and probably won't copy/paste even with the DM tags, as I spaced everything by hand... but it's something people have asked if BYOND could handle, so I thought I'd share.
#define BRIDGE_LAYER 5 atom/var/elevation turf Enter(atom/movable/m)
if (abs(m.elevation - src.elevation) > 1) return 0 return ..() ground elevation = 1 valley elevation = -1 mountain elevation = 3 down_slope elevation = 0 up_slope elevation = 2 bridge elevation = 1 layer = BRIDGE_LAYER var/bridge_level = 3 proc/is_open(elevation) for (var/atom/movable/m in src) if (m.elevation == elevation && m.density) return 0 return 1 Enter(atom/movable/m) if (m.elevation == bridge_level) if (m.density == 0 || is_open(bridge_level)) if (. && m.layer < BRIDGE_LAYER) spawn() m.layer += BRIDGE_LAYER return 1 else return 0 return (m.density == 0 || is_open(elevation)) Exited(atom/movable/m) if (m.layer > BRIDGE_LAYER) m.layer -= BRIDGE_LAYER
|
The above code is by no means flawless... I haven't tested it in the form written. One thing to consider is that elevation would not calculated as part of distance, and mobs below or above you on a bridge would be considered to be at a distance of 0.
|
Kinda what u would do with building a 2 story house. Lord Raven shared this with me a while ago.