path
parent_type=/turf
var
Skid // A variable not really related to this problem
Entered(mob/M)
if(!ismob(M)) return
if(!M.client) return
if(M.isriding&&M.auto) // If the MOB is in a vehicle, and auto acceleration is on do the next bit...
if(!Skid) // check if the turf does not have SKID set...
if(M.reverse) // If the mob's reverse is set do this...
walk(M,0) // stop any current movement
sleep(M.speed) // wait as long as speed is set (which is always 1,2 or 3)
M.Move(get_step(M, src.dir), M.reverse) // move them in the direction of the turf, but point them in the direction of M.reverse.
else walk(M,dir,M.speed) // otherwise just push them in the direction of the path.
client/South() // when i press SOUTH...
if(!usr.MoveLkd) // if they have not had their movement locked...
if(usr.isriding) // and if they are in a vehicle
if(istype(usr.loc, /path)&&usr.auto) // if they are auto accelerating and on the special path turf...
if(usr.dir==EAST||usr.dir==WEST) // if they are facing EAST or WEST only..
usr.Move(get_step(usr, SOUTH), usr.dir) // move them SOUTH but keep them pointing the way they were.
Problem description:
M.reverse is set by a verb, which makes it the opposite of the users current direction.
When they are on the track above (path/) if reverse is set it makes them drive forwards while facing backwards.
The reverse appears to work ok *except* when it meets my lane change (see the client/South() example).
When the mob is on special turf and auto accelerating, and i press SOUTH, it will nudge me down 1 tile. Giving the effect of changing lanes. What happens while im 'reversing' is it still works, but my speed increases. It increases again on top of that the more i do it. I end up flying off to the end of the map if i do it too much.
Obviously i dont want it to do this. I want it to keep M.speed which is either set in walk, or with sleep(). I'm not sure why its acting like this. I have tried tinkering to fix it but nothing worked so far.
Would appreciate some help if anyone glances and can see something up. Ta.
I can't figure out why pressing North/South which calls..
usr.Move(get_step(usr, NORTH), usr.dir) // I pushed UP on my keyboard, while in the path/ turf.
and then Entered() in the turf does...
Makes me move at double the speed! walk(M,0) should stop all movement right? So its not like its 'doubling' the Move(). Confused.
I tried adding walk(usr,0) to first code sample. Just incase. No affect.
EDIT:
I was worried it might be doing Entered() twice. So i set a variable so that Entered() would return if it was set. I set it to 1 on Entered() and then 0 on Exited(). Anyway it still doubled my speed... :/ I tried replacing "usr.Move(get_step(usr, NORTH), usr.dir)" with step() and still resulted in the double speed thing.
This ONLY happens when it calls M.Move(). If it uses the walk() part of the code above then the lane switching works as expected.
Really scratching my head on this.