obj
Move()
if(src.walkingback) {..();return 0}
if(istype(src,/obj/shadow))
var/prevloc=src.loc
..()
var/prevdir=src.dir
src.loc=prevloc
src.dir=prevdir
if(src.dir==NORTHEAST) {src.walkingback=1;step(src,rand(NORTH,EAST));src.walkingback=0}
if(src.dir==NORTHWEST) {src.walkingback=1;step(src,rand(NORTH,WEST));src.walkingback=0}
if(src.dir==SOUTHEAST) {src.walkingback=1;step(src,rand(SOUTH,EAST));src.walkingback=0}
if(src.dir==SOUTHWEST) {src.walkingback=1;step(src,rand(SOUTH,WEST));src.walkingback=0}
else {src.walkingback=1;step(src,src.dir);src.walkingback=0}
var/obj/a=new/obj/trail(prevloc)
a.dir=turn(src.dir,180)
a.following=src
a.owner=src.shadow
else ..()
Problem description:
Besides this being messy code (Euh, someone explain me how to make it non-messy? o.o;...), what causes the object (/obj/shadow) to hop around in no logical direction at all, untill it comes on a location where it can walk straight to the mob?