ID:139494
 
Code:
mob/verb
Pull()
set category = "Staff"
for(var/mob/M in range(src,1))
M.dir = turn(M.dir, 180)
src.dir = turn(src.dir, 360)
M.loc = src.loc


Problem description:
What I've been trying to do is pulling the mob on the top of src. But when the mob is getting pulled on the top of src, his dir should change to the opposite of src's dir. I've been trying a few things, but none of them seems to work..
Raimo wrote:
What I've been trying to do is pulling the mob on the top of src.

You mean any mobs next to (or on the same tile on) the player using the verb, right? That's what your code says, anyway.

But when the mob is getting pulled on the top of src, his dir should change to the opposite of src's dir. I've been trying a few things, but none of them seems to work..

First, you're setting M's dir to the opposite of his own dir. You're saying you want the opposite of src's dir.

Second, you're turning src's dir by 360. That's not going to change anything and therefore has no notable effect; while 180 degrees is half a circle, 360 degrees is a full circle, so when you rotate by 360 degrees, you end up at exactly the same "place" (angle) as you started.
In response to Kaioken
So you're saying that it should be this:
mob/verb
Pull()
set category = "Staff"
for(var/mob/M in range(src,1))
M.dir = turn(src.dir, 180)
M.loc = src.loc


And by this line:
        for(var/mob/M in range(src,1))

I mean, every mob next to the src, counts for diagonal and cardinal.
In response to Raimo
If your wanting every mob in range to look at the character pulling, you will want to use the get_dir() proc to find the direction they should be looking. It makes them look at the user as they move towards it.
In response to SadKat Gaming
Thanks, it's working now. The code I've become:
mob/verb
Pull()
set category = "Staff"
for(var/mob/M in range(src,1))
M.dir = get_dir(M,src)
M.loc = src.loc