From 816245588d62e3364b974be07989298887c45cfe Mon Sep 17 00:00:00 2001 From: orwell96 Date: Wed, 11 Dec 2019 12:25:08 +0100 Subject: Disable ARS train flag and surrounding uses --- advtrains_luaautomation/README.txt | 5 +++++ advtrains_luaautomation/atc_rail.lua | 7 +++++++ advtrains_luaautomation/passive_api.txt | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'advtrains_luaautomation') diff --git a/advtrains_luaautomation/README.txt b/advtrains_luaautomation/README.txt index b565360..3e9a257 100644 --- a/advtrains_luaautomation/README.txt +++ b/advtrains_luaautomation/README.txt @@ -245,6 +245,11 @@ unset_autocouple() set_shunt(), unset_shunt() deprecated aliases for set_autocouple() and unset_autocouple(), will be removed from a later release. +-- This additional function is available when advtrains_interlocking is enabled: -- + +atc_set_disable_ars(true) + Disables (true) or enables (false) the use of ARS for this train. The train will not trigger ARS (automatic route setting) on signals then. + # Approach callbacks The LuaATC interface provides a way to hook into the approach callback system, which is for example used in the TSR rails (provided by advtrains_interlocking) or the station tracks (provided by advtrains_lines). However, for compatibility reasons, this behavior needs to be explicitly enabled. diff --git a/advtrains_luaautomation/atc_rail.lua b/advtrains_luaautomation/atc_rail.lua index 33b5d00..0f5a7dc 100644 --- a/advtrains_luaautomation/atc_rail.lua +++ b/advtrains_luaautomation/atc_rail.lua @@ -153,6 +153,7 @@ function r.fire_event(pos, evtdata, appr_internal) if not appr_internal then error("atc_set_lzb_tsr() can only be used during 'approach' events!") end + assert(tonumber(speed), "Number expected!") local index = appr_internal.index advtrains.lzb_add_checkpoint(train, index, speed, nil) @@ -160,6 +161,12 @@ function r.fire_event(pos, evtdata, appr_internal) return true end, } + -- interlocking specific + if advtrains.interlocking then + customfct.atc_set_ars_disable = function(value) + advtrains.interlocking.ars_set_disable(train, value) + end + end atlatc.active.run_in_env(pos, evtdata, customfct) diff --git a/advtrains_luaautomation/passive_api.txt b/advtrains_luaautomation/passive_api.txt index 9852e94..5ae1df4 100644 --- a/advtrains_luaautomation/passive_api.txt +++ b/advtrains_luaautomation/passive_api.txt @@ -7,7 +7,7 @@ Displays Mesecon Transmitter Those passive components can also be used inside interlocking systems. -All passive components have a table called 'advtrains' in their node definition and have the group 'save_in_nodedb' set, so they work in unloaded chunks. +All passive components have a table called 'advtrains' in their node definition and have the group 'save_in_at_nodedb' set, so they work in unloaded chunks. Example for a switch: advtrains = { getstate = function(pos, node) -- cgit v1.2.3