ID:2369409
 
Code:
mob
Move()
sleep(5)
..()


Problem description:
I am trying to make a small delay between movements so that the player cannot just zip around the map. My understanding is that this code will edit the pre-existing proc "Move", which is called whenever you hit one of the direction keys, right? So I am telling it to wait 0.5 seconds, and then do what it would normally do, via the parent proc. But in practice, holding down the arrow keys and hitting different directions causes the character to start teleporting around the map like crazy. I'm not quite sure why this is happening, so my question is twofold:

1) Why is this happening in this way?
2) What are some simple fixes, and why do they work?
It's happening because all you're doing is delaying the ..() which isn't actually going to prevent further queuing of it, which will make all those parent calls happen awkwardly timed out.

You'd want something that prevents movement entirely.

mob
var/tmp/next_move = 0
Move()
if(next_move <= world.realtime)
next_move = (world.realtime + 50)
return ..()
return 0
Thank you. I managed to figure it out eventually before returning to this, but I do appreciate it nevertheless. Now I'm fussing with areas. This probably warrants its own thread, but why on earth do area icons not show up? I try to call a colored, transparent icon_state for an area and nothing happens.
Areas are below turfs by default, you'd need to give it a higher layer.