From f28cf0af035b7a4ee573059f1215f2998eb9dab0 Mon Sep 17 00:00:00 2001 From: Jeija Date: Sat, 8 Dec 2012 16:08:16 +0100 Subject: [PATCH] Fix major bug that often occured when using gates (caused by commit 64d109b) --- mesecons/internal.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/mesecons/internal.lua b/mesecons/internal.lua index 7a576d6..e197879 100644 --- a/mesecons/internal.lua +++ b/mesecons/internal.lua @@ -246,22 +246,17 @@ function mesecon:connected_to_pw_src(pos, checked) checked[c] = {x=pos.x, y=pos.y, z=pos.z} --add current node to checked local node = minetest.env:get_node_or_nil(pos) - if node == nil then return false, checked end + if not mesecon:is_conductor(node.name) then return false, checked end if mesecon:is_powered_by_receptor(pos) then --return if conductor is powered return true, checked end --Check if conductors around are connected - if mesecon:is_conductor(node.name) then - rules = mesecon:conductor_get_rules(node) - elseif mesecon:is_effector(node.name) then - rules = mesecon:effector_get_input_rules(node) - else - return false, checked - end + local connected + local rules = mesecon:conductor_get_rules(node) - for i, rule in ipairs(rules) do + for _, rule in ipairs(rules) do local np = {} np.x = pos.x + rule.x np.y = pos.y + rule.y