aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainhud.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2023-06-02 15:17:14 +0200
committergpcf <gpcf@gpcf.eu>2024-08-08 22:48:23 +0200
commite9aad541ccab298b3d9604441bccc05d775bce3a (patch)
tree37f68f0449aa245639b9f8e4e13b480fec887c1e /advtrains/trainhud.lua
parent0bfc7bbe099c7bba20cf1194b3ffad9471d0c7a4 (diff)
downloadadvtrains-e9aad541ccab298b3d9604441bccc05d775bce3a.tar.gz
advtrains-e9aad541ccab298b3d9604441bccc05d775bce3a.tar.bz2
advtrains-e9aad541ccab298b3d9604441bccc05d775bce3a.zip
Fix incorrect speed indicator; include routing info in text HUD
Diffstat (limited to 'advtrains/trainhud.lua')
-rw-r--r--advtrains/trainhud.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index b8eb512..b2744ad 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -225,6 +225,18 @@ function advtrains.hud_train_format(train, flip)
if lzb and lzb.checkpoints then
local oc = lzb.checkpoints
for i = 1, #oc do
+ if advtrains.interlocking then
+ local udata = oc[i].udata
+ if udata and udata.signal_pos then
+ local sigd = advtrains.interlocking.db.get_sigd_for_signal(udata.signal_pos)
+ if sigd then
+ local tcbs = advtrains.interlocking.db.get_tcbs(sigd) or {}
+ if tcbs.route_rsn then
+ table.insert(st, ("%s: %s"):format(minetest.pos_to_string(sigd.p), tcbs.route_rsn))
+ end
+ end
+ end
+ end
local spd = oc[i].speed
spd = advtrains.speed.min(spd, train.speed_restriction)
if spd == -1 then spd = nil end