diff options
author | orwell96 <orwell@bleipb.de> | 2018-10-17 19:10:37 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-10-17 19:10:37 +0200 |
commit | 267ce6fe6da5c8a59c6ccdbb86b0c66d4398e098 (patch) | |
tree | ed4a949eee4339e52a6ffaacf2cb170f41524321 /advtrains/trainhud.lua | |
parent | b4534c6f1268c48107b6aa0ec6e8b7960c11075a (diff) | |
download | advtrains-267ce6fe6da5c8a59c6ccdbb86b0c66d4398e098.tar.gz advtrains-267ce6fe6da5c8a59c6ccdbb86b0c66d4398e098.tar.bz2 advtrains-267ce6fe6da5c8a59c6ccdbb86b0c66d4398e098.zip |
Prevent any user control except "Brake" when an ATC override is present
Solves the problem of accidentally breaking atc-driven trains
Diffstat (limited to 'advtrains/trainhud.lua')
-rw-r--r-- | advtrains/trainhud.lua | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua index 6332c47..0175410 100644 --- a/advtrains/trainhud.lua +++ b/advtrains/trainhud.lua @@ -26,7 +26,7 @@ function advtrains.on_control_change(pc, train, flip) if pc.right then train.tarvelocity = 8 end - if pc.jump then + --[[if pc.jump then train.brake = true --0: released, 1: brake and pressed, 2: released and brake, 3: pressed and brake if not train.brake_hold_state or train.brake_hold_state==0 then @@ -39,18 +39,22 @@ function advtrains.on_control_change(pc, train, flip) elseif train.brake_hold_state==3 then train.brake = false train.brake_hold_state = 0 - end + end]] --shift+use:see wagons.lua else local act=false - if pc.up then - train.ctrl.user=4 - act=true - end if pc.jump then train.ctrl.user = 1 act=true end + -- If atc command set, only "Jump" key can clear command. To prevent accidental control. + if train.tarvelocity or train.atc_command then + return + end + if pc.up then + train.ctrl.user=4 + act=true + end if pc.down then if train.velocity>0 then if pc.jump then @@ -81,9 +85,6 @@ function advtrains.on_control_change(pc, train, flip) if not act then train.ctrl.user = nil end - if pc.aux1 then - --horn - end end end function advtrains.update_driver_hud(pname, train, flip) |