diff options
-rw-r--r-- | advtrains/settingtypes.txt | 7 | ||||
-rw-r--r-- | advtrains/wagons.lua | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/advtrains/settingtypes.txt b/advtrains/settingtypes.txt index 3b4863d..1c4974f 100644 --- a/advtrains/settingtypes.txt +++ b/advtrains/settingtypes.txt @@ -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. diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 5a2fffb..87fb7e7 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -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
|