Пример #1
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;

            if (!WardenFeedUtility.ShouldBeFed(pawn2))
            {
                return(null);
            }
            if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.02f)
            {
                return(null);
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out Thing foodSource, out ThingDef foodDef, canRefillDispenser: false, canUseInventory: true, allowForbidden: false, allowCorpse: false))
            {
                JobFailReason.Is("NoFood".Translate());
                return(null);
            }
            float nutrition = FoodUtility.GetNutrition(foodSource, foodDef);
            Job   job       = new Job(JobDefOf.FeedPatient, foodSource, pawn2);

            job.count = FoodUtility.WillIngestStackCountOf(pawn2, foodDef, nutrition);
            return(job);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!base.ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;

            if (!WardenFeedUtility.ShouldBeFed(pawn2))
            {
                return(null);
            }
            if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.02f)
            {
                return(null);
            }
            Thing    thing;
            ThingDef thingDef;

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out thingDef, false, true, false, false, false, false, false))
            {
                JobFailReason.Is("NoFood".Translate(), null);
                return(null);
            }
            float nutrition = FoodUtility.GetNutrition(thing, thingDef);

            return(new Job(JobDefOf.FeedPatient, thing, pawn2)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn2, thingDef, nutrition)
            });
        }
Пример #3
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!base.ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;

            if (!WardenFeedUtility.ShouldBeFed(pawn2))
            {
                return(null);
            }
            if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.019999999552965164)
            {
                return(null);
            }
            Thing    t2  = default(Thing);
            ThingDef def = default(ThingDef);

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out t2, out def, false, true, false, false, false, false))
            {
                JobFailReason.Is("NoFood".Translate());
                return(null);
            }
            Job job = new Job(JobDefOf.FeedPatient, t2, pawn2);

            job.count = FoodUtility.WillIngestStackCountOf(pawn2, def);
            return(job);
        }
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;

            if (pawn2 == null || pawn2 == pawn)
            {
                return(false);
            }
            if (def.feedHumanlikesOnly && !pawn2.RaceProps.Humanlike)
            {
                return(false);
            }
            if (def.feedAnimalsOnly && !pawn2.RaceProps.Animal)
            {
                return(false);
            }
            if (!FeedPatientUtility.IsHungry(pawn2))
            {
                return(false);
            }
            if (!FeedPatientUtility.ShouldBeFed(pawn2))
            {
                return(false);
            }
            if (!pawn.CanReserve(t, 1, -1, null, forced))
            {
                return(false);
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out var _, out var _, canRefillDispenser: false))
            {
                JobFailReason.Is("NoFood".Translate());
                return(false);
            }
            return(true);
        }
Пример #5
0
 protected override Thing BestIngestTarget(Pawn pawn)
 {
     if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate: true, out var foodSource, out var _, canRefillDispenser: false, canUseInventory: true, allowForbidden: true, allowCorpse: true, allowSociallyImproper: true))
     {
         return(foodSource);
     }
     return(null);
 }
        protected override Thing BestIngestTarget(Pawn pawn)
        {
            Thing    result   = default(Thing);
            ThingDef thingDef = default(ThingDef);

            if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, true, out result, out thingDef, false, true, true, true, true, false))
            {
                return(result);
            }
            return(null);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Job result;

            if (!base.ShouldTakeCareOfPrisoner(pawn, t))
            {
                result = null;
            }
            else
            {
                Pawn     pawn2 = (Pawn)t;
                Thing    thing;
                ThingDef thingDef;
                if (!pawn2.guest.CanBeBroughtFood)
                {
                    result = null;
                }
                else if (!pawn2.Position.IsInPrisonCell(pawn2.Map))
                {
                    result = null;
                }
                else if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.02f)
                {
                    result = null;
                }
                else if (WardenFeedUtility.ShouldBeFed(pawn2))
                {
                    result = null;
                }
                else if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out thingDef, false, true, false, false, false, false, false))
                {
                    result = null;
                }
                else if (thing.GetRoom(RegionType.Set_Passable) == pawn2.GetRoom(RegionType.Set_Passable))
                {
                    result = null;
                }
                else if (WorkGiver_Warden_DeliverFood.FoodAvailableInRoomTo(pawn2))
                {
                    result = null;
                }
                else
                {
                    float nutrition = FoodUtility.GetNutrition(thing, thingDef);
                    result = new Job(JobDefOf.DeliverFood, thing, pawn2)
                    {
                        count   = FoodUtility.WillIngestStackCountOf(pawn2, thingDef, nutrition),
                        targetC = RCellFinder.SpotToChewStandingNear(pawn2, thing)
                    };
                }
            }
            return(result);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = (Pawn)t;

            if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out var foodSource, out var foodDef, canRefillDispenser: false))
            {
                float nutrition = FoodUtility.GetNutrition(foodSource, foodDef);
                Job   job       = JobMaker.MakeJob(JobDefOf.FeedPatient);
                job.targetA = foodSource;
                job.targetB = pawn2;
                job.count   = FoodUtility.WillIngestStackCountOf(pawn2, foodDef, nutrition);
                return(job);
            }
            return(null);
        }
