Fix bad repeater updates when next to opaque block

This commit is contained in:
Wuzzy 2018-01-22 16:53:44 +01:00
parent f4657f79f5
commit 01952b56fd
2 changed files with 9 additions and 3 deletions

View file

@ -482,8 +482,14 @@ function mesecon.turnoff(pos, link)
-- Warning: A LOT of nodes need to be looked at for this to work
for _, r in ipairs(mesecon.rule2meta(f.link, mesecon.rules.mcl_alldirs_spread)) do
local np = vector.add(f.pos, r)
if mesecon.is_receptor_on(mesecon.get_node_force(np).name) then
return false
local n = mesecon.get_node_force(np)
if mesecon.is_receptor_on(n.name) then
local receptorrules = mesecon.receptor_get_rules(n)
for _, rr in pairs(receptorrules) do
if vector.equals(mesecon.invertRule(rr), r) then
return false
end
end
end
for _, l in ipairs(mesecon.rules_link_rule_all(f.pos, r)) do
local nlink = table.copy(l)

View file

@ -84,7 +84,7 @@ mesecon.on_dignode = function(pos, node)
local nnode = minetest.get_node(npos)
if mesecon.is_conductor_on(nnode) then
mesecon.receptor_off(npos, mesecon.conductor_get_rules(nnode))
elseif mesecon.is_effector_on(nnode.name) then
elseif mesecon.is_effector_on(nnode.name) and mesecon.is_powered(npos) == false then
mesecon.changesignal(npos, nnode, nlink, mesecon.state.off, 1)
mesecon.deactivate(npos, nnode, nlink, 1)
end