aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/routesetting.lua
diff options
context:
space:
mode:
authororwell <orwell@bleipb.de>2024-07-20 21:04:17 +0200
committerorwell <orwell@bleipb.de>2024-07-20 21:04:17 +0200
commit69e4b8f99aac08c404a733c2338f9de9cddab829 (patch)
tree801ab60e5c89a1f410b3466821b847ee19495940 /advtrains_interlocking/routesetting.lua
parentbaa50c03920fd0a563fce09929f3d56c3374e8bd (diff)
downloadadvtrains-69e4b8f99aac08c404a733c2338f9de9cddab829.tar.gz
advtrains-69e4b8f99aac08c404a733c2338f9de9cddab829.tar.bz2
advtrains-69e4b8f99aac08c404a733c2338f9de9cddab829.zip
Support signal aspect selection for routes again
Diffstat (limited to 'advtrains_interlocking/routesetting.lua')
-rw-r--r--advtrains_interlocking/routesetting.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 34a273a..0207519 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -147,7 +147,7 @@ function ilrs.set_route(signal, route, try)
tcbs_ref = c_tcbs,
role = ndef and ndef.advtrains and ndef.advtrains.route_role,
masp_override = c_rseg.masp_override, --TODO implement masp_override on UI side
- dst_type = "next_main", --TODO allow user differentiate
+ assign_dst = (i~=1) or route.assign_dst -- Behavior: for first signal assign depending on route.assign_dst, all others always assign
}
signals[#signals+1] = sig_table
end
@@ -171,10 +171,18 @@ function ilrs.set_route(signal, route, try)
-- note the signals are iterated backwards. Switch depending on the role
local sig = signals[i]
-- apply mainaspect
- sig.tcbs_ref.route_aspect = sig.masp_override or "_default"
+ sig.tcbs_ref.route_aspect = sig.masp_override or route.main_aspect or "_default"
if sig.role == "distant" or sig.role == "distant_repeater" or sig.role == "main_distant" then
- -- assign the remote as the last mainsig
- sig.tcbs_ref.route_remote = last_mainsig
+ if last_mainsig then
+ -- assign the remote as the last mainsig if desired
+ if sig.assign_dst then
+ sig.tcbs_ref.route_remote = last_mainsig
+ end
+ -- if it wasn't a distant_repeater clear the mainsig
+ if sig.role ~= "distant_repeater" then
+ last_mainsig = false
+ end
+ end
end
if sig.role == "main" or sig.role == "main_distant" or sig.role == "end" then
-- record this as the new last mainsig