2023-10-11 07:17:21 +00:00
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
|
|
|
|
blockgame.tree = blockgame.tree or {}
|
|
|
|
local api = blockgame.tree
|
|
|
|
|
2023-10-11 17:12:47 +00:00
|
|
|
function api.find_bottom_log (pos, max_height)
|
2023-10-11 07:17:21 +00:00
|
|
|
local pos = vector.copy(pos)
|
|
|
|
local step = 0
|
|
|
|
while step < max_height do
|
2023-10-11 08:01:54 +00:00
|
|
|
local new_pos = blockgame.vector.get_below(pos)
|
2023-10-11 07:17:21 +00:00
|
|
|
if minetest.get_node(new_pos).name ~= modname .. ":log" then
|
|
|
|
return pos
|
|
|
|
end
|
|
|
|
pos = new_pos
|
|
|
|
|
|
|
|
step = step + 1
|
|
|
|
end
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|