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