130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
is_clear = function(pos)
if not sorcery.lib.node.is_air(pos) then return false end
local ents = minetest.get_objects_inside_radius(pos,0.5)
if #ents > 0 then return false end
return true
end;
tree_is_live = function(pos, checklight) -- VERY EXPENSIVE FUNCTION
-- this is going to require some explanation.
--
-- for various purposes, we want to be able to tell the difference between
-- a tree that has grown naturally from the grown vs. a couple of trunk nodes
-- that the player has jammed together, even if she's built her own counterfeit
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
is_clear = function(pos)
if not sorcery.lib.node.is_air(pos) then return false end
local ents = minetest.get_objects_inside_radius(pos,0.5)
if #ents > 0 then return false end
return true
end;
insert = function(item, slot, npos, user, inv)
inv = inv or minetest.get_meta(npos):get_inventory()
if inv:room_for_item(slot,item) then
inv:add_item(slot,item)
else repeat
if user then
local ui = user:get_inventory()
if ui:room_for_item('main', item) then
ui:add_item('main', item)
break
end
end
minetest.add_item(npos, item)
until true end
end;
tree_is_live = function(pos, checklight) -- VERY EXPENSIVE FUNCTION
-- this is going to require some explanation.
--
-- for various purposes, we want to be able to tell the difference between
-- a tree that has grown naturally from the grown vs. a couple of trunk nodes
-- that the player has jammed together, even if she's built her own counterfeit
|