From 3a55e19055871bb403eb306cbaa87836b66ef60c Mon Sep 17 00:00:00 2001 From: MT-Modder Date: Mon, 22 Feb 2016 18:28:43 -0500 Subject: [PATCH] Control leaf decay with sneak. As requested by @paramat. Leaves are preserved by default and only decay when using place + sneak. --- mods/default/functions.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 3afaec88..29506c40 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -257,9 +257,11 @@ minetest.register_globalstep(function(dtime) end) default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) - local node = minetest.get_node(pos) - node.param2 = 1 - minetest.set_node(pos, node) + if placer and not placer:get_player_control().sneak then + local node = minetest.get_node(pos) + node.param2 = 1 + minetest.set_node(pos, node) + end end minetest.register_abm({