Fix incorrect speed indicator; include routing info in text HUD
This commit is contained in:
parent
0bfc7bbe09
commit
e9aad541cc
|
@ -125,12 +125,12 @@ local function add_segmentbar(n, self, x, y, w, h, m, c, ...)
|
|||
local bs = ss - m
|
||||
for k = 1, argc, 3 do
|
||||
local lower, upper, fill = argv[k], argv[k+1], argv[k+2]
|
||||
lower = math.max(0, math.floor(lower)+1)
|
||||
lower = math.max(0, math.floor(lower))+1
|
||||
upper = math.min(c, math.floor(upper))
|
||||
if lower < upper then
|
||||
if lower <= upper then
|
||||
local args = {x, y, w, h, fill}
|
||||
args[n+2] = bs
|
||||
args[n] = args[n] + ss*lower
|
||||
args[n] = args[n] + ss*(lower-1)
|
||||
for i = lower, upper do
|
||||
self:add_fill(unpack(args))
|
||||
args[n] = args[n] + ss
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue