When the itemframe is destroyed, make sure the item(s) are dropped

master
pseudonym-2669 2021-02-27 18:33:16 +00:00 committed by Hume2
parent 9535cab98c
commit 9f1314a20a
1 changed files with 10 additions and 1 deletions

View File

@ -52,6 +52,15 @@ local function drop_item(pos, node)
timer:stop()
end
-- New fucntion
function itemframe.destruct(pos)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
if meta:get_string("item") ~= "" then
drop_item(pos, node)
end
end
function itemframe.after_place(pos, placer, itemstack)
local meta = minetest.get_meta(pos)
local name = placer:get_player_name()
@ -133,7 +142,7 @@ xdecor.register("itemframe", {
on_rightclick = itemframe.rightclick,
on_punch = itemframe.punch,
can_dig = itemframe.dig,
after_destruct = remove_item
on_destruct = itemframe.destruct -- Fixed
})
minetest.register_entity("xdecor:f_item", {