sorcery  node.lua at [f7f6898cbd]

File lib/node.lua artifact a0d38cfe10 part of check-in f7f6898cbd


return {
	purge_container = function(pos,node,meta,user)
		local offset = function(pos,range)
			local r = function(min,max)
				return (math.random() * (max - min)) + min
			end
			return {
				x = pos.x + r(0 - range, range);
				y = pos.y;
				z = pos.z + r(0 - range, range);
			}
		end
		for name, inv in pairs(meta.inventory) do
			for _, item in pairs(inv) do
				if not item:is_empty() then
					minetest.add_item(offset(pos,0.4), item)
				end
			end
		end
	end;
}