aboutsummaryrefslogtreecommitdiff
path: root/advtrains/wagons.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/wagons.lua')
-rw-r--r--advtrains/wagons.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index cc1f003..415665e 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -300,6 +300,15 @@ function wagon:on_step(dtime)
--check infotext
local outside=self:train().text_outside or ""
+
+ local train = self:train()
+ --show off-track information in outside text instead of notifying the whole server about this
+ local front_off_track=train.max_index_on_track and train.index and train.index>train.max_index_on_track
+ local back_off_track=train.min_index_on_track and train.end_index and train.end_index<train.min_index_on_track
+ if front_off_track or back_off_track then
+ outside = outside .."\n!!! Train off track !!!"
+ end
+
if self.infotext_cache~=outside then
self.object:set_properties({infotext=outside})
self.infotext_cache=outside