From 135d5fb4d14d1adc889b10886556f16a821d34f4 Mon Sep 17 00:00:00 2001 From: ywang Date: Sun, 1 Aug 2021 17:34:05 +0200 Subject: Fix digital speed indicator; add texture_escape from moretrains --- advtrains/trainhud.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua index 3f7b797..6ba4c49 100644 --- a/advtrains/trainhud.lua +++ b/advtrains/trainhud.lua @@ -178,6 +178,10 @@ Value Disp Control Meaning 4 + W Accelerate ]] +function advtrains.hud.texture_escape(str) + return string.gsub(str, "[%[%()^:]", "\\%1") +end + function advtrains.hud.dtext(train, flip) local st = {} if train.debug then st = {train.debug} end @@ -318,7 +322,7 @@ function advtrains.hud.dgraphical(train, flip) end ht[#ht+1] = advtrains.hud.door(train.door_open, 170, 10, 60, 30, 2) -- speed indications - ht[#ht+1] = advtrains.hud.number(vel, nil, 320, 10, 30, 10, 10, "[colorize\\:red\\:255") + ht[#ht+1] = advtrains.hud.number(vel, 2, 320, 10, 30, 10, 10, "[colorize\\:red\\:255") for i = 1, vel, 1 do ht[#ht+1] = sformat("%d,65=(advtrains_hud_bg.png^[resize\\:8x20^[colorize\\:white)", i*11-1) end -- cgit v1.2.3