//Alert_NeedWarmClothes public static void Vamp_DontNeedWarmClothesReports(Alert_NeedWarmClothes __instance, ref AlertReport __result) { if (__result.culpritsTargets?.Count() > 0) { var vamps = __result.culpritsTargets.Where(x => x.Thing is Pawn y && y.IsVampire()); if (vamps?.Count() > 0) { var p = vamps.First().Thing; float num = AlertNeedWarmClothes_LowestTemperatureComing(p.MapHeld); var colonists = new List <Pawn>(p.MapHeld.mapPawns.FreeColonistsSpawned.Where(x => !x.IsVampire())); if (!colonists.NullOrEmpty()) { foreach (Pawn pawn in colonists) { if (pawn.GetStatValue(StatDefOf.ComfyTemperatureMin, true) > num) { __result = pawn; return; } } } __result = false; return; } } }
public void CheckActiveAlerts() { try { UIRoot_Play ui = Find.UIRoot as UIRoot_Play; if (ui == null) { return; } bool foundAlertNeedWarmClothes = false; foreach (Alert alert in (List <Alert>)activeAlertsField.GetValue(ui.alerts)) { if (!alert.Active) { continue; } if (!foundAlertNeedWarmClothes) { this.alertNeedWarmClothes = alert as Alert_NeedWarmClothes; if (alertNeedWarmClothes != null) { foundAlertNeedWarmClothes = true; } } } if (!foundAlertNeedWarmClothes) { this.alertNeedWarmClothes = null; } } catch { Logger.Error("could not check active alerts"); } }