From c894dee7ef8e43ddca1965e57b5d746b83f4e5b4 Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Tue, 1 Aug 2017 13:45:05 +0200 Subject: Fixed #86 --- advtrains/advtrains/trainhud.lua | 5 +++-- 1 file 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 -- cgit v1.2.3