aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainhud.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-10-17 18:58:57 +0200
committerorwell96 <orwell@bleipb.de>2018-10-17 18:58:57 +0200
commitb4534c6f1268c48107b6aa0ec6e8b7960c11075a (patch)
treef26648305e4457dad480239b3131a1a366c6d925 /advtrains/trainhud.lua
parentcd38b17eabb8cdc37bd7e11a89fd0fd049910ffc (diff)
downloadadvtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.tar.gz
advtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.tar.bz2
advtrains-b4534c6f1268c48107b6aa0ec6e8b7960c11075a.zip
Improve ATC-LZB-User control interaction, smoothen LZB control operations
(prevent flickering view when atc battles against lzb)
Diffstat (limited to 'advtrains/trainhud.lua')
-rw-r--r--advtrains/trainhud.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index d880ffc..6332c47 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -61,6 +61,7 @@ function advtrains.on_control_change(pc, train, flip)
act=true
else
advtrains.invert_train(train.id)
+ advtrains.atc.train_reset_command(train)
end
end
if pc.left then
@@ -178,16 +179,21 @@ function advtrains.hud_train_format(train, flip)
local topLine, firstLine
local secondLine
- if train.tarvelocity then
+ if train.tarvelocity or train.atc_command then
local b=" "
- local tvel=advtrains.abs_ceil(train.tarvelocity)
- local tvel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.tarvelocity))
+ local tvels=""
+ if train.tarvelocity then
+ local tvel = advtrains.abs_ceil(train.tarvelocity)
+ tvels = "|"..string.rep("+", tvel)..string.rep("_", max-tvel)
+ end
if train.atc_brake_target then
b="-B-"
end
- secondLine="ATC"..b..": |"..string.rep("+", tvel)..string.rep("_", max-tvel).." > "..tvel_kmh.." km/h"
- elseif train.atc_delay then
- secondLine = "ATC waiting "..advtrains.abs_ceil(train.atc_delay).."s"
+ local ad = ""
+ if train.atc_delay then
+ ad = " "..advtrains.abs_ceil(train.atc_delay).."s "
+ end
+ secondLine="ATC"..b..": "..tvels..ad..(train.atc_command or "")
else
secondLine = "Manual operation"
end