Prevent decay of placed leaves
This commit is contained in:
parent
486f50967f
commit
12c0bf0d91
@ -681,16 +681,16 @@ minetest.register_abm({
|
||||
|
||||
|
||||
action = function(p0, node, _, _)
|
||||
--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
|
||||
minetest.log("verbose", "[default] leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")")
|
||||
local do_preserve = false
|
||||
local d = minetest.registered_nodes[node.name].groups.leafdecay
|
||||
if not d or d == 0 then
|
||||
--print("not groups.leafdecay")
|
||||
minetest.log("verbose", "[default] not groups.leafdecay")
|
||||
return
|
||||
end
|
||||
local n0 = minetest.get_node(p0)
|
||||
if n0.param2 ~= 0 then
|
||||
--print("param2 ~= 0")
|
||||
-- Prevent decay
|
||||
return
|
||||
end
|
||||
local p0_hash = nil
|
||||
@ -702,10 +702,10 @@ minetest.register_abm({
|
||||
local reg = minetest.registered_nodes[n.name]
|
||||
-- Assume ignore is a trunk, to make the thing work at the border of the active area
|
||||
if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then
|
||||
--print("cached trunk still exists")
|
||||
minetest.log("verbose", "[default] leafdecay: cached trunk still exists")
|
||||
return
|
||||
end
|
||||
--print("cached trunk is invalid")
|
||||
minetest.log("verbose", "[default] leafdecay: cached trunk is invalid")
|
||||
-- Cache is invalid
|
||||
table.remove(default.leafdecay_trunk_cache, p0_hash)
|
||||
end
|
||||
@ -720,7 +720,7 @@ minetest.register_abm({
|
||||
if p1 then
|
||||
do_preserve = true
|
||||
if default.leafdecay_enable_cache then
|
||||
--print("caching trunk")
|
||||
minetest.log("verbose", "[default] leafdecay: caching trunk")
|
||||
-- Cache the trunk
|
||||
default.leafdecay_trunk_cache[p0_hash] = p1
|
||||
end
|
||||
|
@ -798,7 +798,8 @@ minetest.register_node("default:jungleleaves", {
|
||||
tiles = {"default_jungleleaves.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
is_ground_content = true,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
@ -864,7 +865,8 @@ minetest.register_node("default:leaves", {
|
||||
tiles = {"default_leaves.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
is_ground_content = true,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
|
@ -27,6 +27,7 @@ minetest.register_node("farming_plus:leaves_birch", {
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
|
@ -9,6 +9,7 @@ minetest.register_node("farming_plus:cj_leaves", {
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
|
@ -27,6 +27,7 @@ minetest.register_node("farming_plus:olive_leaves", {
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
|
@ -27,6 +27,7 @@ minetest.register_node("farming_plus:pale_leaves", {
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
place_param2 = 1,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user