public void Notify_Resurrected() { healthState = PawnHealthState.Mobile; hediffSet.hediffs.RemoveAll((Hediff x) => x.def.everCurableByItem && x.TryGetComp <HediffComp_Immunizable>() != null); hediffSet.hediffs.RemoveAll((Hediff x) => x.def.everCurableByItem && x is Hediff_Injury && !x.IsPermanent()); hediffSet.hediffs.RemoveAll((Hediff x) => x.def.everCurableByItem && (x.def.lethalSeverity >= 0f || (x.def.stages != null && x.def.stages.Any((HediffStage y) => y.lifeThreatening)))); hediffSet.hediffs.RemoveAll((Hediff x) => x.def.everCurableByItem && x is Hediff_Injury && x.IsPermanent() && hediffSet.GetPartHealth(x.Part) <= 0f); while (true) { Hediff_MissingPart hediff_MissingPart = (from x in hediffSet.GetMissingPartsCommonAncestors() where !hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(x.Part) select x).FirstOrDefault(); if (hediff_MissingPart == null) { break; } RestorePart(hediff_MissingPart.Part, null, checkStateChange: false); } hediffSet.DirtyCache(); if (ShouldBeDead()) { hediffSet.hediffs.Clear(); } Notify_HediffChanged(null); }
public static float CalculateNaturalPartsAverageEfficiency(HediffSet diffSet, BodyPartGroupDef bodyPartGroup) { float num = 0f; int num2 = 0; IEnumerable <BodyPartRecord> enumerable = from x in diffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null) where x.groups.Contains(bodyPartGroup) select x; foreach (BodyPartRecord part in enumerable) { if (!diffSet.PartOrAnyAncestorHasDirectlyAddedParts(part)) { num += PawnCapacityUtility.CalculatePartEfficiency(diffSet, part, false, null); } num2++; } float result; if (num2 == 0 || num < 0f) { result = 0f; } else { result = num / (float)num2; } return(result); }
public bool IsSkinCovered(BodyPartRecord part, HediffSet body) { if (body.PartOrAnyAncestorHasDirectlyAddedParts(part)) { return(false); } return(skinCovered); }
public static float CalculateNaturalPartsAverageEfficiency(HediffSet diffSet, BodyPartGroupDef bodyPartGroup) { float num = 0f; int num2 = 0; foreach (BodyPartRecord item in from x in diffSet.GetNotMissingParts() where x.groups.Contains(bodyPartGroup) select x) { if (!diffSet.PartOrAnyAncestorHasDirectlyAddedParts(item)) { num += CalculatePartEfficiency(diffSet, item); } num2++; } if (num2 == 0 || num < 0f) { return(0f); } return(num / (float)num2); }
public static float CalculateNaturalPartsAverageEfficiency(HediffSet diffSet, BodyPartGroupDef bodyPartGroup) { float num = 0f; int num2 = 0; IEnumerable <BodyPartRecord> enumerable = from x in diffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined) where x.groups.Contains(bodyPartGroup) select x; foreach (BodyPartRecord item in enumerable) { if (!diffSet.PartOrAnyAncestorHasDirectlyAddedParts(item)) { num += PawnCapacityUtility.CalculatePartEfficiency(diffSet, item, false, null); } num2++; } if (num2 != 0 && !(num < 0.0)) { return(num / (float)num2); } return(0f); }
public bool IsSkinCovered(BodyPartRecord part, HediffSet body) { return(!body.PartOrAnyAncestorHasDirectlyAddedParts(part) && this.skinCovered); }