private void RecalculateBlockages() { if (this.windPathCells.Count == 0) { IEnumerable <IntVec3> collection = WindTurbineUtility.CalculateWindCells(this.parent.Position, this.parent.Rotation, this.parent.def.size); this.windPathCells.AddRange(collection); } this.windPathBlockedCells.Clear(); this.windPathBlockedByThings.Clear(); for (int i = 0; i < this.windPathCells.Count; i++) { IntVec3 intVec = this.windPathCells[i]; if (this.parent.Map.roofGrid.Roofed(intVec)) { this.windPathBlockedByThings.Add(null); this.windPathBlockedCells.Add(intVec); } else { List <Thing> list = this.parent.Map.thingGrid.ThingsListAt(intVec); for (int j = 0; j < list.Count; j++) { Thing thing = list[j]; if (thing.def.blockWind) { this.windPathBlockedByThings.Add(thing); this.windPathBlockedCells.Add(intVec); break; } } } } }
private List <IntVec3> GetWindCells() { return(manager.map.listerBuildings .allBuildingsColonist .Where(b => b.GetComp <CompPowerPlantWind>() != null) .SelectMany(turbine => WindTurbineUtility.CalculateWindCells(turbine.Position, turbine.Rotation, turbine.RotatedSize)) .ToList()); }