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);
        }
예제 #2
0
 public static bool ShouldBeFedBySomeone(Pawn pawn)
 {
     if (!FeedPatientUtility.ShouldBeFed(pawn))
     {
         return(WardenFeedUtility.ShouldBeFed(pawn));
     }
     return(true);
 }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
 public static bool ShouldBeFedBySomeone(Pawn pawn)
 {
     return(FeedPatientUtility.ShouldBeFed(pawn) || WardenFeedUtility.ShouldBeFed(pawn));
 }
        // Token: 0x06000099 RID: 153 RVA: 0x00005684 File Offset: 0x00003884
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;
            bool flag  = pawn == null || pawn.CurJob != null;
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                bool flag2 = pawn2 == null || pawn2 == pawn;
                if (flag2)
                {
                    result = false;
                }
                else
                {
                    bool flag3 = this.def.feedHumanlikesOnly && !pawn2.RaceProps.Humanlike;
                    if (flag3)
                    {
                        result = false;
                    }
                    else
                    {
                        bool flag4 = this.def.feedAnimalsOnly && !pawn2.RaceProps.Animal;
                        if (flag4)
                        {
                            result = false;
                        }
                        else
                        {
                            bool flag5 = pawn2.needs.food == null || pawn2.needs.food.CurLevelPercentage > pawn2.needs.food.PercentageThreshHungry + 0.02f;
                            if (flag5)
                            {
                                result = false;
                            }
                            else
                            {
                                bool flag6 = !FeedPatientUtility.ShouldBeFed(pawn2);
                                if (flag6)
                                {
                                    result = false;
                                }
                                else
                                {
                                    LocalTargetInfo target = t;
                                    bool            flag7  = !pawn.CanReserve(target, 1, -1, null, forced);
                                    if (flag7)
                                    {
                                        result = false;
                                    }
                                    else
                                    {
                                        bool flag8 = !pawn.CanReserve(target, 1, -1, null, false);
                                        if (flag8)
                                        {
                                            result = false;
                                        }
                                        else
                                        {
                                            bool flag9 = pawn2.needs.food.CurLevelPercentage < pawn2.needs.food.PercentageThreshHungry + 0.02f && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation);
                                            result = flag9;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }