Skip to content

Commit

Permalink
Bones: Return bones when taking the last ItemStack
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Oct 2, 2017
1 parent 809e593 commit 3611af1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mods/bones/init.lua
Expand Up @@ -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,
Expand Down

0 comments on commit 3611af1

Please sign in to comment.