diff options
author | orwell <orwell@bleipb.de> | 2025-05-06 00:43:06 +0200 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2025-05-06 00:43:06 +0200 |
commit | adc01a0bba29b40278e45c50caa954c435374f7b (patch) | |
tree | d6bfb5d0329770b9c62431bbc8fec9b7c7f66fd9 /advtrains_interlocking/tcb_ts_ui.lua | |
parent | ed7242c632d63c5d749d3bb9de57c5734b4c5ee1 (diff) | |
download | advtrains-release-2.6.0.tar.gz advtrains-release-2.6.0.tar.bz2 advtrains-release-2.6.0.zip |
Multi-ARS (waiting for multiple routes simultaneously, load-balancing)HEADrelease-2.6.0master
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rwxr-xr-x | advtrains_interlocking/tcb_ts_ui.lua | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 814a11a..0be943a 100755 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -828,14 +828,29 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, calle form = form.."button[5.5,1.2;1,1;setname;Set]" if tcbs.routeset then - local rte = tcbs.routes[tcbs.routeset] - if not rte then - atwarn("Unknown route set from signal!") - tcbs.routeset = nil - return + if type(tcbs.routeset)=="table" then + local rtenames = {} + for midx,rteid in ipairs(tcbs.routeset) do + local rte = tcbs.routes[rteid] + if not rte then + atwarn("Unknown route set from signal!") + tcbs.routeset = nil + return + end + rtenames[midx] = rte.name + end + form = form.."label[0.5,2.5;Multiple routes are requested (first available is set):]" + form = form.."label[0.5,3.0;"..minetest.formspec_escape(table.concat(rtenames,", ")).."]" + else + local rte = tcbs.routes[tcbs.routeset] + if not rte then + atwarn("Unknown route set from signal!") + tcbs.routeset = nil + return + end + form = form.."label[0.5,2.5;A route is requested from this signal:]" + form = form.."label[0.5,3.0;"..minetest.formspec_escape(rte.name).."]" end - form = form.."label[0.5,2.5;A route is requested from this signal:]" - form = form.."label[0.5,3.0;"..minetest.formspec_escape(rte.name).."]" if tcbs.route_committed then form = form.."label[0.5,3.5;Route has been set.]" else @@ -1000,9 +1015,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end if tcbs.routeset and fields.cancelroute then - if tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].ars then - tcbs.ars_ignore_next = true - end + tcbs.ars_ignore_next = true -- if route committed, cancel route ts info ilrs.update_route(sigd, tcbs, nil, true) end |