add option to show train and wagon id

master
orwell96 2018-05-29 12:34:01 +02:00
parent 2a76d4a960
commit 521112aced
2 changed files with 8 additions and 4 deletions

View File

@ -1,7 +1,6 @@
# Disable the train collision behavior. Trains will never collide and just drive through each other.
# Note that this makes coupling trains impossible, and introduces 'interesting' behavior with detector and ATC rails.
# Also, it is very hard to separate two subway trains that are stuck inside each other, since it can be impossible to access the driver seat.
advtrains_disable_collisions (Disable train collisions) bool false
# Display train and wagon ID in the infotext of trains.
# Useful when working with LuaATC or while debugging.
advtrains_show_ids (Show ID's in infotext) bool false
# Enable the debug ring buffer
# This has no effect on the user experience, except decreased performance. Debug outputs are saved in a ring buffer to be printed when an error occurs.
# You probably want to leave this setting set to false.

View File

@ -11,6 +11,8 @@ advtrains.wagons = {}
advtrains.wagon_prototypes = {}
advtrains.wagon_objects = {}
local setting_show_ids = minetest.settings:get_bool("advtrains_show_ids")
--
function advtrains.create_wagon(wtype, owner)
local new_id=advtrains.random_id()
@ -285,6 +287,9 @@ function wagon:on_step(dtime)
--check infotext
local outside=self:train().text_outside or ""
if setting_show_ids then
outside = outside .. "\nT:" .. data.train_id .. " W:" .. self.id
end
local train=self:train()
--show off-track information in outside text instead of notifying the whole server about this