Пример #9
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn     pawn2 = (Pawn)t;
            Thing    t2    = default(Thing);
            ThingDef def   = default(ThingDef);

            if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out t2, out def, false, true, false, true, false, false))
            {
                Job job = new Job(JobDefOf.FeedPatient);
                job.targetA = t2;
                job.targetB = pawn2;
                job.count   = FoodUtility.WillIngestStackCountOf(pawn2, def);
                return(job);
            }
            return(null);
        }
        protected override Thing BestIngestTarget(Pawn pawn)
        {
            Thing    thing;
            ThingDef thingDef;
            Thing    result;

            if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, true, out thing, out thingDef, false, true, true, true, true, false, false))
            {
                result = thing;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Пример #11
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;
            bool result;

            if (pawn2 == null || pawn2 == pawn)
            {
                result = false;
            }
            else if (this.def.feedHumanlikesOnly && !pawn2.RaceProps.Humanlike)
            {
                result = false;
            }
            else if (this.def.feedAnimalsOnly && !pawn2.RaceProps.Animal)
            {
                result = false;
            }
            else if (pawn2.needs.food == null || pawn2.needs.food.CurLevelPercentage > pawn2.needs.food.PercentageThreshHungry + 0.02f)
            {
                result = false;
            }
            else if (!FeedPatientUtility.ShouldBeFed(pawn2))
            {
                result = false;
            }
            else
            {
                LocalTargetInfo target = t;
                Thing           thing;
                ThingDef        thingDef;
                if (!pawn.CanReserve(target, 1, -1, null, forced))
                {
                    result = false;
                }
                else if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out thingDef, false, true, false, true, false, false, false))
                {
                    JobFailReason.Is("NoFood".Translate(), null);
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!base.ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;

            if (!pawn2.guest.CanBeBroughtFood)
            {
                return(null);
            }
            if (!pawn2.Position.IsInPrisonCell(pawn2.Map))
            {
                return(null);
            }
            if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.019999999552965164)
            {
                return(null);
            }
            if (WardenFeedUtility.ShouldBeFed(pawn2))
            {
                return(null);
            }
            Thing    thing = default(Thing);
            ThingDef def   = default(ThingDef);

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out def, false, true, false, false, false, false))
            {
                return(null);
            }
            if (thing.GetRoom(RegionType.Set_Passable) == pawn2.GetRoom(RegionType.Set_Passable))
            {
                return(null);
            }
            if (WorkGiver_Warden_DeliverFood.FoodAvailableInRoomTo(pawn2))
            {
                return(null);
            }
            Job job = new Job(JobDefOf.DeliverFood, thing, pawn2);

            job.count   = FoodUtility.WillIngestStackCountOf(pawn2, def);
            job.targetC = RCellFinder.SpotToChewStandingNear(pawn2, thing);
            return(job);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn     pawn2 = (Pawn)t;
            Thing    thing;
            ThingDef thingDef;

            if (FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out thingDef, false, true, false, true, false, false, false))
            {
                float nutrition = FoodUtility.GetNutrition(thing, thingDef);
                return(new Job(JobDefOf.FeedPatient)
                {
                    targetA = thing,
                    targetB = pawn2,
                    count = FoodUtility.WillIngestStackCountOf(pawn2, thingDef, nutrition)
                });
            }
            return(null);
        }
