211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
--
-- UPDATE: in pratice this is way too expensive to be functional, and causes servers to hang. we're replacing it with a simpler version
local treetype = force(pos).name
if minetest.get_item_group(treetype, 'tree') == 0 then -- sir this is not a tree
return nil -- 無
end
local treedef = sorcery.lib.tbl.select(sorcery.data.trees, 'node', treetype)
local leaftype = treedef and treedef.leaves or nil
if not leaftype then return false end
local uppermost, lowermost
local found_leaves = false
local treemap, treenodes = amass(pos,function(node, where)
|
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
--
-- UPDATE: in pratice this is way too expensive to be functional, and causes servers to hang. we're replacing it with a simpler version
local treetype = force(pos).name
if minetest.get_item_group(treetype, 'tree') == 0 then -- sir this is not a tree
return nil -- 無
end
local treedef = sorcery.lib.tbl.select(sorcery.data.trees, function(ent)
return sorcery.lib.tbl.strmatch(ent.node, treetype)
end)
local leaftype = treedef and treedef.leaves or nil
if not leaftype then return false end
local uppermost, lowermost
local found_leaves = false
local treemap, treenodes = amass(pos,function(node, where)
|