Control leaf decay with sneak.

As requested by @paramat.
Leaves are preserved by default and only decay when using place + sneak.
This commit is contained in:
MT-Modder 2016-02-22 18:28:43 -05:00 committed by paramat
parent ea2a7d3b1f
commit 3a55e19055
1 changed files with 5 additions and 3 deletions

View File

@ -257,10 +257,12 @@ minetest.register_globalstep(function(dtime)
end)
default.after_place_leaves = function(pos, placer, itemstack, pointed_thing)
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({
nodenames = {"group:leafdecay"},