aboutsummaryrefslogtreecommitdiff
path: root/advtrains/wagons.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2017-12-18 23:20:29 +0100
committerorwell96 <orwell@bleipb.de>2017-12-18 23:20:29 +0100
commit09838252fe11672d89eb00d1da13b15a293ad230 (patch)
treef081504a9a6208541834759572ddf1a4a8b64b3c /advtrains/wagons.lua
parent46c4447da089146c662f217bf3269d78d4c462c2 (diff)
downloadadvtrains-09838252fe11672d89eb00d1da13b15a293ad230.tar.gz
advtrains-09838252fe11672d89eb00d1da13b15a293ad230.tar.bz2
advtrains-09838252fe11672d89eb00d1da13b15a293ad230.zip
Do not spam the server chat with messages from /at_sync_ndb and trains going off_track
The off-track warning has moved into the info text of wagons
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