blockgame/mods/bg_tree/api.lua

21 lines
425 B
Lua
Raw Normal View History

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