1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-11-13 05:20:18 +01:00

Bones: Return bones when taking the last ItemStack

This commit is contained in:
SmallJoker 2017-10-02 11:01:01 +02:00 committed by sfan5
parent 6530fa914b
commit ce5e668681

View File

@ -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,