From 2ba2835cd8f4764c6e990faffeab3b3d433510d8 Mon Sep 17 00:00:00 2001 From: kilbith Date: Sun, 10 Jan 2016 23:24:35 +0100 Subject: [PATCH] Item frame : prevent duplicating items with on_destruct --- itemframe.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/itemframe.lua b/itemframe.lua index 7c91382..4da1741 100644 --- a/itemframe.lua +++ b/itemframe.lua @@ -84,6 +84,7 @@ xdecor.register("frame", { sounds = default.node_sound_wood_defaults(), on_rotate = screwdriver.disallow, sunlight_propagates = true, + inventory_image = "xdecor_frame.png", node_box = { type = "fixed", fixed = {-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5} @@ -91,8 +92,7 @@ xdecor.register("frame", { tiles = { "xdecor_wood.png", "xdecor_wood.png", "xdecor_wood.png", "xdecor_wood.png", "xdecor_wood.png", "xdecor_frame.png" - }, - inventory_image = "xdecor_frame.png", + }, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) local name = placer:get_player_name() @@ -132,13 +132,7 @@ xdecor.register("frame", { return true end, - on_destruct = function(pos) - local meta = minetest.get_meta(pos) - local node = minetest.get_node(pos) - - if meta:get_string("item") == "" then return end - drop_item(pos, node) - end + after_destruct = remove_item }) minetest.register_abm({