From 9c3d8c08532ae41c6cf426d4a941044f623435fd Mon Sep 17 00:00:00 2001 From: Casimir Date: Sun, 17 Mar 2013 13:16:58 +0100 Subject: [PATCH] Dig the whole papyrus/cactus (second try) The plant is removed from the dug node upwards and added to the players inventory. --- mods/default/leafdecay.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/default/leafdecay.lua b/mods/default/leafdecay.lua index 330bb33b..1de9d088 100644 --- a/mods/default/leafdecay.lua +++ b/mods/default/leafdecay.lua @@ -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)