Make loose repacking not lose meta

This affects things like witness hints, and may have
been causing witness hints not to work for leaching
if the leached nodes self-repack afterwards.
This commit is contained in:
Aaron Suen 2021-06-28 23:34:22 -04:00
parent 969ff065b0
commit 025e237be0
2 changed files with 10 additions and 6 deletions

View File

@ -92,9 +92,13 @@ function nodecore.node_sound(pos, kind, opts)
return nodecore.sound_play_except(t.name, t, opts and opts.except)
end
function nodecore.set_loud(pos, node, opts)
minetest.set_node(pos, node)
opts = opts or {}
opts.node = node
return nodecore.node_sound(pos, "place", opts)
local function mkloud(fn)
return function(pos, node, opts)
fn(pos, node)
opts = opts or {}
opts.node = node
return nodecore.node_sound(pos, "place", opts)
end
end
nodecore.set_loud = mkloud(minetest.set_node)
nodecore.swap_loud = mkloud(minetest.swap_node)

View File

@ -111,6 +111,6 @@ nodecore.register_soaking_abm({
soakcheck = function(data, pos, node)
if data.total < 100 then return end
local def = minetest.registered_items[node.name] or {}
return nodecore.set_loud(pos, {name = def.repack_to})
return nodecore.swap_loud(pos, {name = def.repack_to})
end
})