aboutsummaryrefslogtreecommitdiff
path: root/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'trainlogic.lua')
-rw-r--r--trainlogic.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/trainlogic.lua b/trainlogic.lua
index 6e2b3c8..0291e8f 100644
--- a/trainlogic.lua
+++ b/trainlogic.lua
@@ -318,7 +318,10 @@ function advtrains.train_step(id, train, dtime)
applydiff=(math.min((advtrains.train_brake_force*dtime), math.abs(diff)))
end
end
- train.velocity=train.velocity+(applydiff*math.sign(train.tarvelocity-train.velocity))
+ train.last_accel=(applydiff*math.sign(train.tarvelocity-train.velocity))
+ train.velocity=train.velocity+train.last_accel
+ else
+ train.last_accel=0
end
--move