aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-05-29 12:34:01 +0200
committerorwell96 <orwell@bleipb.de>2018-06-14 17:39:42 +0200
commit521112aced4e06f8fb59c9dfe8d0e082da858eb1 (patch)
tree33fd08516180d22a464471359cd5492e495835a2 /advtrains
parent2a76d4a960aa29621dc8020f84eee241b41e10c0 (diff)
downloadadvtrains-521112aced4e06f8fb59c9dfe8d0e082da858eb1.tar.gz
advtrains-521112aced4e06f8fb59c9dfe8d0e082da858eb1.tar.bz2
advtrains-521112aced4e06f8fb59c9dfe8d0e082da858eb1.zip
add option to show train and wagon id
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/settingtypes.txt7
-rw-r--r--advtrains/wagons.lua5
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