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