SeedMaterialSphere() public method

Set a material for a random voxel cell and possibly nearest ones to it.
public SeedMaterialSphere ( string materialName, byte radius ) : void
materialName string material name
radius byte radius in voxels, defaults to zero, meaning only a random grid.
return void
Esempio n. 1
0
        public void FillAsteroid(MyVoxelMap asteroid, IMyVoxelFillProperties fillProperties)
        {
            var properties = (AsteroidSeedFillProperties)fillProperties;

            /* The full history behind this hack/crutch eludes me.
                 * There are roids that won't change their materials unless their face materials forced to something other than current value.
                 * So we have to do that manually by setting to a usually unused ore (uranium) and then reverting to the one we chose (=old one in case of a flaky roid)
                 */
            byte oldMaterial = asteroid.VoxelMaterial;
            asteroid.ForceVoxelFaceMaterial("Uraninite_01");
            asteroid.ForceVoxelFaceMaterial(properties.MainMaterial.Value);

            // Cycle through veins info and add 'spherical' depisits to the voxel cell grid (not voxels themselves)
            int i;

            if (properties.FirstVeins > 0)
                for (i = 0; i < properties.FirstVeins; i++)
                    asteroid.SeedMaterialSphere(properties.FirstMaterial.Value, (byte)properties.FirstRadius);

            if (properties.SecondVeins > 0)
                for (i = 0; i < properties.SecondVeins; i++)
                    asteroid.SeedMaterialSphere(properties.SecondMaterial.Value, (byte)properties.SecondRadius);

            if (properties.ThirdVeins > 0)
                for (i = 0; i < properties.ThirdVeins; i++)
                    asteroid.SeedMaterialSphere(properties.ThirdMaterial.Value, (byte)properties.ThirdRadius);

            if (properties.FourthVeins > 0)
                for (i = 0; i < properties.FourthVeins; i++)
                    asteroid.SeedMaterialSphere(properties.FourthMaterial.Value, (byte)properties.FourthRadius);

            if (properties.FifthVeins > 0)
                for (i = 0; i < properties.FifthVeins; i++)
                    asteroid.SeedMaterialSphere(properties.FifthMaterial.Value, (byte)properties.FifthRadius);

            if (properties.SixthVeins > 0)
                for (i = 0; i < properties.SixthVeins; i++)
                    asteroid.SeedMaterialSphere(properties.SixthMaterial.Value, (byte)properties.SixthRadius);

            if (properties.SeventhVeins > 0)
                for (i = 0; i < properties.SeventhVeins; i++)
                    asteroid.SeedMaterialSphere(properties.SeventhMaterial.Value, (byte)properties.SeventhRadius);

            // Hide the surface materials up to depth of 2 cells.
            asteroid.ForceShellMaterial(properties.MainMaterial.Value, 2);

            // This recovers material assigning ability for most roids (could be something specific to indestructibleContent property?)
            // And not for all, apparently :(
            //asteroid.ForceVoxelFaceMaterial(_dataModel.BaseMaterial.DisplayName); // don't change mattype

            // doesn't help
            //asteroid.ForceIndestructibleContent(0xff);

            // Alt ends     
        }