diff --git a/mods/bg_tree/grow_sapling.lua b/mods/bg_tree/grow_sapling.lua index ff32078..a0bd194 100644 --- a/mods/bg_tree/grow_sapling.lua +++ b/mods/bg_tree/grow_sapling.lua @@ -38,6 +38,9 @@ end ]]-- local sapling_grow_cost = 2000 +local sapling_can_replace = { + modname .. ":leaves_alive", +} blockgame.register_increasing_abm({ id = modname .. ":grow_sapling", @@ -58,7 +61,8 @@ blockgame.register_increasing_abm({ if not supports_sapling(below_name) then return false end local above = pos + blockgame.vector.dirs.up - if minetest.get_node(above).name ~= "air" then return false end + local above_name = minetest.get_node(above).name + if above_name ~= "air" and not blockgame.item_matches(above_name, sapling_can_replace) then return false end return true end, @@ -87,7 +91,7 @@ blockgame.register_increasing_abm({ -- grow out leaves to the sides. local sides = blockgame.vector.get_sides_of(above) for _, side in pairs(sides) do - blockgame.attempt_place(side, {name = leaves_growing}, {modname .. ":leaves_alive"}) + blockgame.attempt_place(side, {name = leaves_growing}) end end, })