//          Title: get_steps
// Credit to: CaptFalcon33035 and his stupidity
// Contributed by: CaptFalcon33035
The story is, I thought get_step() was broken when I
neglected to realize that I was using an argument in
a verb rather than a procedure, so it found a mob for

And so, I developed a new get_step() procedure. Well,
get_step() was not broken, and it turns out it was
just a bit of ignorance on my part. Anyway, after
looking at my get_step() code, I realized I could turn
it into a get_steps() procedure with little effort
(which means adding one variable and changing all the
1s to that variable), and here it is!

You use this just like you would get_step(), except
there is an extra argument. dist defines how many
turfs away in what direction the turf you'd like to
grab is.

For example, to grab a turf 5 away NORTH from ref:

var/atom/ref = whoever
var/turf/T = get_steps(ref, NORTH, 5)

I know there is an existing procedure, but it requires
multiple calls to get_step() and I've never really liked
that method.

proc/get_steps(var/atom/ref, var/dir, var/dist=1)
if(!ref || !dir || !ref.loc) return 0
var/x_add = 0
var/y_add = 0

if(ref.dir & NORTH) y_add = dist
else if(ref.dir & SOUTH) y_add = -dist

if(ref.dir & EAST) x_add = dist
else if(ref.dir & WEST) x_add = -dist

return locate(ref.x+x_add, ref.y+y_add, ref.z)
Cool beans, this. Simple and elegant -- the whole point of a snippet. =)