mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 14:23:16 -04:00
Dig the whole papyrus/cactus (see issue #83)
Just like in the growing-mod the plant is removed from the dug node upwards and added to the players inventory.
This commit is contained in:
parent
5fa8852115
commit
563d29d452
1 changed files with 12 additions and 0 deletions
|
@ -91,3 +91,15 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
-- Nodes in the group plant_dig (papyrus and cactus) go into the diggers inventory if the node below is removed
|
||||
minetest.register_on_dignode(function(pos, node, digger)
|
||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local nn = minetest.env:get_node(np)
|
||||
while minetest.get_item_group(nn.name, "plant_dig") > 0 do
|
||||
minetest.env:remove_node(np)
|
||||
digger:get_inventory():add_item('main', nn.name)
|
||||
np = {x = np.x, y = np.y + 1, z = np.z}
|
||||
nn = minetest.env:get_node(np)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue