protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(Deliveree));
            if (pawn.inventory != null && pawn.inventory.Contains(base.TargetThingA))
            {
                yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A));
            }
            else if (base.TargetThingA is Building_NutrientPasteDispenser)
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, pawn));
            }
            else
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, Deliveree));
            }
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));

            yield return(Toils_Ingest.ChewIngestible(Deliveree, 1.5f, TargetIndex.A).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch));

            yield return(Toils_Ingest.FinalizeIngest(Deliveree, TargetIndex.A));
        }
        // Token: 0x0600003F RID: 63 RVA: 0x00004036 File Offset: 0x00002236
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(this.Deliveree));
            bool flag = base.TargetThingA is Building_NutrientPasteDispenser;

            if (flag)
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn));
            }
            else
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, this.Deliveree));
            }
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));

            yield return(Toils_Ingest.ChewIngestible(this.Deliveree, 1.5f, TargetIndex.A, TargetIndex.None).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch));

            yield return(Toils_Ingest.FinalizeIngest(this.Deliveree, TargetIndex.A));

            yield break;
        }
Example #3
0
        private IEnumerable <Toil> PrepareToIngestToils_Dispenser()
        {
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnDespawnedNullOrForbidden(TargetIndex.A));

            yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn));

            yield return(Toils_Ingest.CarryIngestibleToChewSpot(this.pawn, TargetIndex.A).FailOnDestroyedNullOrForbidden(TargetIndex.A));

            yield return(Toils_Ingest.FindAdjacentEatSurface(TargetIndex.B, TargetIndex.A));
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.B);
            if (eatingFromInventory)
            {
                yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A));
            }
            else if (usingNutrientPasteDispenser)
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, pawn));
            }
            else
            {
                yield return(Toils_Ingest.ReserveFoodFromStackForIngesting(TargetIndex.A, Deliveree));

                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A));

                yield return(Toils_Ingest.PickupIngestible(TargetIndex.A, Deliveree));
            }
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn actor  = toil.actor;
                Job  curJob = actor.jobs.curJob;
                actor.pather.StartPath(curJob.targetC, PathEndMode.OnCell);
            };
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            toil.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            toil.AddFailCondition(delegate
            {
                Pawn pawn = (Pawn)toil.actor.jobs.curJob.targetB.Thing;
                if (!pawn.IsPrisonerOfColony)
                {
                    return(true);
                }
                return((!pawn.guest.CanBeBroughtFood) ? true : false);
            });
            yield return(toil);

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                pawn.carryTracker.TryDropCarriedThing(toil2.actor.jobs.curJob.targetC.Cell, ThingPlaceMode.Direct, out Thing _);
            };
            toil2.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil2);
        }
Example #5
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                Toil toil;

                switch (num)
                {
                case 0u:
                    this.FailOnDespawnedOrNull(TargetIndex.B);
                    if (this.eatingFromInventory)
                    {
                        this.$current = Toils_Misc.TakeItemFromInventoryToCarrier(this.pawn, TargetIndex.A);
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    if (this.usingNutrientPasteDispenser)
                    {
                        this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A);
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        return(true);
                    }
                    this.$current = Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null);
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 1u:
                    break;

                case 2u:
                    this.$current = Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    break;

                case 4u:
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                    this.$current = Toils_Ingest.PickupIngestible(TargetIndex.A, base.Deliveree);
                    if (!this.$disposing)
                    {
                        this.$PC = 6;
                    }
                    return(true);

                case 6u:
                    break;

                case 7u:
                {
                    Toil toil = new Toil();
                    toil.initAction = delegate()
                    {
                        Thing thing;
                        this.pawn.carryTracker.TryDropCarriedThing(toil.actor.jobs.curJob.targetC.Cell, ThingPlaceMode.Direct, out thing, null);
                    };
                    toil.defaultCompleteMode = ToilCompleteMode.Instant;
                    this.$current            = toil;
                    if (!this.$disposing)
                    {
                        this.$PC = 8;
                    }
                    return(true);
                }

                case 8u:
                    this.$PC = -1;
                    return(false);

                default:
                    return(false);
                }
                toil            = new Toil();
                toil.initAction = delegate()
                {
                    Pawn actor  = toil.actor;
                    Job  curJob = actor.jobs.curJob;
                    actor.pather.StartPath(curJob.targetC, PathEndMode.OnCell);
                };
                toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
                toil.FailOnDestroyedNullOrForbidden(TargetIndex.B);
                toil.AddFailCondition(delegate
                {
                    Pawn pawn = (Pawn)toil.actor.jobs.curJob.targetB.Thing;
                    return(!pawn.IsPrisonerOfColony || !pawn.guest.CanBeBroughtFood);
                });
                this.$current = toil;
                if (!this.$disposing)
                {
                    this.$PC = 7;
                }
                return(true);
            }
Example #6
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDespawnedNullOrForbidden(TargetIndex.B);
                    this.FailOn(() => !FoodUtility.ShouldBeFedBySomeone(base.Deliveree));
                    if (this.pawn.inventory != null && this.pawn.inventory.Contains(base.TargetThingA))
                    {
                        this.$current = Toils_Misc.TakeItemFromInventoryToCarrier(this.pawn, TargetIndex.A);
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    if (base.TargetThingA is Building_NutrientPasteDispenser)
                    {
                        this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnForbidden(TargetIndex.A);
                        if (!this.$disposing)
                        {
                            this.$PC = 2;
                        }
                        return(true);
                    }
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnForbidden(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 1u:
                    break;

                case 2u:
                    this.$current = Toils_Ingest.TakeMealFromDispenser(TargetIndex.A, this.pawn);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    break;

                case 4u:
                    this.$current = Toils_Ingest.PickupIngestible(TargetIndex.A, base.Deliveree);
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                    break;

                case 6u:
                    this.$current = Toils_Ingest.ChewIngestible(base.Deliveree, 1.5f, TargetIndex.A, TargetIndex.None).FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch);
                    if (!this.$disposing)
                    {
                        this.$PC = 7;
                    }
                    return(true);

                case 7u:
                    this.$current = Toils_Ingest.FinalizeIngest(base.Deliveree, TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 8;
                    }
                    return(true);

                case 8u:
                    this.$PC = -1;
                    return(false);

                default:
                    return(false);
                }
                this.$current = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch);
                if (!this.$disposing)
                {
                    this.$PC = 6;
                }
                return(true);
            }