From ce5e6686810c4d5f99651a92fffddc6c4d346a43 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 2 Oct 2017 11:01:01 +0200 Subject: [PATCH] Bones: Return bones when taking the last ItemStack --- mods/bones/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/bones/init.lua b/mods/bones/init.lua index 9583bc2..8688fa1 100644 --- a/mods/bones/init.lua +++ b/mods/bones/init.lua @@ -68,6 +68,12 @@ minetest.register_node("bones:bones", { on_metadata_inventory_take = function(pos, listname, index, stack, player) local meta = minetest.get_meta(pos) if meta:get_inventory():is_empty("main") then + local inv = player:get_inventory() + if inv:room_for_item("main", {name = "bones:bones"}) then + inv:add_item("main", {name = "bones:bones"}) + else + minetest.add_item(pos, "bones:bones") + end minetest.remove_node(pos) end end,