aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/tcb_ts_ui.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-10-26 20:23:19 +0200
committerorwell96 <orwell@bleipb.de>2021-10-26 20:23:19 +0200
commit75025b13ca3b90c0ed284920ab0f294c54eeb697 (patch)
tree5f19ce613c5f36d8e22b7a2c986b544c2ddceecd /advtrains_interlocking/tcb_ts_ui.lua
parent4e80866ca6156a9fa65e8c8539c0756ee5ae7a50 (diff)
downloadadvtrains-75025b13ca3b90c0ed284920ab0f294c54eeb697.tar.gz
advtrains-75025b13ca3b90c0ed284920ab0f294c54eeb697.tar.bz2
advtrains-75025b13ca3b90c0ed284920ab0f294c54eeb697.zip
Route Formspec: When cancelling route, disable ARS only temporarily, not permanently
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rwxr-xr-xadvtrains_interlocking/tcb_ts_ui.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua
index 34fbf7f..0cc10da 100755
--- a/advtrains_interlocking/tcb_ts_ui.lua
+++ b/advtrains_interlocking/tcb_ts_ui.lua
@@ -723,11 +723,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
connid = tonumber(connids)
if not connid or connid<1 or connid>2 then return end
end
- if pos and connid and not fields.quit then
+ if pos and connid then
local sigd = {p=pos, s=connid}
local tcbs = ildb.get_tcbs(sigd)
if not tcbs then return end
-
+
+ if fields.quit then
+ -- form quit: disable temporary ARS ignore
+ tcbs.ars_ignore_next = nil
+ return
+ end
+
local sel_rte
if fields.rtelist then
local tev = minetest.explode_textlist_event(fields.rtelist)
@@ -740,7 +746,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
if tcbs.routeset and fields.cancelroute then
if tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].ars then
- tcbs.ars_disabled = true
+ tcbs.ars_ignore_next = true
end
-- if route committed, cancel route ts info
ilrs.update_route(sigd, tcbs, nil, true)
@@ -749,6 +755,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.newroute and hasprivs then
advtrains.interlocking.init_route_prog(pname, sigd)
minetest.close_formspec(pname, formname)
+ tcbs.ars_ignore_next = nil
return
end
if sel_rte and tcbs.routes[sel_rte] then