diff options
author | Y. Wang <y5nw@protonmail.com> | 2024-04-22 18:55:40 +0200 |
---|---|---|
committer | Y. Wang <y5nw@protonmail.com> | 2024-04-22 18:55:40 +0200 |
commit | e47fe6f8cf86d216185d74dd07484486780c03ae (patch) | |
tree | e333611ea115a35949c5b77c64d7a9f3a1c81b2c /advtrains_signals_ks/init.lua | |
parent | 5695a3e9ee457d8b0aa9ba03e7d73803d972a156 (diff) | |
download | advtrains-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/init.lua')
-rwxr-xr-x | advtrains_signals_ks/init.lua | 8 |
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 |