proc
aiPatrol()
var/area/currentArea=src.loc.loc
var/list/areaTurfs = new/list()
for(var/turf/T in oview(1))
if(T.loc==currentArea)
areaTurfs+=T
step_to(src,pick(areaTurfs))
sleep(5)
spawn() aiPatrol()
Problem description:
I want my mob to randomly walk around, without ever leaving the area he starts in. However, he moves 6 pixels at a time, and my icon size is 32, so I'm pretty sure that he doesn't go up to the boundaries at all, and if the area is two tiles tall then he ends up only going left or right.
TL;DR: My "patrol area" proc kinda works, but I'm certain there's a better way, I just don't know how :P
Thanks for reading, and thanky in advance for any advice!