public static TryGetRandomClusterSpawnCell ( |
||
plantDef | ||
newDesiredClusterSize | int | |
checkTemperature | bool | |
spawnCell | IntVec3 | |
Результат | void |
/// <summary> /// Tries to spawn a new cluster at a random position on the map. The exclusivity radius still applies. /// </summary> public void TrySpawnNewClusterAtRandomPosition() { ThingDef_ClusterPlant cavePlantDef = cavePlantDefs.RandomElementByWeight((ThingDef_ClusterPlant plantDef) => plantDef.plant.wildCommonalityMaxFraction / plantDef.clusterSizeRange.Average); int newDesiredClusterSize = cavePlantDef.clusterSizeRange.RandomInRange; IntVec3 spawnCell = IntVec3.Invalid; GenClusterPlantReproduction.TryGetRandomClusterSpawnCell(cavePlantDef, newDesiredClusterSize, true, this.map, out spawnCell); if (spawnCell.IsValid) { Cluster.SpawnNewClusterAt(this.map, spawnCell, cavePlantDef, newDesiredClusterSize); } }
/// <summary> /// Tries to spawn a new cluster at a random position on the map. The exclusivity radius still applies. /// </summary> public void TrySpawnNewClusterAtRandomPosition() { //Log.Message("TrySpawnNewClusterAtRandomPosition"); for (int defindex = 0; defindex < cavePlantDefs.Count; defindex++) { //Log.Message("cavePlantDefs: " + cavePlantDefs[defindex].ToString()); } ThingDef_ClusterPlant cavePlantDef = cavePlantDefs.RandomElementByWeight((ThingDef_ClusterPlant plantDef) => plantDef.plant.wildCommonalityMaxFraction / plantDef.clusterSizeRange.Average); //Log.Message("selected cavePlantDef = " + cavePlantDef.ToString()); int newDesiredClusterSize = cavePlantDef.clusterSizeRange.RandomInRange; IntVec3 spawnCell = IntVec3.Invalid; GenClusterPlantReproduction.TryGetRandomClusterSpawnCell(cavePlantDef, newDesiredClusterSize, true, out spawnCell); if (spawnCell.IsValid) { Cluster.SpawnNewClusterAt(spawnCell, cavePlantDef, newDesiredClusterSize); } }