Fix route programming lock-placement

This commit is contained in:
orwell96 2018-09-28 22:27:08 +02:00
parent 07ecc44130
commit 8e70c070c1
1 changed files with 2 additions and 6 deletions

View File

@ -258,16 +258,12 @@ minetest.register_on_punchnode(function(pos, node, player, pointed_thing)
advtrains.interlocking.visualize_route(rp.origin, rp.route, "prog_"..pname, rp.tmp_lcks, pname) advtrains.interlocking.visualize_route(rp.origin, rp.route, "prog_"..pname, rp.tmp_lcks, pname)
return return
end end
local ndef = minetest.registered_nodes[node.name] if advtrains.is_passive(pos) then
if ndef and ndef.luaautomation and ndef.luaautomation.getstate then
local pts = advtrains.roundfloorpts(pos) local pts = advtrains.roundfloorpts(pos)
if rp.tmp_lcks[pts] then if rp.tmp_lcks[pts] then
clear_lock(rp.tmp_lcks, pname, pts) clear_lock(rp.tmp_lcks, pname, pts)
else else
local state = ndef.luaautomation.getstate local state = advtrains.getstate(pos)
if type(state)=="function" then
state = state(pos, node)
end
rp.tmp_lcks[pts] = state rp.tmp_lcks[pts] = state
chat(pname, pts.." is held in "..state.." position when this route is set and freed ") chat(pname, pts.." is held in "..state.." position when this route is set and freed ")
end end