Use swap_node instead of add_node when replacing conductors.

This commit is contained in:
Novatux 2014-01-05 09:52:06 +01:00
parent fb417d45a7
commit 9c2a5c313c

View File

@ -425,7 +425,7 @@ function mesecon:turnon(pos, rulename)
return return
end end
minetest.add_node(pos, {name = mesecon:get_conductor_on(node, rulename), param2 = node.param2}) minetest.swap_node(pos, {name = mesecon:get_conductor_on(node, rulename), param2 = node.param2})
for _, rule in ipairs(mesecon:rule2meta(rulename, rules)) do for _, rule in ipairs(mesecon:rule2meta(rulename, rules)) do
local np = mesecon:addPosRule(pos, rule) local np = mesecon:addPosRule(pos, rule)
@ -458,7 +458,7 @@ function mesecon:turnoff(pos, rulename)
return return
end end
--]] --]]
minetest.add_node(pos, {name = mesecon:get_conductor_off(node, rulename), param2 = node.param2}) minetest.swap_node(pos, {name = mesecon:get_conductor_off(node, rulename), param2 = node.param2})
for _, rule in ipairs(mesecon:rule2meta(rulename, rules)) do for _, rule in ipairs(mesecon:rule2meta(rulename, rules)) do
local np = mesecon:addPosRule(pos, rule) local np = mesecon:addPosRule(pos, rule)