aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-06-19 10:41:10 +0200
committerorwell96 <orwell@bleipb.de>2019-06-19 10:41:10 +0200
commit663adca34ee00671452e997dce204bcab314060c (patch)
tree7a0b7d1c6e5a0083105a841692799e9c8eeb2e6b
parent57175b5532a37577cd1bfc590dbaeab2d5b9fabe (diff)
downloadposhud-663adca34ee00671452e997dce204bcab314060c.zip
poshud-663adca34ee00671452e997dce204bcab314060c.tar.gz
poshud-663adca34ee00671452e997dce204bcab314060c.tar.bz2
Display advtrains railway time if available, fix star
-rw-r--r--init.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 9be0b2e..d2f465f 100644
--- a/init.lua
+++ b/init.lua
@@ -152,6 +152,8 @@ local h_text = "Initializing..."
local h_int = 2
local h_tmr = 0
+local starc = 0
+
minetest.register_globalstep(function (dtime)
-- make a lag sample
@@ -190,12 +192,18 @@ minetest.register_globalstep(function (dtime)
local s_lag = string.format("Lag: %.2f avg: %.2f peak: %.2f", news, l_avg, l_max)
local s_time = "Time: "..get_time()
+ local s_rwt = ""
+ if advtrains.lines and advtrains.lines.rwt then
+ s_rwt = "\nRailway Time: "..advtrains.lines.rwt.to_string(advtrains.lines.rwt.now(), true)
+ end
+
local s_star = ""
if enable_star then
- s_star = star[(l_ctr % 4)+1]
+ s_star = star[starc+1]
+ starc = (starc + 1) % 4
end
- h_text = s_time .. " " .. s_star .. "\n" .. s_lag
+ h_text = s_time .. " " .. s_star .. s_rwt .. "\n" .. s_lag
h_tmr = h_int
else