Code:
mob/npc
var/list/schedule
New()
..()
schedule = new
schedule += locate(1,1,1)
schedule += locate(9,9,1)
sleep(10); src.routine()
proc/routine()
for(var/i = 1, i <= src.schedule.len, i++)
while(src.loc != src.schedule[i] && src.loc)
sleep(01);step_to(src, src.schedule[i]); world << "[src.x], [src.y]"
sleep(50); return src.loc ? src.routine() : 0
Problem description:
Working on making NPCs follow a schedule. Starting with just the bare bones of it and already encountering an issue. The NPC will move to the first location fine. Then, as soon as it reaches said location it will head toward the second. This is all intended, the problem is the NPC will never enter the second location. Once it gets one tile away in this instance 8,8,1 step_to() will just continue to be called without the NPC moving. I have checked this location for a hidden obstacle none exists. I've also changed this location to several different ones and the same thing happens. Once the NPC gets within one tile, it stops and step_to() is called indefinitely. I've also put a debug message in the Bump() proc even though I don't think step_to() ever calls Bump(). Since how I understand it is, it checks a location for a dense atom before calling Move(). This turns up no results. I'm not sure what else to try at this point.
[Edit]
The NPC doesn't stop moving as soon as they enter a location one step away from the destination. Because of the pixel movement they are still taking steps toward the destination (9,9,1) while a tile away (8,8,1). They only actually stop moving right before the final step to enter the destination. I thought I would clarify that. So, it's not that step_to() is some how having the "min" argument changed.