protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false));

            Toil gotoCell = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            gotoCell.AddPreTickAction(delegate
            {
                if (this.$this.Map.exitMapGrid.IsExitCell(this.$this.pawn.Position))
                {
                    this.$this.pawn.ExitMap(true);
                }
            });
            yield return(gotoCell);

            yield return(new Toil
            {
                initAction = delegate
                {
                    if (this.$this.pawn.Position.OnEdge(this.$this.pawn.Map) || this.$this.pawn.Map.exitMapGrid.IsExitCell(this.$this.pawn.Position))
                    {
                        this.$this.pawn.ExitMap(true);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
Beispiel #2
0
        // Token: 0x06000373 RID: 883 RVA: 0x0001EF58 File Offset: 0x0001D358
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false));

            Toil gotoCell = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            gotoCell.AddPreTickAction(delegate
            {
                if (base.Map.exitMapGrid.IsExitCell(this.pawn.Position))
                {
                    this.pawn.ExitMap(true, CellRect.WholeMap(base.Map).GetClosestEdge(this.pawn.Position));
                }
            });
            yield return(gotoCell);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    IntVec3 position = this.position;
                    Thing thing;
                    this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A));

            Toil toil = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            toil.AddPreTickAction(delegate
            {
                if (base.Map.exitMapGrid.IsExitCell(pawn.Position))
                {
                    pawn.ExitMap(allowedToJoinOrCreateCaravan: true, CellRect.WholeMap(base.Map).GetClosestEdge(pawn.Position));
                }
            });
            toil.FailOn(() => job.failIfCantJoinOrCreateCaravan && !CaravanExitMapUtility.CanExitMapAndJoinOrCreateCaravanNow(pawn));
            yield return(toil);

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                if (pawn.Position.OnEdge(pawn.Map) || pawn.Map.exitMapGrid.IsExitCell(pawn.Position))
                {
                    pawn.ExitMap(allowedToJoinOrCreateCaravan: true, CellRect.WholeMap(base.Map).GetClosestEdge(pawn.Position));
                }
            };
            toil2.FailOn(() => job.failIfCantJoinOrCreateCaravan && !CaravanExitMapUtility.CanExitMapAndJoinOrCreateCaravanNow(pawn));
            toil2.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil2);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            yield return(Toils_Goto.MoveOffTargetBlueprint(TargetIndex.A));

            yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.A));
        }
Beispiel #5
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = Toils_Goto.MoveOffTargetBlueprint(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

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

                case 3u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
Beispiel #6
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDestroyedOrNull(TargetIndex.A);
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

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

                case 3u:
                    gotoCell = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);
                    gotoCell.AddPreTickAction(delegate
                    {
                        if (base.Map.exitMapGrid.IsExitCell(this.pawn.Position))
                        {
                            this.pawn.ExitMap(true, CellRect.WholeMap(base.Map).GetClosestEdge(this.pawn.Position));
                        }
                    });
                    this.$current = gotoCell;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                {
                    Toil arrive = new Toil();
                    arrive.initAction = delegate()
                    {
                        if (this.pawn.Position.OnEdge(this.pawn.Map) || this.pawn.Map.exitMapGrid.IsExitCell(this.pawn.Position))
                        {
                            this.pawn.ExitMap(true, CellRect.WholeMap(base.Map).GetClosestEdge(this.pawn.Position));
                        }
                    };
                    arrive.defaultCompleteMode = ToilCompleteMode.Instant;
                    this.$current = arrive;
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);
                }

                case 5u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }