From 32af996b9dd0d628ba99f5dd30b2d7b618c22b6b Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Mar 2017 02:38:08 +0200 Subject: [PATCH] Drop itemframe correctly after push --- mods/ITEMS/itemframes/init.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mods/ITEMS/itemframes/init.lua b/mods/ITEMS/itemframes/init.lua index 68c8a38e..bed7a2e4 100644 --- a/mods/ITEMS/itemframes/init.lua +++ b/mods/ITEMS/itemframes/init.lua @@ -75,8 +75,7 @@ local update_item = function(pos, node) end end -local drop_item = function(pos, node) - local meta = minetest.get_meta(pos) +local drop_item = function(pos, node, meta) if meta:get_string("item") ~= "" then if node.name == "itemframes:frame" and not minetest.setting_getbool("creative_mode") then minetest.add_item(pos, meta:get_string("item")) @@ -111,7 +110,7 @@ minetest.register_node("itemframes:frame",{ if not itemstack then return end local meta = minetest.get_meta(pos) if clicker:get_player_name() == meta:get_string("owner") then - drop_item(pos,node) + drop_item(pos, node, meta) meta:set_string("item", itemstack:get_name()) update_item(pos,node) if not minetest.setting_getbool("creative_mode") then @@ -120,11 +119,10 @@ minetest.register_node("itemframes:frame",{ end return itemstack end, - on_punch = function(pos,node,puncher) + on_destruct = function(pos) local meta = minetest.get_meta(pos) - if puncher:get_player_name() == meta:get_string("owner") then - drop_item(pos, node) - end + local node = minetest.get_node(pos) + drop_item(pos, node, meta) end, can_dig = function(pos,player)