aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorywang <yw05@forksworld.de>2021-11-07 14:06:50 +0100
committerywang <yw05@forksworld.de>2021-11-07 14:06:50 +0100
commit3c92fa597cf5b0baf1ccbcb673e51a205ba6dbdb (patch)
tree2779b1c99a923b6c6caac87318f13c10f761a6a6
parentd46f4b9f675de91027fa93f17bdfd9cdc8d364b3 (diff)
downloadadvtrains-3c92fa597cf5b0baf1ccbcb673e51a205ba6dbdb.tar.gz
advtrains-3c92fa597cf5b0baf1ccbcb673e51a205ba6dbdb.tar.bz2
advtrains-3c92fa597cf5b0baf1ccbcb673e51a205ba6dbdb.zip
Make train HUD check for existing speed restrictions
-rw-r--r--advtrains/trainhud.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index 6e69455..22aa6cf 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -281,6 +281,8 @@ function advtrains.hud_train_format(train, flip)
local oc = lzb.checkpoints
for i = 1, #oc do
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
if c then
ht[#ht+1] = sformat("130,10=(advtrains_hud_bg.png^[resize\\:30x5^[colorize\\:%s)",c)