Add speed as number in km/h to train hud

master
lemon-melon 2017-07-15 16:04:08 +01:00 committed by GitHub
parent efc319f877
commit c184c00f26
1 changed files with 4 additions and 2 deletions

View File

@ -115,11 +115,13 @@ function advtrains.hud_train_format(train, flip)
local max=train.max_speed or 10 local max=train.max_speed or 10
local vel=advtrains.abs_ceil(train.velocity) local vel=advtrains.abs_ceil(train.velocity)
local tvel=advtrains.abs_ceil(train.tarvelocity) 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 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 "") 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)..">" firstLine=attrans("Speed:").." |"..string.rep("+", vel)..string.rep("_", max-vel).."> "..vel_kmh.." km/h"
secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel)..">" secondLine=attrans("Target:").." |"..string.rep("+", tvel)..string.rep("_", max-tvel).."> "..tvel_kmh.." km/h"
return topLine.."\n"..firstLine.."\n"..secondLine return topLine.."\n"..firstLine.."\n"..secondLine
end end