Fix various bugs found while testing
parent
3dc5b28774
commit
5fad61e9c9
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]"
|
||||
|
|
Loading…
Reference in New Issue