diff options
author | Jeija <norrepli@gmail.com> | 2016-07-31 22:26:33 +0200 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2016-07-31 22:26:33 +0200 |
commit | 778ee427f483d9c3d543284f6f81973730d3b05f (patch) | |
tree | dd6d5276086c1175cc06cc2ff5b9d4a661801854 | |
parent | 7c7595fd7dea6bc569086c544c74682552824e41 (diff) | |
download | mesecons-778ee427f483d9c3d543284f6f81973730d3b05f.tar mesecons-778ee427f483d9c3d543284f6f81973730d3b05f.tar.gz mesecons-778ee427f483d9c3d543284f6f81973730d3b05f.tar.bz2 mesecons-778ee427f483d9c3d543284f6f81973730d3b05f.tar.xz mesecons-778ee427f483d9c3d543284f6f81973730d3b05f.zip |
Fix bug introduced in previous commit that broke all logic blocks
turnon / turnoff were calling activate / deactivate on nodes even though
their rules didn't link
Fixes #278, thanks to @darkfeels
-rw-r--r-- | mesecons/internal.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/mesecons/internal.lua b/mesecons/internal.lua index d9c5886..4ef2b18 100644 --- a/mesecons/internal.lua +++ b/mesecons/internal.lua @@ -408,8 +408,11 @@ function mesecon.turnon(pos, link) minetest.swap_node(f.pos, {name = mesecon.get_conductor_on(node, f.link), param2 = node.param2}) - for npos, l in pairs(neighborlinks) do - table.insert(frontiers, {pos = minetest.get_position_from_hash(npos), link = l}) + for npos, links in pairs(neighborlinks) do + -- links = all links to node, l = each single link + for _, l in ipairs(links) do + table.insert(frontiers, {pos = minetest.get_position_from_hash(npos), link = l}) + end end else mesecon.queue:add_action(f.pos, "turnon", {f.link}, nil, true) @@ -465,8 +468,11 @@ function mesecon.turnoff(pos, link) minetest.swap_node(f.pos, {name = mesecon.get_conductor_off(node, f.link), param2 = node.param2}) - for npos, l in pairs(neighborlinks) do - table.insert(frontiers, {pos = minetest.get_position_from_hash(npos), link = l}) + for npos, links in pairs(neighborlinks) do + -- links = all links to node, l = each single link + for _, l in ipairs(links) do + table.insert(frontiers, {pos = minetest.get_position_from_hash(npos), link = l}) + end end else mesecon.queue:add_action(f.pos, "turnoff", {f.link}, nil, true) |