function serverCmdMakeSphere(%client, %radius) {
%tempBrick = %client.player.tempBrick;
if(%radius < 2 || !isObject(%tempBrick))
return;
%offset = %tempBrick.position;
for(%i = 0; %i <= 180; %i++) {
%z = mCos(%i);
%z = mFloor(%z * %radius * 5) / 5;
if(%z == %lastZ)
continue;
else
%lastZ = %z;
%thisPlaneRadius = mSin(%i) * %radius;
for(%j = 0; %j < 360; %j++) {
%thisPlanePos = mFloor(mCos(mDegToRad(%j)) * %thisPlaneRadius * 2) / 2 SPC mFloor(mSin(mDegToRad(%j)) * %thisPlaneRadius * 2) / 2;
if(%thisPlanePos $= %lastPlanePos)
continue;
else
%lastPlanePos = %thisPlanePos;
%b = new fxDTSBrick() {
dataBlock = brick1x1fData;
position = vectorAdd(%thisPlanePos SPC %z, %offset);
isPlanted = true;
};
%client.brickGroup.add(%b);
}
}
}
Usage:
/makeSphere <radius>
generates a sphere with the radius given
It's best to fill in the inside of the generated sphere with normal bricks, and then remove the sphere as it is made out of 1x1 bricks which doesn't play nice with the brickcount.