From ad49854fed1ccd426db5ab43d6734856a6b0bc74 Mon Sep 17 00:00:00 2001 From: Blockhead Date: Tue, 7 Jul 2020 18:19:56 +1000 Subject: 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. --- advtrains_line_automation/stoprail.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'advtrains_line_automation/stoprail.lua') diff --git a/advtrains_line_automation/stoprail.lua b/advtrains_line_automation/stoprail.lua index 0990876..ee8faac 100644 --- a/advtrains_line_automation/stoprail.lua +++ b/advtrains_line_automation/stoprail.lua @@ -204,14 +204,15 @@ local adefunc = function(def, preset, suffix, rotation) } end - -advtrains.register_tracks("default", { - nodename_prefix="advtrains_line_automation:dtrack_stop", - texture_prefix="advtrains_dtrack_stop", - models_prefix="advtrains_dtrack", - models_suffix=".b3d", - shared_texture="advtrains_dtrack_shared_stop.png", - description="Station/Stop 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_line_automation:dtrack_stop", + texture_prefix="advtrains_dtrack_stop", + models_prefix="advtrains_dtrack", + models_suffix=".b3d", + shared_texture="advtrains_dtrack_shared_stop.png", + description="Station/Stop Rail", + formats={}, + get_additional_definiton = adefunc, + }, advtrains.trackpresets.t_30deg_straightonly) +end \ No newline at end of file -- cgit v1.2.3