proc
get_steps_to(atom/a,atom/b)
if(istype(a,/atom/movable)) a = a.loc
if(istype(b,/atom/movable)) b = b.loc
var/list/result=list()
var/atom/current=a
while(current!=b)
result += get_step_to(current,get_dir(current,b),0)
current = get_step_to(current,get_dir(current,b),0)
return result
proc
get_steps(atom/a,atom/b)
if(istype(a,/atom/movable)) a = a.loc
if(istype(b,/atom/movable)) b = b.loc
var/list/result=list()
var/atom/current=a
while(current!=b)
result += get_step(current,get_dir(current,b))
current = get_step(current,get_dir(current,b))
return result
Problem description:
So, basically, the code above simply multiplies get_step and get_step_to many times, so you have the entire path to a certain point returned.
When I do a test verb like this,
mob/verb
steps_to()
for(var/turf/t in get_steps_to(locate(1,1,1),locate(10,10,1)))
t.icon_state = "blue"
steps()
for(var/turf/t in get_steps(locate(1,1,1),locate(10,10,1)))
t.icon_state = "blue"
steps() works just fine.
steps_to() doesn't. Dream Seeker crashes if I run this proc.
There are no obstacles between (1,1,1) and (10,10,1).
Apprently, the variable current in get_steps_to() becomes null, and I have no idea of why this happens.
What the heck?
So:
Should be:
Also, you can use get_step_towards() for get_steps(), and then not need the get_dir().