aboutsummaryrefslogtreecommitdiff
path: root/advtrains_signals_ks
diff options
context:
space:
mode:
authorY. Wang <y5nw@protonmail.com>2024-04-22 18:55:40 +0200
committerY. Wang <y5nw@protonmail.com>2024-04-22 18:55:40 +0200
commite47fe6f8cf86d216185d74dd07484486780c03ae (patch)
treee333611ea115a35949c5b77c64d7a9f3a1c81b2c /advtrains_signals_ks
parent5695a3e9ee457d8b0aa9ba03e7d73803d972a156 (diff)
downloadadvtrains-e47fe6f8cf86d216185d74dd07484486780c03ae.tar.gz
advtrains-e47fe6f8cf86d216185d74dd07484486780c03ae.tar.bz2
advtrains-e47fe6f8cf86d216185d74dd07484486780c03ae.zip
Set Zs3v only if upcoming speed limit is stricternew-ks
Diffstat (limited to 'advtrains_signals_ks')
-rwxr-xr-xadvtrains_signals_ks/init.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/advtrains_signals_ks/init.lua b/advtrains_signals_ks/init.lua
index 7e285ae..ff65697 100755
--- a/advtrains_signals_ks/init.lua
+++ b/advtrains_signals_ks/init.lua
@@ -60,14 +60,16 @@ local setaspectf = function(rot)
end
setzs3v(pos, nil, rot)
else
- if not asp.dst or asp.dst == -1 then
+ local dst = asp.dst
+ if not dst or dst == -1 or advtrains.speed.not_lessp(dst, asp.main) then
advtrains.ndb.swap_node(pos, {name="advtrains_signals_ks:hs_free_"..rot, param2 = node.param2})
- elseif asp.dst == 0 then
+ dst = -1
+ elseif dst == 0 then
advtrains.ndb.swap_node(pos, {name="advtrains_signals_ks:hs_slow_"..rot, param2 = node.param2})
else
advtrains.ndb.swap_node(pos, {name="advtrains_signals_ks:hs_nextslow_"..rot, param2 = node.param2})
end
- setzs3v(pos, asp.dst, rot)
+ setzs3v(pos, dst, rot)
end
end
end