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_luaautomation/active_common.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'advtrains_luaautomation/active_common.lua') diff --git a/advtrains_luaautomation/active_common.lua b/advtrains_luaautomation/active_common.lua index 48f75ac..dac81b3 100644 --- a/advtrains_luaautomation/active_common.lua +++ b/advtrains_luaautomation/active_common.lua @@ -165,4 +165,11 @@ if advtrains.lines and advtrains.lines.sched then end) end +ac.trackdef_advtrains_defs = { + on_train_enter = function(pos, train_id) + --do async. Event is fired in train steps + atlatc.interrupt.add(0, pos, {type="train", train=true, id=train_id}) + end, +} + atlatc.active=ac -- cgit v1.2.3