private bool IsObstructedGenerator(CompPowerTrader pct) { if (Power_Alerts.obstructedSolarEnabled) { CompPowerPlantSolar solar = pct as CompPowerPlantSolar; if (solar != null) { foreach (IntVec3 current in pct.parent.OccupiedRect()) { if (pct.parent.Map.roofGrid.Roofed(current)) { return(true); } } return(false); } } if (Power_Alerts.obstructedWindEnabled) { CompPowerPlantWind wind = pct as CompPowerPlantWind; if (wind != null) { return((windPathBlockedCellsField.GetValue(wind) as List <IntVec3>).Count() > 0); } } if (Power_Alerts.obstructedWaterEnabled) { CompPowerPlantWater water = pct as CompPowerPlantWater; if (water != null) { return(!((bool)waterUsableField.GetValue(water)) || ((bool)waterDoubleUsedField.GetValue(water))); } } return(false); }
public static void Postfix(ref CompPowerPlantSolar __instance, ref float __result) { var basePowerConsumption = -__instance.Props.basePowerConsumption; __result = __result * basePowerConsumption; }