Route Formspec: When cancelling route, disable ARS only temporarily, not permanently
parent
4e80866ca6
commit
75025b13ca
|
@ -133,9 +133,11 @@ function advtrains.interlocking.ars_check(sigd, train)
|
||||||
local tcbs = il.db.get_tcbs(sigd)
|
local tcbs = il.db.get_tcbs(sigd)
|
||||||
if not tcbs or not tcbs.routes then return end
|
if not tcbs or not tcbs.routes then return end
|
||||||
|
|
||||||
if tcbs.ars_disabled then
|
if tcbs.ars_disabled or tcbs.ars_ignore_next then
|
||||||
-- No-ARS mode of signal.
|
-- No-ARS mode of signal.
|
||||||
-- ignore...
|
-- ignore...
|
||||||
|
-- Note: ars_ignore_next is set by signalling formspec when route is cancelled
|
||||||
|
tcbs.ars_ignore_next = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -723,11 +723,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
connid = tonumber(connids)
|
connid = tonumber(connids)
|
||||||
if not connid or connid<1 or connid>2 then return end
|
if not connid or connid<1 or connid>2 then return end
|
||||||
end
|
end
|
||||||
if pos and connid and not fields.quit then
|
if pos and connid then
|
||||||
local sigd = {p=pos, s=connid}
|
local sigd = {p=pos, s=connid}
|
||||||
local tcbs = ildb.get_tcbs(sigd)
|
local tcbs = ildb.get_tcbs(sigd)
|
||||||
if not tcbs then return end
|
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
|
local sel_rte
|
||||||
if fields.rtelist then
|
if fields.rtelist then
|
||||||
local tev = minetest.explode_textlist_event(fields.rtelist)
|
local tev = minetest.explode_textlist_event(fields.rtelist)
|
||||||
|
@ -740,7 +746,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
if tcbs.routeset and fields.cancelroute then
|
if tcbs.routeset and fields.cancelroute then
|
||||||
if tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].ars then
|
if tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].ars then
|
||||||
tcbs.ars_disabled = true
|
tcbs.ars_ignore_next = true
|
||||||
end
|
end
|
||||||
-- if route committed, cancel route ts info
|
-- if route committed, cancel route ts info
|
||||||
ilrs.update_route(sigd, tcbs, nil, true)
|
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
|
if fields.newroute and hasprivs then
|
||||||
advtrains.interlocking.init_route_prog(pname, sigd)
|
advtrains.interlocking.init_route_prog(pname, sigd)
|
||||||
minetest.close_formspec(pname, formname)
|
minetest.close_formspec(pname, formname)
|
||||||
|
tcbs.ars_ignore_next = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if sel_rte and tcbs.routes[sel_rte] then
|
if sel_rte and tcbs.routes[sel_rte] then
|
||||||
|
|
Loading…
Reference in New Issue