Make train HUD check for existing speed restrictions

This commit is contained in:
ywang 2021-11-07 14:06:50 +01:00
parent d46f4b9f67
commit 3c92fa597c
1 changed files with 2 additions and 0 deletions

View File

@ -281,6 +281,8 @@ function advtrains.hud_train_format(train, flip)
local oc = lzb.checkpoints local oc = lzb.checkpoints
for i = 1, #oc do for i = 1, #oc do
local spd = oc[i].speed local spd = oc[i].speed
spd = advtrains.speed.min(spd, train.speed_restriction)
if spd == -1 then spd = nil end
local c = not spd and "lime" or (type(spd) == "number" and (spd == 0) and "red" or "orange") or nil local c = not spd and "lime" or (type(spd) == "number" and (spd == 0) and "red" or "orange") or nil
if c then if c then
ht[#ht+1] = sformat("130,10=(advtrains_hud_bg.png^[resize\\:30x5^[colorize\\:%s)",c) ht[#ht+1] = sformat("130,10=(advtrains_hud_bg.png^[resize\\:30x5^[colorize\\:%s)",c)