forked from Mirrorlandia_minetest/mesecons
Fix issue #135
This commit is contained in:
parent
39361fb719
commit
7d8fd7a8df
@ -275,20 +275,15 @@ end
|
|||||||
minetest.register_globalstep(execute_actions)
|
minetest.register_globalstep(execute_actions)
|
||||||
|
|
||||||
function add_action(pos, action, rname)
|
function add_action(pos, action, rname)
|
||||||
for _,i in ipairs(mesecon.to_update) do
|
for i, update in ipairs(mesecon.to_update) do
|
||||||
if i.pos.x == pos.x and i.pos.y == pos.y and i.pos.z == pos.z and i.rname.x == rname.x and i.rname.y == rname.y and i.rname.z == rname.z then
|
-- check if action for this node already exist, if so correct it:
|
||||||
if (i.action == "on" and action == "on") or (i.action == "off" and action == "off") then
|
if mesecon:cmpPos(pos, update.pos) and mesecon:cmpPos(update.rname, rname) then
|
||||||
--nothing
|
mesecon.to_update[i].action = action
|
||||||
elseif i.action == "coff" and action == "on" then i.action = "on"
|
return -- action added (as correction), so return now
|
||||||
elseif i.action == "con" and action == "off" then i.action = "off"
|
|
||||||
else
|
|
||||||
if action == "on" or action == "con" then i.action = "con" end
|
|
||||||
if action == "off" or action == "coff" then i.action = "coff" end
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mesecon.to_update[#mesecon.to_update+1] = {pos = pos, action = action, rname = rname}
|
|
||||||
|
table.insert(mesecon.to_update, {pos = pos, action = action, rname = rname})
|
||||||
end
|
end
|
||||||
|
|
||||||
--Rules
|
--Rules
|
||||||
|
Loading…
Reference in New Issue
Block a user