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);
            }
Example #2
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);
                    chooseCell    = Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.A, TargetIndex.B);
                    this.$current = chooseCell;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$current = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    play            = new Toil();
                    play.initAction = delegate()
                    {
                        this.job.locomotionUrgency = LocomotionUrgency.Walk;
                    };
                    play.tickAction = delegate()
                    {
                        this.pawn.rotationTracker.FaceCell(base.TargetA.Thing.OccupiedRect().ClosestCellTo(this.pawn.Position));
                        if (this.ticksLeftThisToil == 300)
                        {
                            SoundDefOf.PlayBilliards.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false));
                        }
                        if (Find.TickManager.TicksGame > this.startTick + this.job.def.joyDuration)
                        {
                            base.EndJobWith(JobCondition.Succeeded);
                        }
                        else
                        {
                            Pawn     pawn      = this.pawn;
                            Building joySource = (Building)base.TargetThingA;
                            JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource);
                        }
                    };
                    play.handlingFacing      = true;
                    play.socialMode          = RandomSocialMode.SuperActive;
                    play.defaultCompleteMode = ToilCompleteMode.Delay;
                    play.defaultDuration     = 600;
                    play.AddFinishAction(delegate
                    {
                        JoyUtility.TryGainRecRoomThought(this.pawn);
                    });
                    this.$current = play;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                    this.$current = Toils_Reserve.Release(TargetIndex.B);
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                    this.$current = Toils_Jump.Jump(chooseCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 6;
                    }
                    return(true);

                case 6u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
Example #3
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);
            }