diff options
author | orwell96 <orwell@bleipb.de> | 2018-08-13 11:27:38 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2018-08-13 11:27:38 +0200 |
commit | 5fad61e9c981115a183527ffe58a7bbe26fea4e7 (patch) | |
tree | 7cae4779164491e1acac7189d7108c4130d710c6 | |
parent | 3dc5b28774670b3c7b505f3f6f9603ba683a299e (diff) | |
download | advtrains-5fad61e9c981115a183527ffe58a7bbe26fea4e7.tar.gz advtrains-5fad61e9c981115a183527ffe58a7bbe26fea4e7.tar.bz2 advtrains-5fad61e9c981115a183527ffe58a7bbe26fea4e7.zip |
Fix various bugs found while testing
-rw-r--r-- | advtrains/signals.lua | 8 | ||||
-rw-r--r-- | advtrains_interlocking/route_prog.lua | 7 | ||||
-rw-r--r-- | advtrains_interlocking/routesetting.lua | 6 | ||||
-rw-r--r-- | advtrains_interlocking/tcb_ts_ui.lua | 6 |
4 files changed, 15 insertions, 12 deletions
diff --git a/advtrains/signals.lua b/advtrains/signals.lua index 2caec79..1bbd7d4 100644 --- a/advtrains/signals.lua +++ b/advtrains/signals.lua @@ -60,9 +60,9 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", advtrains = { set_aspect = function(pos, node, asp) if asp.main.free then - advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_on_"..rotation, param2 = node.param2}, true) + advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_on"..rotation, param2 = node.param2}, true) else - advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_off_"..rotation, param2 = node.param2}, true) + advtrains.ndb.swap_node(pos, {name = "advtrains:retrosignal_off"..rotation, param2 = node.param2}, true) end end }, @@ -120,9 +120,9 @@ for r,f in pairs({on={as="off", ls="green", als="red"}, off={as="on", ls="red", advtrains = { set_aspect = function(pos, node, asp) if asp.main.free then - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_on_"..rotation, param2 = node.param2}, true) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_on"..rotation, param2 = node.param2}, true) else - advtrains.ndb.swap_node(pos, {name = "advtrains:signal_off_"..rotation, param2 = node.param2}, true) + advtrains.ndb.swap_node(pos, {name = "advtrains:signal_off"..rotation, param2 = node.param2}, true) end end }, diff --git a/advtrains_interlocking/route_prog.lua b/advtrains_interlocking/route_prog.lua index 15c2b6b..498df5f 100644 --- a/advtrains_interlocking/route_prog.lua +++ b/advtrains_interlocking/route_prog.lua @@ -320,12 +320,13 @@ minetest.register_chatcommand("at_rp_back", return advtrains.pcall(function() local rp = player_rte_prog[pname] if rp then - if #rp.route.tcbpath <= 0 then + if #rp.route <= 0 then return false, "Cannot backtrack when there are no route elements" end - rp.route.tcbpath[#rp.route.tcbpath] = nil + rp.tmp_locks = rp.route[#rp.route].locks + rp.route[#rp.route] = nil advtrains.interlocking.visualize_route(rp.origin, rp.route, "prog_"..pname) - return true, "Route section "..(#rp.route.tcbpath+1).." removed." + return true, "Route section "..(#rp.route+1).." removed." end return false, "You are not programming a route!" end) diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua index bfcfee7..5947555 100644 --- a/advtrains_interlocking/routesetting.lua +++ b/advtrains_interlocking/routesetting.lua @@ -84,7 +84,7 @@ function ilrs.set_route(signal, route, try) if not try then atwarn("Encountered route lock while a real run of routesetting routine, at position",pts,"while setting route",rtename,"of",signal) end return false, "Lock conflict at "..pts..", Held locked by:\n"..confl, nil, pts elseif not try then - ndef.luaautomation.setstate(pos, state) + ndef.luaautomation.setstate(pos, node, state) end end if not try then @@ -181,7 +181,9 @@ function ilrs.free_route_locks_indiv(pts, ts, nocallbacks) end -- This must be delayed, because this code is executed in-between a train step -- TODO use luaautomation timers? - minetest.after(0, ilrs.update_waiting, "lck", pts) + if not nocallbacks then + minetest.after(0, ilrs.update_waiting, "lck", pts) + end end -- frees all route locks, even manual ones set with the tool, at a specific position function ilrs.remove_route_locks(pts, nocallbacks) diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 5302b86..5ef7ca9 100644 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -505,10 +505,10 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte) end end if not tcbs.route_auto then - form = form.."button[0.5,4.5; 5,1;auto;Enable Automatic Working]" + form = form.."button[0.5,7; 5,1;auto;Enable Automatic Working]" else - form = form.."label[0.5,4.5;Automatic Working is active.]" - form = form.."label[0.5,4.8;Route is re-set when a train passed.]" + form = form.."label[0.5,7 ;Automatic Working is active.]" + form = form.."label[0.5,7.3;Route is re-set when a train passed.]" end form = form.."button[0.5,6; 5,1;cancelroute;Cancel Route]" |