$once$
diameter = $int(Diameter, 3, 7, 256)$
function getBlockCoordsInRadius(centerX, centerY, centerZ, radius)
local radius = diameter/2
local results = {}
local index = 1
local rSquared = radius * radius
for x = math.floor(centerX - radius), math.floor(centerX + radius) do
for y = math.floor(centerY - radius), math.floor(centerY + radius) do
for z = math.floor(centerZ - radius), math.floor(centerZ + radius) do
-- Measure from block CENTER
local dx = (x + 0.5) - centerX
local dy = (y + 0.5) - centerY
local dz = (z + 0.5) - centerZ
if (dx*dx + dy*dy + dz*dz) <= rSquared then
results[index] = { x, y, z }
index = index + 1
end
end
end
end
return results
end
local coordinates = getBlockCoordsInRadius(x,y,z, Radius)
for i = 1, #coordinates do
setBlock(coordinates[i][1], coordinates[i][2], coordinates[i][3], activeBlockState)
end