Пример #14
0
        public static void DebugDrawPredatorFoodSource()
        {
            Pawn     pawn     = Find.Selector.SingleSelectedThing as Pawn;
            Thing    thing    = default(Thing);
            ThingDef thingDef = default(ThingDef);

            if (pawn != null && FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, true, out thing, out thingDef, false, false, false, true, false, false))
            {
                GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), thing.Position.ToVector3Shifted());
                if (!(thing is Pawn))
                {
                    Pawn pawn2 = FoodUtility.BestPawnToHuntForPredator(pawn);
                    if (pawn2 != null)
                    {
                        GenDraw.DrawLineBetween(pawn.Position.ToVector3Shifted(), pawn2.Position.ToVector3Shifted());
                    }
                }
            }
        }
Пример #15
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;

            if (!pawn2.guest.CanBeBroughtFood)
            {
                return(null);
            }
            if (!pawn2.Position.IsInPrisonCell(pawn2.Map))
            {
                return(null);
            }
            if (pawn2.needs.food.CurLevelPercentage >= pawn2.needs.food.PercentageThreshHungry + 0.02f)
            {
                return(null);
            }
            if (WardenFeedUtility.ShouldBeFed(pawn2))
            {
                return(null);
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out Thing foodSource, out ThingDef foodDef, canRefillDispenser: false, canUseInventory: true, allowForbidden: false, allowCorpse: false))
            {
                return(null);
            }
            if (foodSource.GetRoom() == pawn2.GetRoom())
            {
                return(null);
            }
            if (FoodAvailableInRoomTo(pawn2))
            {
                return(null);
            }
            float nutrition = FoodUtility.GetNutrition(foodSource, foodDef);
            Job   job       = new Job(JobDefOf.DeliverFood, foodSource, pawn2);

            job.count   = FoodUtility.WillIngestStackCountOf(pawn2, foodDef, nutrition);
            job.targetC = RCellFinder.SpotToChewStandingNear(pawn2, foodSource);
            return(job);
        }
Пример #16
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;

            if (pawn2 != null && pawn2 != pawn)
            {
                if (base.def.feedHumanlikesOnly && !pawn2.RaceProps.Humanlike)
                {
                    return(false);
                }
                if (base.def.feedAnimalsOnly && !pawn2.RaceProps.Animal)
                {
                    return(false);
                }
                if (pawn2.needs.food != null && !(pawn2.needs.food.CurLevelPercentage > pawn2.needs.food.PercentageThreshHungry + 0.019999999552965164))
                {
                    if (!FeedPatientUtility.ShouldBeFed(pawn2))
                    {
                        return(false);
                    }
                    LocalTargetInfo target = t;
                    if (!pawn.CanReserve(target, 1, -1, null, forced))
                    {
                        return(false);
                    }
                    Thing    thing    = default(Thing);
                    ThingDef thingDef = default(ThingDef);
                    if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out thing, out thingDef, false, true, false, true, false, false))
                    {
                        JobFailReason.Is("NoFood".Translate());
                        return(false);
                    }
                    return(true);
                }
                return(false);
            }
            return(false);
        }
Пример #17
0
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;

            if (pawn2 == null || pawn2 == pawn)
            {
                return(false);
            }
            if (def.feedHumanlikesOnly && !pawn2.RaceProps.Humanlike)
            {
                return(false);
            }
            if (def.feedAnimalsOnly && !pawn2.RaceProps.Animal)
            {
                return(false);
            }
            if (pawn2.needs.food == null || pawn2.needs.food.CurLevelPercentage > pawn2.needs.food.PercentageThreshHungry + 0.02f)
            {
                return(false);
            }
            if (!FeedPatientUtility.ShouldBeFed(pawn2))
            {
                return(false);
            }
            LocalTargetInfo target = t;
            bool            ignoreOtherReservations = forced;

            if (!pawn.CanReserve(target, 1, -1, null, ignoreOtherReservations))
            {
                return(false);
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn2, pawn2.needs.food.CurCategory == HungerCategory.Starving, out Thing _, out ThingDef _, canRefillDispenser: false))
            {
                JobFailReason.Is("NoFood".Translate());
                return(false);
            }
            return(true);
        }
