// Special Movement procs for variable speed //
ResetMove()
src.InertialD = null
src.StepCounter = 0
src.StepDelay = src.BaseStepDelay
src.StepsResetting = 0
return
DetectStep(DIR)
var/baseconstant = 0.5
if(src.InertialD != DIR)
src.InertialD = DIR
src.StepCounter = (1 / (baseconstant * src.Speed.Current)) ; src.StepDelay = src.BaseStepDelay
step(src, DIR, src.step_size * src.StepCounter)
spawn(0) src.StepReset()
return
src.StepCounter += (1 / (baseconstant * src.Speed.Current))
if(src.StepCounter < 1)
step(src, DIR, src.step_size * src.StepCounter)
else
step(src, DIR)
src.StepDelay = src.BaseStepDelay
if(!src.StepsResetting)
src.StepsResetting = 1
spawn(0) src.StepReset()
else return
StepReset()
while(src.StepDelay && src.StepsResetting)
sleep(1)
src.StepDelay --
src.StepCounter = 0 ; src.StepDelay = src.BaseStepDelay
src.StepsResetting = 0
// End Special Movement procs //
Problem description:
I keep coming across weird random skips. I did a few test procs to make sure StepDelay was being changed properly, and it is. I am testing it by pressing the up button on the keyboard for movement. This would call North() which called DetectStep(NORTH). I think it's StepReset() completing when it shouldn't be. There seems to be maybe some kind of call limit(?) to North, which makes it stop getting called which allows StepReset to complete.