local x0,y0,z0=0,30,0--起点坐标
local dx,dy,dz=60,60,60--外切长方体横纵竖长度
local count,all=0,dx*dy*dz--计数,总数
local m,k=10000,0--单次生成方块数,无用循环值
local x,y,z=0,0,0--当前坐标
local de=math.random(2,19)/2
local id=600--方块id
--是否在几何体内
local function isinside()
if (x-dx/2)^2/(dx/2)^2+(y-dy/2)^2/(dy/2)^2+(z-dz/2)^2/(dz/2)^2<=1 then
return true
else
return false
end
end
--主体
return function()
if (count>-1)and(count<all) then
for k=1,m do
x=count%dx
y=((count-x)%(dx*dy))/dx
z=(count-count%(dx*dy))/(dx*dy)
if isinside() then
Block:setBlockAll(x0+x,y0+y,z0+z,id, (x^2+y^2)/de^3) end
count=count+1
end
Chat:sendSystemMsg("Crafting:"..count)
elseif count>=all then
Chat:sendSystemMsg("End")
count=-1
end
end