make leaves only grow sideways.

previously, living leaves grew into more living leaves in all 6
directions. now, they only grow in the 4 horizontal directions.
This commit is contained in:
trans_soup 2023-10-19 15:12:36 +02:00
parent 19e392d1f3
commit bdfb9f5fda

View file

@ -24,8 +24,8 @@ blockgame.register_abm({
local distance = meta:get_int("leaf_distance") or 1
if distance >= max_grow_distance then return end
local neighbors = blockgame.vector.get_neighbors(pos)
for _, target in pairs(neighbors) do
local sides = blockgame.vector.get_sides_of(pos)
for _, target in pairs(sides) do
if blockgame.chance(2) then
blockgame.attempt_place(target, {name = leaves_growing})
minetest.get_meta(target):set_int("leaf_distance", distance + 1)