Skip to content
Snippets Groups Projects
Commit 93a2c40e authored by LeMagnesium's avatar LeMagnesium Committed by paramat
Browse files

Adding bones' drop feature Before, when you died, you got to punch you bones...

Adding bones' drop feature Before, when you died, you got to punch you bones to get back your stuff, the bones block was not dropped. However, a lot of people wants to use them for decorations/building, and have to install a dedicated mod since 0.4.10-release. With this commit, a bones block containing an inventory is dropped/added to inventory (if enough room) when the bones block is removed. Then, when a player places a bones block by himself, he will dig it like any other basic node (eg. default:tree), not just punch it.

Thanks for reading.
parent ff0973fa
Branches
No related tags found
No related merge requests found
......@@ -76,6 +76,10 @@ minetest.register_node("bones:bones", {
return
end
if(minetest.get_meta(pos):get_string("infotext") == "") then
return
end
local inv = minetest.get_meta(pos):get_inventory()
local player_inv = player:get_inventory()
local has_space = true
......@@ -93,6 +97,11 @@ minetest.register_node("bones:bones", {
-- remove bones if player emptied them
if has_space then
if player_inv:room_for_item("main", {name = "bones:bones"}) then
player_inv:add_item("main", {name = "bones:bones"})
else
minetest.add_item(pos,"bones:bones")
end
minetest.remove_node(pos)
end
end,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment