public static ClusterPlant TryToSpawnNewSymbiosisCluster(Cluster cluster)
{
// Check there is not already a symbiosis cluster.
if (cluster.symbiosisCluster == null)
{
foreach (IntVec3 cell in GenRadial.RadialCellsAround(cluster.Position, cluster.plantDef.clusterSpawnRadius, false).InRandomOrder())
{
if (cell.InBounds() == false)
{
continue;
}
ClusterPlant plant = cell.GetFirstThing(cluster.plantDef) as ClusterPlant;
if (plant != null)
{
plant.Destroy();
ClusterPlant symbiosisPlant = Cluster.SpawnNewClusterAt(cell, cluster.plantDef.symbiosisPlantDefEvolution, cluster.plantDef.symbiosisPlantDefEvolution.clusterSizeRange.RandomInRange);
cluster.NotifySymbiosisClusterAdded(symbiosisPlant.cluster);
return(symbiosisPlant);
}
}
}
return(null);
}