public static int WillIngestStackCountOf(Pawn ingester, ThingDef def)
        {
            int num = Mathf.Min(def.ingestible.maxNumToIngestAtOnce, FoodUtility.StackCountForNutrition(def, ingester.needs.food.NutritionWanted));

            if (num < 1)
            {
                num = 1;
            }
            return(num);
        }
        private Toil StartFeedAnimal(TargetIndex tameeInd)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn actor = toil.GetActor();
                Pawn pawn  = (Pawn)(Thing)actor.CurJob.GetTarget(tameeInd);
                PawnUtility.ForceWait(pawn, 270, actor);
                Thing thing = FoodUtility.BestFoodInInventory(actor, pawn, FoodPreferability.NeverForNutrition, FoodPreferability.RawTasty);
                if (thing == null)
                {
                    actor.jobs.EndCurrentJob(JobCondition.Incompletable);
                }
                else
                {
                    actor.mindState.lastInventoryRawFoodUseTick = Find.TickManager.TicksGame;
                    int   num        = FoodUtility.StackCountForNutrition(feedNutritionLeft, thing.GetStatValue(StatDefOf.Nutrition));
                    int   stackCount = thing.stackCount;
                    Thing thing2     = actor.inventory.innerContainer.Take(thing, Mathf.Min(num, stackCount));
                    actor.carryTracker.TryStartCarry(thing2);
                    actor.CurJob.SetTarget(TargetIndex.B, thing2);
                    float num2 = (float)thing2.stackCount * thing2.GetStatValue(StatDefOf.Nutrition);
                    ticksLeftThisToil = Mathf.CeilToInt(270f * (num2 / RequiredNutritionPerFeed(pawn)));
                    if (num <= stackCount)
                    {
                        feedNutritionLeft = 0f;
                    }
                    else
                    {
                        feedNutritionLeft -= num2;
                        if (feedNutritionLeft < 0.001f)
                        {
                            feedNutritionLeft = 0f;
                        }
                    }
                }
            };
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.activeSkill         = () => SkillDefOf.Animals;
            return(toil);
        }
        private Toil StartFeedAnimal(TargetIndex tameeInd)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn actor = toil.GetActor();
                Pawn pawn  = (Pawn)(Thing)actor.CurJob.GetTarget(tameeInd);
                PawnUtility.ForceWait(pawn, 270, actor, false);
                Thing thing = FoodUtility.BestFoodInInventory(actor, pawn, FoodPreferability.NeverForNutrition, FoodPreferability.RawTasty, 0f, false);
                if (thing == null)
                {
                    actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                }
                else
                {
                    actor.mindState.lastInventoryRawFoodUseTick = Find.TickManager.TicksGame;
                    int   num        = FoodUtility.StackCountForNutrition(thing.def, this.feedNutritionLeft);
                    int   stackCount = thing.stackCount;
                    Thing thing2     = actor.inventory.innerContainer.Take(thing, Mathf.Min(num, stackCount));
                    actor.carryTracker.TryStartCarry(thing2);
                    actor.CurJob.SetTarget(TargetIndex.B, thing2);
                    float num2 = (float)thing2.stackCount * thing2.def.ingestible.nutrition;
                    base.ticksLeftThisToil = Mathf.CeilToInt((float)(270.0 * (num2 / JobDriver_InteractAnimal.RequiredNutritionPerFeed(pawn))));
                    if (num <= stackCount)
                    {
                        this.feedNutritionLeft = 0f;
                    }
                    else
                    {
                        this.feedNutritionLeft -= num2;
                        if (this.feedNutritionLeft < 0.0010000000474974513)
                        {
                            this.feedNutritionLeft = 0f;
                        }
                    }
                }
            };
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            return(toil);
        }