Set Zs3v only if upcoming speed limit is stricter

This commit is contained in:
Y. Wang 2024-04-22 18:55:40 +02:00
parent 5695a3e9ee
commit e47fe6f8cf
No known key found for this signature in database
GPG Key ID: 39EC2419DF97489A
1 changed files with 5 additions and 3 deletions

View File

@ -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