private static IEnumerable <Blueprint_Build> PlaceArtilleryBlueprints(float points, Map map) { IEnumerable <ThingDef> artyDefs = from def in DefDatabase <ThingDef> .AllDefs where def.building != null && def.building.buildingTags.Contains("Artillery_BaseDestroyer") select def; int numArtillery = Mathf.RoundToInt(points / 60f); numArtillery = Mathf.Clamp(numArtillery, 1, 2); for (int i = 0; i < numArtillery; i++) { Rot4 rot = Rot4.Random; ThingDef artyDef = artyDefs.RandomElement <ThingDef>(); IntVec3 artySpot = SiegeBlueprintPlacer.FindArtySpot(artyDef, rot, map); if (!artySpot.IsValid) { break; } yield return(GenConstruct.PlaceBlueprintForBuild(artyDef, artySpot, map, rot, SiegeBlueprintPlacer.faction, ThingDefOf.Steel)); points -= 60f; } }
private static IEnumerable <Blueprint_Build> PlaceArtilleryBlueprints(float points, Map map) { IEnumerable <ThingDef> artyDefs = from def in DefDatabase <ThingDef> .AllDefs where def.building != null && def.building.buildingTags.Contains("Artillery_BaseDestroyer") select def; int numArtillery2 = Mathf.RoundToInt((float)(points / 60.0)); numArtillery2 = Mathf.Clamp(numArtillery2, 1, 2); int i = 0; if (i < numArtillery2) { Rot4 rot = Rot4.Random; ThingDef artyDef = artyDefs.RandomElement(); IntVec3 artySpot = SiegeBlueprintPlacer.FindArtySpot(artyDef, rot, map); if (artySpot.IsValid) { yield return(GenConstruct.PlaceBlueprintForBuild(artyDef, artySpot, map, rot, SiegeBlueprintPlacer.faction, ThingDefOf.Steel)); /*Error: Unable to find new state assignment for yield return*/; } } }