aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/tcb_ts_ui.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-01-09 18:03:40 +0100
committerorwell96 <orwell@bleipb.de>2019-01-09 18:03:40 +0100
commita751d1da9c57a40a0df4e8793a1cc46cb7985e12 (patch)
tree2a5a24eb61256e182645a996ecea1496c620ac83 /advtrains_interlocking/tcb_ts_ui.lua
parentc3c96274be0c4beeef62a21f226e830d1d72675a (diff)
downloadadvtrains-a751d1da9c57a40a0df4e8793a1cc46cb7985e12.tar.gz
advtrains-a751d1da9c57a40a0df4e8793a1cc46cb7985e12.tar.bz2
advtrains-a751d1da9c57a40a0df4e8793a1cc46cb7985e12.zip
Add Automatic Routesetting UI
Settings have no effect so far
Diffstat (limited to 'advtrains_interlocking/tcb_ts_ui.lua')
-rw-r--r--advtrains_interlocking/tcb_ts_ui.lua34
1 files changed, 12 insertions, 22 deletions
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua
index c149a44..5ebc0b2 100644
--- a/advtrains_interlocking/tcb_ts_ui.lua
+++ b/advtrains_interlocking/tcb_ts_ui.lua
@@ -568,7 +568,14 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
if not tcbs.route_origin then
local strtab = {}
for idx, route in ipairs(tcbs.routes) do
- strtab[#strtab+1] = minetest.formspec_escape(route.name)
+ local clr = ""
+ if route.ars then
+ clr = "#FF5555"
+ if route.ars.default then
+ clr = "#55FF55"
+ end
+ end
+ strtab[#strtab+1] = clr .. minetest.formspec_escape(route.name)
end
form = form.."label[0.5,2.5;Routes:]"
form = form.."textlist[0.5,3;5,3;rtelist;"..table.concat(strtab, ",").."]"
@@ -576,9 +583,7 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
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;delroute;Delete]"
- form = form.."button[3.5,7;1,1;editroute;Rename]"
- form = form.."button[4.5,7;1,1;asproute;Aspect]"
+ form = form.."button[3.5,7;2,1;editroute;Edit]"
end
end
if hasprivs then
@@ -657,26 +662,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
minetest.after(10, function() advtrains.interlocking.clear_visu_context("disp_"..t) end)
end
if fields.editroute and hasprivs then
- local rte = tcbs.routes[sel_rte]
- minetest.show_formspec(pname, formname.."_renroute_"..sel_rte, "field[name;Enter new route name;"..rte.name.."]")
- return
- end
- if fields.asproute and hasprivs then
- local rte = tcbs.routes[sel_rte]
- local suppasp = advtrains.interlocking.signal_get_supported_aspects(tcbs.signal)
-
- local callback = function(pname, asp)
- rte.aspect = asp
- advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
- end
-
- advtrains.interlocking.show_signal_aspect_selector(pname, suppasp, rte.name, callback, rte.aspect)
+ advtrains.interlocking.show_route_edit_form(pname, sigd, sel_rte)
+ --local rte = tcbs.routes[sel_rte]
+ --minetest.show_formspec(pname, formname.."_renroute_"..sel_rte, "field[name;Enter new route name;"..rte.name.."]")
return
end
- if fields.delroute and hasprivs then
- table.remove(tcbs.routes, sel_rte)
- sel_rte = nil
- end
end
end