From a87b4a8e65ab029407e7e4f962793904a5ee0928 Mon Sep 17 00:00:00 2001 From: BlockMen Date: Tue, 21 May 2013 17:34:42 +0300 Subject: [PATCH] don't decay leaves and apple when placed by player --- mods/default/functions.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 60ec99ca..94aa9878 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -299,3 +299,14 @@ minetest.register_abm({ end end }) + +--leaves and apple do not decay when placed by player +minetest.register_on_placenode(function(pos, newnode, placer, oldnode) + if placer:is_player() then + local d = minetest.registered_nodes[newnode.name].groups.leafdecay + if d or not d == 0 then + newnode.param2 = 1 + minetest.env:set_node(pos, newnode) + end + end +end)