flora only spreads on same dirt type it's placed

This commit is contained in:
tenplus1 2021-04-01 11:18:34 +01:00
parent 9eb042c417
commit b35e024008

View File

@ -126,18 +126,23 @@ local flower_spread = function(pos, node)
return
end
pos.y = pos.y - 1
local under = minetest.get_node(pos)
-- make sure we have soil underneath
if minetest.get_item_group(under.name, "soil") == 0
or under.name == "default:desert_sand" then
return
end
local seedling = minetest.find_nodes_in_area_under_air(
pos0, pos1, {"group:soil"})
pos0, pos1, {under.name})
if #seedling > 0 then
pos = seedling[math.random(#seedling)]
-- default farming has desert sand as soil, so dont spread on this
if minetest.get_node(pos).name == "default:desert_sand" then
return
end
pos.y = pos.y + 1
if (minetest.get_node_light(pos) or 0) < 13 then