blockgame/mods/bg_tree/api.lua
trans_soup 850d397a97 refactor: minor code style change.
change the way some functions are declared.
2023-10-11 19:12:47 +02:00

20 lines
425 B
Lua

local modname = minetest.get_current_modname()
blockgame.tree = blockgame.tree or {}
local api = blockgame.tree
function api.find_bottom_log (pos, max_height)
local pos = vector.copy(pos)
local step = 0
while step < max_height do
local new_pos = blockgame.vector.get_below(pos)
if minetest.get_node(new_pos).name ~= modname .. ":log" then
return pos
end
pos = new_pos
step = step + 1
end
return nil
end