aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/tcb_ts_ui.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-03-15 18:17:18 +0100
committerorwell96 <orwell@bleipb.de>2019-03-15 18:17:18 +0100
commit5738ab46aa5c768b973ef892635fb1642c5f6b9c (patch)
tree73f6c5983c13ba6d4e12e621d6cc92152ff78332 /advtrains_interlocking/tcb_ts_ui.lua
parent1227456d46a5e47fa744c37bbf92e05515a871a2 (diff)
downloadadvtrains-5738ab46aa5c768b973ef892635fb1642c5f6b9c.tar.gz
advtrains-5738ab46aa5c768b973ef892635fb1642c5f6b9c.tar.bz2
advtrains-5738ab46aa5c768b973ef892635fb1642c5f6b9c.zip
Disable-ARS switch in signal and set this when cancelling an ARS route
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rw-r--r--advtrains_interlocking/tcb_ts_ui.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua
index 4427a49..dca50da 100644
--- a/advtrains_interlocking/tcb_ts_ui.lua
+++ b/advtrains_interlocking/tcb_ts_ui.lua
@@ -605,12 +605,22 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
if hasprivs then
form = form.."button[3.5,7;2,1;editroute;Edit]"
end
+ else
+ if tcbs.ars_disabled then
+ form = form.."label[0.5,6 ;NOTE: ARS is disabled.]"
+ form = form.."label[0.5,6.5;Routes are not automatically set.]"
+ end
end
if hasprivs then
form = form.."button[0.5,8;2.5,1;newroute;New Route]"
form = form.."button[ 3,8;2.5,1;unassign;Unassign Signal]"
form = form.."button[ 3,9;2.5,1;influp;Influence Point]"
end
+ if tcbs.ars_disabled then
+ form = form.."button[0.5,9;2.5,1;arsenable;Enable ARS]"
+ else
+ form = form.."button[0.5,9;2.5,1;arsdisable;Disable ARS]"
+ end
elseif sigd_equal(tcbs.route_origin, sigd) then
-- something has gone wrong: tcbs.routeset should have been set...
form = form.."label[0.5,2.5;Inconsistent state: route_origin is same TCBS but no route set. Try again.]"
@@ -672,6 +682,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
tcbs.signal_name = fields.name
end
if tcbs.routeset and fields.cancelroute then
+ if tcbs.routes[tcbs.routeset] and tcbs.routes[tcbs.routeset].ars then
+ tcbs.ars_disabled = true
+ end
-- if route committed, cancel route ts info
ilrs.update_route(sigd, tcbs, nil, true)
end
@@ -720,6 +733,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
+ if tcbs.ars_disabled and fields.arsenable then
+ tcbs.ars_disabled = nil
+ end
+ if not tcbs.ars_disabled and fields.arsdisable then
+ tcbs.ars_disabled = true
+ end
+
if fields.auto then
tcbs.route_auto = true
end