public static Toil FinalizeIngestAnything(Pawn ingester, TargetIndex ingestibleInd, CompEatWeirdFood comp)
        {
            Toil toil = new Toil();

            toil.initAction = delegate()
            {
                Pawn  actor  = toil.actor;
                Job   curJob = actor.jobs.curJob;
                Thing thing  = curJob.GetTarget(ingestibleInd).Thing;

                float num = ingester.needs.food.NutritionWanted;
                if (curJob.overeat)
                {
                    num = Mathf.Max(num, 0.75f);
                }
                float num2 = comp.Props.nutrition;// thing.Ingested(ingester, num);
                if (comp.Props.fullyDestroyThing)
                {
                    if (comp.Props.drainBattery)
                    {
                        Building_Battery battery = thing as Building_Battery;
                        if (battery != null)
                        {
                            CompPowerBattery compPower = battery.TryGetComp <CompPowerBattery>();
                            compPower.SetStoredEnergyPct(compPower.StoredEnergyPct - comp.Props.percentageDrain);
                        }
                        else
                        {
                            thing.Destroy(DestroyMode.Vanish);
                        }
                    }
                    else
                    {
                        thing.Destroy(DestroyMode.Vanish);
                    }
                }
                else
                {
                    if (thing.def.useHitPoints)
                    {
                        thing.HitPoints -= (int)(thing.MaxHitPoints * comp.Props.percentageOfDestruction);
                        if (thing.HitPoints <= 0)
                        {
                            thing.Destroy(DestroyMode.Vanish);
                        }
                    }
                    else
                    {
                        int thingsToDestroy = (int)(comp.Props.percentageOfDestruction * thing.def.stackLimit);
                        //Log.Message(thingsToDestroy.ToString());

                        thing.stackCount = thing.stackCount - thingsToDestroy;
                        //Log.Message(thing.stackCount.ToString());
                        if (thing.stackCount < 10)
                        {
                            thing.Destroy(DestroyMode.Vanish);
                        }
                    }
                    if ((actor.def.defName == "AA_AngelMoth") && (actor.Faction == Faction.OfPlayer) && (thing.TryGetComp <CompQuality>() != null) && (thing.TryGetComp <CompQuality>().Quality == QualityCategory.Legendary))
                    {
                        actor.health.AddHediff(HediffDef.Named("AA_AteFinestClothes"));
                    }
                }

                if (comp.Props.hediffWhenEaten != "")
                {
                    actor.health.AddHediff(HediffDef.Named(comp.Props.hediffWhenEaten));
                }

                if (comp.Props.advanceLifeStage && actor.Map != null)
                {
                    comp.currentFeedings++;
                    if (comp.currentFeedings >= comp.Props.advanceAfterXFeedings)
                    {
                        if (comp.Props.fissionAfterXFeedings)
                        {
                            if (!comp.Props.fissionOnlyIfTamed || actor.Faction.IsPlayer)
                            {
                                for (int i = 0; i < comp.Props.numberOfOffspring; i++)
                                {
                                    PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDef.Named(comp.Props.defToFissionTo), actor.Faction, PawnGenerationContext.NonPlayer, -1, true, true, false, false, true, false, 1f, false, true, true, false, false);
                                    Pawn newPawn = PawnGenerator.GeneratePawn(request);
                                    newPawn.playerSettings.AreaRestriction = actor.playerSettings.AreaRestriction;
                                    newPawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, actor);
                                    GenSpawn.Spawn(newPawn, actor.Position, actor.Map, WipeMode.Vanish);
                                }

                                actor.Destroy();
                            }
                        }
                        else
                        {
                            PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDef.Named(comp.Props.defToAdvanceTo), actor.Faction, PawnGenerationContext.NonPlayer, -1, true, true, false, false, true, false, 1f, false, true, true, false, false);
                            Pawn newPawn = PawnGenerator.GeneratePawn(request);
                            if (!actor.Name.ToString().UncapitalizeFirst().Contains(actor.def.label))
                            {
                                newPawn.Name = actor.Name;
                            }
                            newPawn.training        = actor.training;
                            newPawn.health          = actor.health;
                            newPawn.foodRestriction = actor.foodRestriction;
                            newPawn.playerSettings.AreaRestriction = actor.playerSettings.AreaRestriction;
                            GenSpawn.Spawn(newPawn, actor.Position, actor.Map, WipeMode.Vanish);
                            actor.Destroy();
                        }
                    }
                }

                if (!ingester.Dead)
                {
                    ingester.needs.food.CurLevel += num2;
                }
                ingester.records.AddTo(RecordDefOf.NutritionEaten, num2);
            };
            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            return(toil);
        }