private IEnumerable <Toil> PrepareToIngestToils_ToolUser(Toil chewToil)
        {
            yield return(ReserveFood());

            Toil gotoToPickup = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A);

            yield return(Toils_Jump.JumpIf(gotoToPickup, () => pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A));

            yield return(Toils_Jump.Jump(chewToil));

            yield return(gotoToPickup);

            yield return(Toils_MonsterIngest.PickupIngestible(TargetIndex.A, pawn));

            if (job.takeExtraIngestibles > 0)
            {
                foreach (Toil item in TakeExtraIngestibles())
                {
                    yield return(item);
                }
            }
            if (!pawn.Drafted)
            {
                yield return(Toils_MonsterIngest.CarryIngestibleToChewSpot(pawn, TargetIndex.A).FailOnDestroyedOrNull(TargetIndex.A));
            }
            yield return(Toils_MonsterIngest.FindAdjacentEatSurface(TargetIndex.B, TargetIndex.A));
        }
        private IEnumerable <Toil> TakeExtraIngestibles()
        {
            if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))
            {
                yield break;
            }
            Toil reserveExtraFoodToCollect = Toils_MonsterIngest.ReserveFoodFromStackForIngesting(TargetIndex.C);
            Toil findExtraFoodToCollect    = new Toil
            {
                initAction = delegate
                {
                    if (pawn.inventory.innerContainer.TotalStackCountOfDef(IngestibleSource.def) < job.takeExtraIngestibles)
                    {
                        Thing thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(IngestibleSource.def), PathEndMode.Touch, TraverseParms.For(pawn), 30f, (Thing x) => pawn.CanReserve(x, 10, 1) && !x.IsForbidden(pawn) && x.IsSociallyProper(pawn));
                        if (thing != null)
                        {
                            job.SetTarget(TargetIndex.C, thing);
                            JumpToToil(reserveExtraFoodToCollect);
                        }
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            yield return(Toils_Jump.Jump(findExtraFoodToCollect));

            yield return(reserveExtraFoodToCollect);

            yield return(Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.Touch));

            yield return(Toils_Haul.TakeToInventory(TargetIndex.C, () => job.takeExtraIngestibles - pawn.inventory.innerContainer.TotalStackCountOfDef(IngestibleSource.def)));

            yield return(findExtraFoodToCollect);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil chew = Toils_MonsterIngest.ChewIngestible(pawn, ChewDurationMultiplier, TargetIndex.A, TargetIndex.B).FailOn((Toil x) => !IngestibleSource.Spawned && (pawn.carryTracker == null || pawn.carryTracker.CarriedThing != IngestibleSource)).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);

            foreach (Toil item in PrepareToIngestToils(chew))
            {
                yield return(item);
            }
            yield return(chew);

            yield return(Toils_MonsterIngest.FinalizeIngest(pawn, TargetIndex.A));

            yield return(Toils_Jump.JumpIf(chew, () => job.GetTarget(TargetIndex.A).Thing is Corpse && pawn.needs.food.CurLevelPercentage < 0.9f));
        }