public new void ApplyDamageToPart(DamageInfo dinfo, Pawn pawn, DamageWorker.DamageResult result) { BodyPartRecord exactPartFromDamageInfo = this.GetExactPartFromDamageInfo(dinfo, pawn); if (exactPartFromDamageInfo == null) { return; } dinfo.SetHitPart(exactPartFromDamageInfo); float num = dinfo.Amount; bool deflectedByMetalArmor = false; if (!dinfo.InstantPermanentInjury && !dinfo.IgnoreArmor) { DamageDef def = dinfo.Def; num = ArmorUtility.GetPostArmorDamage(pawn, num, dinfo.ArmorPenetrationInt, dinfo.HitPart, ref def, out deflectedByMetalArmor, out bool diminishedByMetalArmor); dinfo.Def = def; if (num < dinfo.Amount) { result.diminished = true; result.diminishedByMetalArmor = diminishedByMetalArmor; } } if (dinfo.Def.ExternalViolenceFor(pawn)) { num *= pawn.GetStatValue(StatDefOf.IncomingDamageFactor, true); } if (num <= 0f) { result.AddPart(pawn, dinfo.HitPart); result.deflected = true; result.deflectedByMetalArmor = deflectedByMetalArmor; return; } if (DamageWorker_AddInjuryStrengthX.IsHeadshot(dinfo, pawn)) { result.headshot = true; } if (dinfo.InstantPermanentInjury && (HealthUtility.GetHediffDefFromDamage(dinfo.Def, pawn, dinfo.HitPart).CompPropsFor(typeof(HediffComp_GetsPermanent)) == null || dinfo.HitPart.def.permanentInjuryChanceFactor == 0f || pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(dinfo.HitPart))) { return; } if (!dinfo.AllowDamagePropagation) { this.FinalizeAndAddInjury(pawn, num, dinfo, result); return; } this.ApplySpecialEffectsToPart(pawn, num, dinfo, result); }