Report oldstack correctly (before mutation)

This commit is contained in:
Jude Melton-Houghton 2022-02-27 17:45:50 -05:00
parent 6deefcb718
commit 03f4b2d799

View File

@ -220,6 +220,8 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
minetest.remove_node(n.pos)
end
local oldstack = mesecon.tablecopy(nodes)
-- update mesecons for removed nodes ( has to be done after all nodes have been removed )
for _, n in ipairs(nodes) do
mesecon.on_dignode(n.pos, n.node)
@ -243,7 +245,6 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
end
local moved_nodes = {}
local oldstack = mesecon.tablecopy(nodes)
for i in ipairs(nodes) do
moved_nodes[i] = {}
moved_nodes[i].oldpos = nodes[i].pos