Пример #18
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Need_Food food = pawn.needs.food;

            if (food == null || food.CurCategory < this.minCategory)
            {
                return(null);
            }
            bool flag;

            if (pawn.AnimalOrWildMan())
            {
                flag = true;
            }
            else
            {
                Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition, false);
                flag = (firstHediffOfDef != null && firstHediffOfDef.Severity > 0.4f);
            }
            bool     flag2              = pawn.needs.food.CurCategory == HungerCategory.Starving;
            bool     desperate          = flag2;
            bool     canRefillDispenser = true;
            bool     canUseInventory    = true;
            bool     allowCorpse        = flag;
            bool     flag3              = this.forceScanWholeMap;
            Thing    thing;
            ThingDef thingDef;

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out thing, out thingDef, canRefillDispenser, canUseInventory, false, allowCorpse, false, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            Pawn pawn2 = thing as Pawn;

            if (pawn2 != null)
            {
                return(new Job(JobDefOf.PredatorHunt, pawn2)
                {
                    killIncappedTarget = true
                });
            }
            if (thing is Plant && thing.def.plant.harvestedThingDef == thingDef)
            {
                return(new Job(JobDefOf.Harvest, thing));
            }
            Building_NutrientPasteDispenser building_NutrientPasteDispenser = thing as Building_NutrientPasteDispenser;

            if (building_NutrientPasteDispenser != null && !building_NutrientPasteDispenser.HasEnoughFeedstockInHoppers())
            {
                Building building = building_NutrientPasteDispenser.AdjacentReachableHopper(pawn);
                if (building != null)
                {
                    ISlotGroupParent hopperSgp = building as ISlotGroupParent;
                    Job job = WorkGiver_CookFillHopper.HopperFillFoodJob(pawn, hopperSgp);
                    if (job != null)
                    {
                        return(job);
                    }
                }
                thing = FoodUtility.BestFoodSourceOnMap(pawn, pawn, flag2, out thingDef, FoodPreferability.MealLavish, false, !pawn.IsTeetotaler(), false, false, false, false, false, false, this.forceScanWholeMap);
                if (thing == null)
                {
                    return(null);
                }
            }
            float nutrition = FoodUtility.GetNutrition(thing, thingDef);

            return(new Job(JobDefOf.Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
            });
        }
Пример #19
0
        // Token: 0x060004FD RID: 1277 RVA: 0x000321F8 File Offset: 0x000305F8
        protected override Job TryGiveJob(Pawn pawn)
        {
            Need_Food    food  = pawn.needs.food;
            LifeStageDef stage = pawn.ageTracker.CurLifeStage;

            if (stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
            {
                return(null);
            }

            bool flag;

            if (pawn.AnimalOrWildMan())
            {
                flag = true;
            }
            else
            {
                Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition, false);
                flag = (firstHediffOfDef != null && firstHediffOfDef.Severity > 0.4f);
            }
            bool     flag2     = pawn.needs.food.CurCategory == HungerCategory.Starving;
            bool     desperate = flag2;
            Thing    thing;
            ThingDef thingDef;
            bool     canRefillDispenser = false;
            bool     canUseInventory    = false;
            bool     allowCorpse        = true;
            bool     flag3 = false;

            if (pawn.GetLord() != null && pawn.GetLord() is Lord L)
            {
                if (L.CurLordToil is LordToil_DefendAndExpandHiveLike Hivelord)
                {
                    if (Hivelord.Data.assignedHiveLikes.TryGetValue(pawn) != null)
                    {
                        if (!Hivelord.Data.assignedHiveLikes.TryGetValue(pawn).active)
                        {
                            return(null);
                        }
                    }
                }
            }
            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out thing, out thingDef, canRefillDispenser, canUseInventory, true, allowCorpse, true, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            if (thing.GetType() != typeof(Corpse))
            {
                return(null);
            }
            Pawn pawn2 = thing as Pawn;

            if (pawn2 != null && pawn.CanSee(pawn2) && pawn.isXenomorph())
            {
                return(new Job(JobDefOf.PredatorHunt, pawn2)
                {
                    killIncappedTarget = true
                });
            }
            float nutrition = FoodUtility.GetNutrition(thing, thingDef);

            return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
            });
        }
