diff --git a/mods/bg_tree/node_leaves.lua b/mods/bg_tree/node_leaves.lua index b50a917..720df34 100644 --- a/mods/bg_tree/node_leaves.lua +++ b/mods/bg_tree/node_leaves.lua @@ -1,9 +1,26 @@ local modname = minetest.get_current_modname() local function leaves_fall_check (pos, node) - return blockgame.every(blockgame.vector.get_neighbors(pos), function (pos) - return minetest.get_item_group(minetest.get_node(pos).name, "supports_leaves") == 0 - end) + local is_supported = false + + blockgame.flood_fill(pos, function (pos, distance) + local nodename = minetest.get_node(pos).name + + if blockgame.item_matches(nodename, {"group:supports_leaves"}) then + is_supported = true + return false + end + + if blockgame.item_matches(nodename, {"group:extends_leaves_support"}) then + return true + end + end, 3) + + if not is_supported then + minetest.set_node(pos, {name = modname .. ":leaves"}) + end + + return not is_supported end local function reg_leaves (name, def) @@ -17,7 +34,7 @@ local function reg_leaves (name, def) def.groups = blockgame.underride(def.groups, { planty = 1, - supports_leaves = 1, + extends_leaves_support = 1, air_flowable = 1, can_fall = 1, }) diff --git a/mods/bg_tree/node_log.lua b/mods/bg_tree/node_log.lua index 1c36629..a34818e 100644 --- a/mods/bg_tree/node_log.lua +++ b/mods/bg_tree/node_log.lua @@ -20,7 +20,11 @@ local function reg_log (name, def) blockgame.register_node(modname .. ":" .. name, def) end -reg_log("log") +reg_log("log", { + groups = { + supports_leaves = 0, + }, +}) reg_log("log_alive", { groups = { planty = 1,