public string GetInBedForMedicalReasonsInspectStringLine() { if (this.usedBeds.Count == 0) { return(null); } Caravan_BedsTracker.tmpPawnLabels.Clear(); foreach (KeyValuePair <Pawn, Building_Bed> current in this.usedBeds) { if (!this.caravan.carryTracker.IsCarried(current.Key)) { if (CaravanBedUtility.WouldBenefitFromRestingInBed(current.Key)) { Caravan_BedsTracker.tmpPawnLabels.Add(current.Key.LabelShort); } } } if (!Caravan_BedsTracker.tmpPawnLabels.Any <string>()) { return(null); } string str = (Caravan_BedsTracker.tmpPawnLabels.Count <= 5) ? Caravan_BedsTracker.tmpPawnLabels.ToCommaList(true) : (Caravan_BedsTracker.tmpPawnLabels.Take(5).ToCommaList(false) + "..."); Caravan_BedsTracker.tmpPawnLabels.Clear(); return("UsingBedrollsDueToIllness".Translate() + ": " + str); }
private void RecalculateUsedBeds() { this.usedBeds.Clear(); if (!this.caravan.Spawned) { return; } Caravan_BedsTracker.tmpUsableBeds.Clear(); this.GetUsableBeds(Caravan_BedsTracker.tmpUsableBeds); if (!this.caravan.pather.MovingNow) { Caravan_BedsTracker.tmpUsableBeds.SortByDescending((Building_Bed x) => x.GetStatValue(StatDefOf.BedRestEffectiveness, true)); for (int i = 0; i < this.caravan.pawns.Count; i++) { Pawn pawn = this.caravan.pawns[i]; if (pawn.needs != null && pawn.needs.rest != null) { Building_Bed andRemoveFirstAvailableBedFor = this.GetAndRemoveFirstAvailableBedFor(pawn, Caravan_BedsTracker.tmpUsableBeds); if (andRemoveFirstAvailableBedFor != null) { this.usedBeds.Add(pawn, andRemoveFirstAvailableBedFor); } } } } else { Caravan_BedsTracker.tmpUsableBeds.SortByDescending((Building_Bed x) => x.GetStatValue(StatDefOf.ImmunityGainSpeedFactor, true)); for (int j = 0; j < this.caravan.pawns.Count; j++) { Pawn pawn2 = this.caravan.pawns[j]; if (pawn2.needs != null && pawn2.needs.rest != null) { if (CaravanBedUtility.WouldBenefitFromRestingInBed(pawn2)) { if (!this.caravan.pather.MovingNow || pawn2.CarriedByCaravan()) { Building_Bed andRemoveFirstAvailableBedFor2 = this.GetAndRemoveFirstAvailableBedFor(pawn2, Caravan_BedsTracker.tmpUsableBeds); if (andRemoveFirstAvailableBedFor2 != null) { this.usedBeds.Add(pawn2, andRemoveFirstAvailableBedFor2); } } } } } } Caravan_BedsTracker.tmpUsableBeds.Clear(); }
private void RecalculateUsedBeds() { usedBeds.Clear(); if (caravan.Spawned) { tmpUsableBeds.Clear(); GetUsableBeds(tmpUsableBeds); if (!caravan.pather.MovingNow) { tmpUsableBeds.SortByDescending((Building_Bed x) => x.GetStatValue(StatDefOf.BedRestEffectiveness)); for (int i = 0; i < caravan.pawns.Count; i++) { Pawn pawn = caravan.pawns[i]; if (pawn.needs != null && pawn.needs.rest != null) { Building_Bed andRemoveFirstAvailableBedFor = GetAndRemoveFirstAvailableBedFor(pawn, tmpUsableBeds); if (andRemoveFirstAvailableBedFor != null) { usedBeds.Add(pawn, andRemoveFirstAvailableBedFor); } } } } else { tmpUsableBeds.SortByDescending((Building_Bed x) => x.GetStatValue(StatDefOf.ImmunityGainSpeedFactor)); for (int j = 0; j < caravan.pawns.Count; j++) { Pawn pawn2 = caravan.pawns[j]; if (pawn2.needs != null && pawn2.needs.rest != null && CaravanBedUtility.WouldBenefitFromRestingInBed(pawn2) && (!caravan.pather.MovingNow || pawn2.CarriedByCaravan())) { Building_Bed andRemoveFirstAvailableBedFor2 = GetAndRemoveFirstAvailableBedFor(pawn2, tmpUsableBeds); if (andRemoveFirstAvailableBedFor2 != null) { usedBeds.Add(pawn2, andRemoveFirstAvailableBedFor2); } } } } tmpUsableBeds.Clear(); } }
public string GetInBedForMedicalReasonsInspectStringLine() { if (usedBeds.Count == 0) { return(null); } tmpPawnLabels.Clear(); foreach (KeyValuePair <Pawn, Building_Bed> usedBed in usedBeds) { if (!caravan.carryTracker.IsCarried(usedBed.Key) && CaravanBedUtility.WouldBenefitFromRestingInBed(usedBed.Key)) { tmpPawnLabels.Add(usedBed.Key.LabelShort); } } if (!tmpPawnLabels.Any()) { return(null); } string str = (tmpPawnLabels.Count <= 5) ? tmpPawnLabels.ToCommaList(useAnd: true) : (tmpPawnLabels.Take(5).ToCommaList() + "..."); tmpPawnLabels.Clear(); return("UsingBedrollsDueToIllness".Translate() + ": " + str); }
public static bool WouldBenefitFromBeingCarried(Pawn p) { return(CaravanBedUtility.WouldBenefitFromRestingInBed(p)); }