From: SmallJoker Date: Mon, 2 Oct 2017 09:01:01 +0000 (+0200) Subject: Bones: Return bones when taking the last ItemStack X-Git-Tag: 0.4.17.1~16 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ce5e6686810c4d5f99651a92fffddc6c4d346a43;p=oweals%2Fminetest_game.git Bones: Return bones when taking the last ItemStack --- 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,