aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlemon-melon <lemon-melon@users.noreply.github.com>2017-07-15 16:04:08 +0100
committerGitHub <noreply@github.com>2017-07-15 16:04:08 +0100
commitc184c00f269a612a20a1f167148969fa2c8bcf81 (patch)
treed76dcadc8fd0daf99e5fd184587feaa8ac00f454
parentefc319f87737ed4db13db9e8373cb3406414cdfb (diff)
downloadadvtrains-c184c00f269a612a20a1f167148969fa2c8bcf81.tar.gz
advtrains-c184c00f269a612a20a1f167148969fa2c8bcf81.tar.bz2
advtrains-c184c00f269a612a20a1f167148969fa2c8bcf81.zip
Add speed as number in km/h to train hud
-rw-r--r--advtrains/advtrains/trainhud.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/advtrains/advtrains/trainhud.lua b/advtrains/advtrains/trainhud.lua
index 967acfc..91f54ae 100644
--- a/advtrains/advtrains/trainhud.lua
+++ b/advtrains/advtrains/trainhud.lua
@@ -115,11 +115,13 @@ function advtrains.hud_train_format(train, flip)
local max=train.max_speed or 10
local vel=advtrains.abs_ceil(train.velocity)
local tvel=advtrains.abs_ceil(train.tarvelocity)
+ local vel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.velocity))
+ local tvel_kmh=advtrains.abs_ceil(advtrains.ms_to_kmh(train.tarvelocity))
local topLine, firstLine, secondLine
topLine=" ["..mletter[fct*train.movedir].."] "..doorstr[(train.door_open or 0) * train.movedir].." "..(train.brake and "="..( train.brake_hold_state==2 and "^" or "" ).."B=" or "")
- firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel)..">"
- secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">"
+ firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel).."> "..vel_kmh.." km/h"
+ secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel).."> "..tvel_kmh.." km/h"
return topLine.."\n"..firstLine.."\n"..secondLine
end