aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel PĂ©rez-Cerezo <gabriel@gpcf.eu>2017-08-01 13:45:05 +0200
committerorwell96 <orwell@bleipb.de>2017-08-15 14:35:41 +0200
commitc894dee7ef8e43ddca1965e57b5d746b83f4e5b4 (patch)
tree347fa1dbcb03933db8ce7c093f38d0e412f5dc04
parenta34ff7664af45864151d55bd41e2031b322affe2 (diff)
downloadadvtrains-c894dee7ef8e43ddca1965e57b5d746b83f4e5b4.tar.gz
advtrains-c894dee7ef8e43ddca1965e57b5d746b83f4e5b4.tar.bz2
advtrains-c894dee7ef8e43ddca1965e57b5d746b83f4e5b4.zip
Fixed #86
-rw-r--r--advtrains/advtrains/trainhud.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/advtrains/advtrains/trainhud.lua b/advtrains/advtrains/trainhud.lua
index 967acfc..591881a 100644
--- a/advtrains/advtrains/trainhud.lua
+++ b/advtrains/advtrains/trainhud.lua
@@ -10,9 +10,10 @@ local mletter={[1]="F", [-1]="R", [0]="N"}
local doorstr={[-1]="|<>| >|<", [0]=">|< >|<", [1]=">|< |<>|"}
function advtrains.on_control_change(pc, train, flip)
+ local maxspeed = train.max_speed or 10
if pc.sneak then
if pc.up then
- train.tarvelocity = train.max_speed or 10
+ train.tarvelocity = maxspeed
end
if pc.down then
train.tarvelocity = 0
@@ -40,7 +41,7 @@ function advtrains.on_control_change(pc, train, flip)
--shift+use:see wagons.lua
else
if pc.up then
- train.tarvelocity = train.tarvelocity + 1
+ train.tarvelocity = math.min(train.tarvelocity + 1, maxspeed)
end
if pc.down then
if train.velocity>0 then