From 3611af1dda0897354cd1e36aea5e48721d4389aa 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 9583bc29..8688fa1e 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, -- 2.25.1