Dig the whole papyrus/cactus (second try)

The plant is removed from the dug node upwards and added to the players inventory.
This commit is contained in:
Casimir 2013-03-17 13:16:58 +01:00
parent 2f91ec0f73
commit 9c3d8c0853
1 changed files with 10 additions and 0 deletions

View File

@ -91,3 +91,13 @@ minetest.register_abm({
end
})
-- Nodes in the group plant_dig go into the diggers inventory if the node below is dug
minetest.register_on_dignode(function(pos, node, digger)
if minetest.get_item_group(node.name, "plant_dig") ~= 0 and digger ~= nil then
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
local nn = minetest.env:get_node(np)
if minetest.get_item_group(nn.name, "plant_dig") ~= 0 then
minetest.node_dig(np, nn, digger)
end
end
end)