if (!action&&!nest&&!waterfound)
for (var/turf/T as turf in oview(5))
if (istype(T,/turf/water))
if(!waterfound)
waterfound=1
step_away(src,T)
world<<"[src]: I see water"
waterloc+=T
action=1
if(get_dist(src,T)>=6)
var/obj/o=new /obj/rattsnest
o.loc=loc
o.owner=src
nestloc=o
nest=1
break
else
spawn
while(get_dist(src,T)<6)
step_rand(src)
sleep(metab)
var/obj/o=new /obj/rattsnest
o.loc=loc
o.owner=src
nestloc=o
nest=1
break
Problem description:
I'm not sure what's goin on here, but the mob seems to gain some aberrant behavior seemingly gaining an extra move per turn after the distance has been met and the while loop should end... And I'm sure there are better/easier ways to do this, but this is what my pea-brain came up with... Any help would be appreciated.
Some Slacker