diff options
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rwxr-xr-x | advtrains_interlocking/tcb_ts_ui.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 54ffe9b..87e56ca 100755 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -768,6 +768,7 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, calle form = form.."button[0.5,6; 5,1;setroute;Set Route]" form = form.."button[0.5,7;2,1;dsproute;Show]" if hasprivs then + form = form.."button[2.5,7;1,1;setarsdefault;Set Def.]" form = form.."button[3.5,7;2,1;editroute;Edit]" if sel_rte > 1 then form = form .. "button[5.5,4;0.5,0.3;moveup;↑]" @@ -984,6 +985,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) advtrains.interlocking.show_route_edit_form(pname, sigd, sel_rte) return end + if fields.setarsdefault and hasprivs then + for rid, route in ipairs(tcbs.routes) do + local isdefault = rid == sel_rte + if route.ars then + route.ars.default = isdefault + elseif isdefault then + route.ars = {default = true} + end + end + end end end |