ID:169053
 
How would I make it so if someone moves like pressing right itll continue going right untill it hits something or theres a direction change.
Dude..Um, check the Libraries and Demos, I think I saw something on this.
*THINK* No Garantees.
You could try something like this:
client
Move()
.=..()
if(.)
src.mob.KeepMoving()

mob
var
unhindered=1
kp

proc
KeepMoving()
src.kp++
while(unhindered)
sleep(5)
if(kp==1)
var/Loc=src.loc
step(src,src.dir)
if(Loc==src.loc) src.unhindered=0
else
src.kp--
return
if(src.kp==1)
src.unhindered=1
src.kp--
else
src.kp--
return


I put the movable check in, because if they moved again while they were already automatically moving, it'd be running two KeepMoving()s.

You could also stop the moving in Bump(), but then it wouldn't take hitting the edge of the map into account.

<edit> I just realized I failed to take moving a different way into account, I'll work on that in a second.
<edit> Ok, it's fixed. I dunno if this is efficient, but it works.

<edit> Here's another way you could do it, keeping the movable var:
client
North()
if(!src.mob.movable) src.mob.dir=NORTH
..()
South()
if(!src.mob.movable) src.mob.dir=SOUTH
..()
East()
if(!src.mob.movable) src.mob.dir=EAST
..()
West()
if(!src.mob.movable) src.mob.dir=WEST
..()
Move()
if(!src.mob.movable) return 0
.=..()
if(.)
world<<"Bwah"
src.mob.KeepMoving()

mob
var
unhindered=1
movable=1

proc
KeepMoving()
src.movable=0
while(src.unhindered)
sleep(5)
var/Loc=src.loc
step(src,src.dir)
if(Loc==src.loc) src.unhindered=0
src.unhindered=1
src.movable=1
Look up client/East+West+North+South() (thats 4 different procs by the way) and mess around there.
In response to DeathAwaitsU
I think you mean East() and West() there? =P
In response to Artekia
Oh yeah -_-
In response to DeathAwaitsU
Would you happen to know if my way of doing it is an efficient way? Just wondering out of curiosity.
In response to Artekia
Yeah in my opinion it is efficient, but I'm not sure it's the most robust. I myself can't provide a more robust one but someone else probably can.
In response to DeathAwaitsU