aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-12-11 12:25:08 +0100
committerorwell96 <orwell@bleipb.de>2021-02-10 16:35:45 +0100
commit816245588d62e3364b974be07989298887c45cfe (patch)
treeb4166f07a0396b43d6af7bd41d1295101117d947 /advtrains_luaautomation
parent74a219937dd031743c880510f10571adec0cf8a8 (diff)
downloadadvtrains-816245588d62e3364b974be07989298887c45cfe.tar.gz
advtrains-816245588d62e3364b974be07989298887c45cfe.tar.bz2
advtrains-816245588d62e3364b974be07989298887c45cfe.zip
Disable ARS train flag and surrounding uses
Diffstat (limited to 'advtrains_luaautomation')
-rw-r--r--advtrains_luaautomation/README.txt5
-rw-r--r--advtrains_luaautomation/atc_rail.lua7
-rw-r--r--advtrains_luaautomation/passive_api.txt2
3 files changed, 13 insertions, 1 deletions
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)