diff options
3 files changed, 9 insertions, 6 deletions
diff --git a/advtrains/api_doc.txt b/advtrains/api_doc.txt
index 30a0358..7da53c6 100644
--- a/advtrains/api_doc.txt
+++ b/advtrains/api_doc.txt
@@ -118,6 +118,8 @@ advtrains.register_wagon(name, prototype, description, inventory_image)
graphical_hud = function(train, flip) end
^- optional: Graphical HUD to show to the driver.
The HUD formats defined by advtrains are used by default.
+ hud_without_text_inside = false
+ ^- optional: whether the inside display should be excluded from the text HUD
custom_on_step = function(self, dtime) end
^- optional: Execute custom code on every step
@@ -153,7 +155,7 @@ If you can't enter or leave a train because the doors are closed, holding the Sn
# Train HUD
The text_hud and graphical_hud fields of the wagons allow you to specify the look of your driver HUDs.
-* The text_hud function should return a string that will be shown to the driver. This should usually include the inside display as well
+* The text_hud function should return a string that will be shown to the driver. Usually this should not include the inside display.
* The graphical_hud function should return a texture string and the height of the texture. This is used to allow proper positioning of the text HUD.
There are currently a few pre-defined elements that can help create the graphical HUD. These functions are in the advtrains.hud table:
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index 3e5e6fd..bb5841f 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -86,11 +86,11 @@ function advtrains.on_control_change(pc, train, flip)
-function advtrains.update_driver_hud(pname, train, flip, thud, ghud)
- local inside=train.text_inside or ""
+function advtrains.update_driver_hud(pname, train, flip, thud, ghud, nointext)
+ local inside=nointext and "" or (train.text_inside or "").."\n"
local ft = (thud or advtrains.hud.dtext)(train, flip)
local ht, gs = (ghud or advtrains.hud.dgraphical)(train, flip)
- advtrains.set_trainhud(pname, inside.."\n"..ft, ht, gs)
+ advtrains.set_trainhud(pname, inside..ft, ht, gs)
function advtrains.clear_driver_hud(pname)
advtrains.set_trainhud(pname, "")
@@ -185,6 +185,7 @@ end
function advtrains.hud.dtext(train, flip)
local st = {}
if train.debug then st = {train.debug} end
+ local res = advtrains.speed_restriction
st[#st+1] = attrans("Train ID: @1", train.id)
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 596c272..b7b88df 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -307,10 +307,10 @@ function wagon:on_step(dtime)
local has_driverstand = pname and advtrains.check_driving_couple_protection(pname, data.owner, data.whitelist)
has_driverstand = has_driverstand and self:is_driver_stand(seat)
if has_driverstand and driver then
- advtrains.update_driver_hud(driver:get_player_name(), self:train(), data.wagon_flipped, self.text_hud, self.graphical_hud)
+ advtrains.update_driver_hud(driver:get_player_name(), self:train(), data.wagon_flipped, self.text_hud, self.graphical_hud, self.hud_without_text_inside)
elseif driver then
--only show the inside text
- local inside=self:train().text_inside or ""
+ local inside=(not self.hud_without_text_inside) and self:train().text_inside or ""
advtrains.set_trainhud(driver:get_player_name(), inside)
if driver and driver:get_player_control_bits()~=self.seatpc[seatno] then