public ForceVoxelFaceMaterial ( string materialName ) : void | ||
materialName | string | |
Résultat | void |
public void ForceVoxelFaceMaterial(string materialName)
{
Vector3I coords;
for (var y = 0; y < Size.Y; y++)
{
for (var z = 0; z < Size.Z; z++)
{
coords = new Vector3I(0, y, z);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
coords = new Vector3I(Size.X - 1, y, z);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
}
}
for (var x = 0; x < Size.X; x++)
{
for (var z = 0; z < Size.Z; z++)
{
coords = new Vector3I(x, 0, z);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
coords = new Vector3I(x, Size.Y - 1, z);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
}
}
for (var x = 0; x < Size.X; x++)
{
for (var y = 0; y < Size.Y; y++)
{
coords = new Vector3I(x, y, 0);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
coords = new Vector3I(x, y, Size.Z - 1);
SetVoxelMaterialAndIndestructibleContent(materialName, 0xff, ref coords);
}
}
}
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 }