public static void PostFix(ref PawnCapacityWorker_Sight __instance, ref float __result, HediffSet diffSet, List <PawnCapacityUtility.CapacityImpactor> impactors = null)
 {
     if (__result > 0f)
     {
         PawnObserver pawnObserver = ThingCompUtility.TryGetComp <PawnObserver>(diffSet.pawn);
         if (pawnObserver != null)
         {
             float pawnSightOffset = pawnObserver.PawnSightOffset;
             if (pawnSightOffset != 0f)
             {
                 __result += pawnSightOffset;
             }
         }
     }
 }
        // Token: 0x0600000C RID: 12 RVA: 0x00002144 File Offset: 0x00000344
        public void CalcAndSetObserver(Pawn pawn)
        {
            float num   = 0f;
            float num2  = 0f;
            float num3  = 0f;
            float num4  = 0.25f;
            bool  flag  = true;
            bool  flag2 = true;
            bool  flag3 = false;
            bool  flag4 = false;

            if (pawn != null)
            {
                if ((pawn?.apparel) != null && flag && pawn.apparel.WornApparelCount > 0)
                {
                    List <Apparel> wornApparel = pawn.apparel.WornApparel;
                    if (wornApparel != null && wornApparel.Count > 0)
                    {
                        foreach (Apparel apparel in wornApparel)
                        {
                            CompObserver compObserver = ThingCompUtility.TryGetComp <CompObserver>(apparel);
                            if (compObserver != null)
                            {
                                num += compObserver.Props.SightOffset;
                                if (compObserver.Props.SightOffset > num2)
                                {
                                    num2 = compObserver.Props.SightOffset;
                                }
                                if (compObserver.Props.SightOffset < num3)
                                {
                                    num3 = compObserver.Props.SightOffset;
                                }
                            }
                        }
                    }
                }
                if ((pawn?.equipment) != null && flag2 && pawn.equipment.HasAnything())
                {
                    List <ThingWithComps> allEquipmentListForReading = pawn.equipment.AllEquipmentListForReading;
                    if (allEquipmentListForReading != null && allEquipmentListForReading.Count > 0)
                    {
                        foreach (ThingWithComps thingWithComps in allEquipmentListForReading)
                        {
                            CompObserver compObserver2 = ThingCompUtility.TryGetComp <CompObserver>(thingWithComps);
                            if (compObserver2 != null)
                            {
                                num += compObserver2.Props.SightOffset;
                                if (compObserver2.Props.SightOffset > num2)
                                {
                                    num2 = compObserver2.Props.SightOffset;
                                }
                                if (compObserver2.Props.SightOffset < num3)
                                {
                                    num3 = compObserver2.Props.SightOffset;
                                }
                            }
                        }
                    }
                }
                if ((pawn?.inventory) != null && flag3 && pawn.inventory.innerContainer.Any)
                {
                    List <Thing> innerListForReading = pawn.inventory.innerContainer.InnerListForReading;
                    if (innerListForReading != null && innerListForReading.Count > 0)
                    {
                        foreach (Thing thing in innerListForReading)
                        {
                            CompObserver compObserver3 = ThingCompUtility.TryGetComp <CompObserver>(thing as ThingWithComps);
                            if (compObserver3 != null)
                            {
                                num += compObserver3.Props.SightOffset;
                                if (compObserver3.Props.SightOffset > num2)
                                {
                                    num2 = compObserver3.Props.SightOffset;
                                }
                                if (compObserver3.Props.SightOffset < num3)
                                {
                                    num3 = compObserver3.Props.SightOffset;
                                }
                            }
                        }
                    }
                }
            }
            if (num != 0f)
            {
                num  = Math.Min(num4, Math.Max(0f - num4, num));
                num2 = Math.Min(num4, Math.Max(0f - num4, num2));
                num3 = Math.Min(num4, Math.Max(0f - num4, num3));
            }
            PawnObserver pawnObserver = ThingCompUtility.TryGetComp <PawnObserver>(pawn);

            if (pawnObserver != null)
            {
                if (flag4)
                {
                    pawnObserver.PawnSightOffset = num;
                    return;
                }
                pawnObserver.PawnSightOffset = num2 + num3;
            }
        }