Пример #20
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Need_Food food = pawn.needs.food;

            if (food == null || (int)food.CurCategory < (int)minCategory)
            {
                return(null);
            }
            bool flag;

            if (pawn.AnimalOrWildMan())
            {
                flag = true;
            }
            else
            {
                Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition);
                flag = (firstHediffOfDef != null && firstHediffOfDef.Severity > 0.4f);
            }
            bool     flag2              = pawn.needs.food.CurCategory == HungerCategory.Starving;
            bool     desperate          = flag2;
            bool     canRefillDispenser = true;
            bool     canUseInventory    = true;
            bool     allowCorpse        = flag;
            bool     flag3              = forceScanWholeMap;
            Thing    foodSource         = default(Thing);
            ThingDef foodDef            = default(ThingDef);

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out foodSource, out foodDef, canRefillDispenser, canUseInventory, allowForbidden: false, allowCorpse, allowSociallyImproper: false, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            Pawn pawn2 = foodSource as Pawn;

            if (pawn2 != null)
            {
                Job job = new Job(JobDefOf.PredatorHunt, pawn2);
                job.killIncappedTarget = true;
                return(job);
            }
            if (foodSource is Plant && foodSource.def.plant.harvestedThingDef == foodDef)
            {
                return(new Job(JobDefOf.Harvest, foodSource));
            }
            Building_NutrientPasteDispenser building_NutrientPasteDispenser = foodSource as Building_NutrientPasteDispenser;

            if (building_NutrientPasteDispenser != null && !building_NutrientPasteDispenser.HasEnoughFeedstockInHoppers())
            {
                Building building = building_NutrientPasteDispenser.AdjacentReachableHopper(pawn);
                if (building != null)
                {
                    ISlotGroupParent hopperSgp = building as ISlotGroupParent;
                    Job job2 = WorkGiver_CookFillHopper.HopperFillFoodJob(pawn, hopperSgp);
                    if (job2 != null)
                    {
                        return(job2);
                    }
                }
                foodSource = FoodUtility.BestFoodSourceOnMap(pawn, pawn, flag2, out foodDef, FoodPreferability.MealLavish, allowPlant: false, !pawn.IsTeetotaler(), allowCorpse: false, allowDispenserFull: false, allowDispenserEmpty: false, allowForbidden: false, allowSociallyImproper: false, allowHarvest: false, forceScanWholeMap);
                if (foodSource == null)
                {
                    return(null);
                }
            }
            float nutrition = FoodUtility.GetNutrition(foodSource, foodDef);
            Job   job3      = new Job(JobDefOf.Ingest, foodSource);

            job3.count = FoodUtility.WillIngestStackCountOf(pawn, foodDef, nutrition);
            return(job3);
        }
        // Token: 0x060004FD RID: 1277 RVA: 0x000321F8 File Offset: 0x000305F8
        protected override Job TryGiveJob(Pawn pawn)
        {
            bool         selected           = Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode;
            Need_Food    food               = pawn.needs.food;
            LifeStageDef stage              = pawn.ageTracker.CurLifeStage;
            bool         desperate          = food.CurCategory >= HungerCategory.Starving;
            bool         canRefillDispenser = false;
            bool         canUseInventory    = false;
            bool         allowCorpse        = true;
            bool         flag3              = this.forceScanWholeMap;

            if (stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
            {
                if (selected)
                {
                    Log.Message(string.Format("adult {0} @ {1}", pawn, pawn.Position));
                }
                if (food.CurCategory == HungerCategory.Fed)
                {
                    return(null);
                }
            }
            else
            {
                if (selected)
                {
                    Log.Message(string.Format("young {0} @ {1}", pawn, pawn.Position));
                }

                /*
                 * if (food.CurCategory == HungerCategory.Fed)
                 * {
                 *  return null;
                 * }
                 */
            }

            float nutrition;

            if (!FoodUtility.TryFindBestFoodSourceFor(pawn, pawn, desperate, out Thing thing, out ThingDef thingDef, canRefillDispenser, canUseInventory, true, allowCorpse, true, pawn.IsWildMan(), flag3))
            {
                return(null);
            }
            if (thing is Corpse corpse)
            {
                if (selected)
                {
                    Log.Message(string.Format("{0} is corpse @ {1}", thing, thing.Position));
                }
                nutrition = FoodUtility.GetNutrition(thing, thingDef);
                return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
                {
                    count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
                });
            }
            if (thing is Pawn pawn2)
            {
                if (selected)
                {
                    Log.Message(string.Format("{0} is pawn @ {1}", thing, thing.Position));
                }
                if (pawn2 != null)
                {
                    return(new Job(JobDefOf.PredatorHunt, pawn2)
                    {
                        killIncappedTarget = true
                    });
                }
            }
            nutrition = FoodUtility.GetNutrition(thing, thingDef);
            if (selected)
            {
                Log.Message(string.Format("{0} is thing @ {1}", thing, thing.Position));
            }
            return(new Job(XenomorphDefOf.RRY_Neomorph_Ingest, thing)
            {
                count = FoodUtility.WillIngestStackCountOf(pawn, thingDef, nutrition)
            });
        }