Exemple #1
0
 public static void Postfix(Pawn healer, Pawn patient, ref Thing __result)
 {
     if (Controller.Settings.RealisticBandages && __result != null && HealthAIUtility_FindBestMedicine_PostPatch.IsBandage(__result.def) && !HealthAIUtility_FindBestMedicine_PostPatch.BandagesValid(patient))
     {
         float medPot = __result.def.GetStatValueAbstract(StatDefOf.MedicalPotency, null);
         __result = GenClosest.ClosestThing_Global_Reachable(patient.Position, patient.Map, patient.Map.listerThings.ThingsInGroup(ThingRequestGroup.Medicine), PathEndMode.ClosestTouch, TraverseParms.For(healer, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, (Thing m) => !m.IsForbidden(healer) && healer.CanReserve(m, 1, -1, null, false) && !HealthAIUtility_FindBestMedicine_PostPatch.IsBandage(m.def) && m.def.GetStatValueAbstract(StatDefOf.MedicalPotency, null) <= medPot, (Thing m) => m.def.GetStatValueAbstract(StatDefOf.MedicalPotency, null));
     }
 }
Exemple #2
0
        // Token: 0x060000BB RID: 187 RVA: 0x0000935C File Offset: 0x0000755C
        public static bool BandagesValid(Pawn pawn)
        {
            HediffSet hediffSet;

            if (pawn == null)
            {
                hediffSet = null;
            }
            else
            {
                Pawn_HealthTracker health = pawn.health;
                hediffSet = (health?.hediffSet);
            }
            HediffSet hedset = hediffSet;

            if (hedset != null)
            {
                List <Hediff> injuries = hedset.GetHediffsTendable().ToList();
                if (injuries != null && injuries.Count > 0)
                {
                    foreach (Hediff injury in injuries)
                    {
                        if (!(injury is Hediff_Injury) && !HealthAIUtility_FindBestMedicine_PostPatch.Inclusions().Contains(injury.def.defName))
                        {
                            return(false);
                        }
                        if (injury is Hediff_Injury && injury.Part.depth == BodyPartDepth.Inside)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemple #3
0
 // Token: 0x060000BC RID: 188 RVA: 0x00009420 File Offset: 0x00007620
 public static bool IsBandage(ThingDef def)
 {
     return(def.IsMedicine && HealthAIUtility_FindBestMedicine_PostPatch.Bandages().Contains(def.defName));
 }