Remove excessive swaps

This commit is contained in:
Jude Melton-Houghton 2022-01-29 08:37:32 -05:00
parent a8aeab965c
commit 48aa6f6a5b
2 changed files with 6 additions and 8 deletions

View File

@ -8,11 +8,10 @@ end
-- An on_rotate callback for mesecons components.
function mesecon.on_rotate(pos, node, user, mode, new_param2)
minetest.swap_node(pos, {name = "air"})
local new_node = {name = node.name, param1 = node.param1, param2 = new_param2}
minetest.swap_node(pos, new_node)
mesecon.on_dignode(pos, node)
node.param2 = new_param2
minetest.swap_node(pos, node)
mesecon.on_placenode(pos, node)
mesecon.on_placenode(pos, new_node)
minetest.check_for_falling(pos)
return true
end

View File

@ -263,12 +263,11 @@ minetest.register_on_placenode(function (pos, node)
end)
function mesecon.buttonlike_onrotate(pos, node, user, mode, new_param2)
minetest.swap_node(pos, {name = "air"})
local new_node = {name = node.name, param1 = node.param1, param2 = new_param2}
minetest.swap_node(pos, new_node)
mesecon.receiver_remove(pos, node)
mesecon.on_dignode(pos, node)
node.param2 = new_param2
minetest.swap_node(pos, node)
mesecon.on_placenode(pos, node)
mesecon.on_placenode(pos, new_node)
mesecon.receiver_place(pos)
minetest.check_for_falling(pos)
return true