aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
authorBlockhead <jbis1337@hotmail.com>2020-07-07 18:19:56 +1000
committerGabriel PĂ©rez-Cerezo <gabriel@gpcf.eu>2020-07-10 22:14:39 +0200
commitad49854fed1ccd426db5ab43d6734856a6b0bc74 (patch)
tree406e9d4cf4d1ac1c06b7ec431c4d70a0e1d70ec6 /advtrains_interlocking
parent74bf177cc850164a0a6c13a634e7da6410f9f73a (diff)
downloadadvtrains-ad49854fed1ccd426db5ab43d6734856a6b0bc74.tar.gz
advtrains-ad49854fed1ccd426db5ab43d6734856a6b0bc74.tar.bz2
advtrains-ad49854fed1ccd426db5ab43d6734856a6b0bc74.zip
Make using the default tracks optional, even in submods
If advtrains_train_track is disabled, don't register any tracks that use its model like the LuaATC automation rail, point speed restriction rail, station/stop rail. For LuaATC, the definition for firing an event when a train runs over the rail needs to be moved into the common defs so that other mods like linetrack can use that as an interface.
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/depends.txt3
-rw-r--r--advtrains_interlocking/tsr_rail.lua23
2 files changed, 14 insertions, 12 deletions
diff --git a/advtrains_interlocking/depends.txt b/advtrains_interlocking/depends.txt
index 6f00bf6..fdf6b17 100644
--- a/advtrains_interlocking/depends.txt
+++ b/advtrains_interlocking/depends.txt
@@ -1 +1,2 @@
-advtrains \ No newline at end of file
+advtrains
+advtrains_train_track? \ No newline at end of file
diff --git a/advtrains_interlocking/tsr_rail.lua b/advtrains_interlocking/tsr_rail.lua
index 89da290..a500c8f 100644
--- a/advtrains_interlocking/tsr_rail.lua
+++ b/advtrains_interlocking/tsr_rail.lua
@@ -42,14 +42,15 @@ local adefunc = function(def, preset, suffix, rotation)
end
-
-advtrains.register_tracks("default", {
- nodename_prefix="advtrains_interlocking:dtrack_npr",
- texture_prefix="advtrains_dtrack_npr",
- models_prefix="advtrains_dtrack",
- models_suffix=".b3d",
- shared_texture="advtrains_dtrack_shared_npr.png",
- description="Point Speed Restriction Rail",
- formats={},
- get_additional_definiton = adefunc,
-}, advtrains.trackpresets.t_30deg_straightonly)
+if minetest.get_modpath("advtrains_train_track") ~= nil then
+ advtrains.register_tracks("default", {
+ nodename_prefix="advtrains_interlocking:dtrack_npr",
+ texture_prefix="advtrains_dtrack_npr",
+ models_prefix="advtrains_dtrack",
+ models_suffix=".b3d",
+ shared_texture="advtrains_dtrack_shared_npr.png",
+ description="Point Speed Restriction Rail",
+ formats={},
+ get_additional_definiton = adefunc,
+ }, advtrains.trackpresets.t_30deg_straightonly)
+end \ No newline at end of file