protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(this.$this.Container));
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

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

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

            yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, TargetIndex.A));

            Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer();

            yield return(carryToContainer);

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

            yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, TargetIndex.C));
        }
Ejemplo n.º 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(CarryThingIndex);
            this.FailOnDestroyedNullOrForbidden(DestIndex);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(Container));
            this.FailOn(() =>
            {
                var thingOwner = Container.TryGetInnerInteractableThingOwner();
                if (thingOwner != null && !thingOwner.CanAcceptAnyOf(ThingToCarry))
                {
                    return(true);
                }

                // e.g. grave
                var haulDestination = Container as IHaulDestination;
                if (haulDestination != null && !haulDestination.Accepts(ThingToCarry))
                {
                    return(true);
                }

                return(false);
            });

            var getToHaulTarget = Toils_Goto.GotoThing(CarryThingIndex, PathEndMode.ClosestTouch)
                                  .FailOnSomeonePhysicallyInteracting(CarryThingIndex);

            yield return(getToHaulTarget);

            yield return(Toils_Construct.UninstallIfMinifiable(CarryThingIndex)
                         .FailOnSomeonePhysicallyInteracting(CarryThingIndex));

            yield return(Toils_Haul.StartCarryThing(CarryThingIndex, subtractNumTakenFromJobCount: true));

            yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, CarryThingIndex));

            Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer();

            yield return(carryToContainer);

            yield return(Toils_Goto.MoveOffTargetBlueprint(DestIndex));

            //Prepare
            {
                var prepare = Toils_General.Wait(Duration, face: DestIndex);
                prepare.WithProgressBarToilDelay(DestIndex);
                yield return(prepare);
            }

            yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(DestIndex, PrimaryDestIndex));

            yield return(Toils_Haul.DepositHauledThingInContainer(DestIndex, PrimaryDestIndex));

            yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, PrimaryDestIndex));
        }
Ejemplo n.º 3
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(this.Container));
            this.FailOn(delegate()
            {
                ThingOwner thingOwner = this.Container.TryGetInnerInteractableThingOwner();
                bool result;
                if (thingOwner != null && !thingOwner.CanAcceptAnyOf(this.ThingToCarry, true))
                {
                    result = true;
                }
                else
                {
                    IHaulDestination haulDestination = this.Container as IHaulDestination;
                    result = (haulDestination != null && !haulDestination.Accepts(this.ThingToCarry));
                }
                return(result);
            });
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

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

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

            yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, TargetIndex.A));

            Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer();

            yield return(carryToContainer);

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

            Toil prepare = Toils_General.Wait(this.Duration, TargetIndex.B);

            prepare.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f);
            yield return(prepare);

            yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, TargetIndex.C));

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(Container));
            this.FailOn(delegate
            {
                ThingOwner thingOwner = Container.TryGetInnerInteractableThingOwner();
                if (thingOwner != null && !thingOwner.CanAcceptAnyOf(ThingToCarry))
                {
                    return(true);
                }
                IHaulDestination haulDestination = Container as IHaulDestination;
                return((haulDestination != null && !haulDestination.Accepts(ThingToCarry)) ? true : false);
            });
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

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

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, putRemainderInQueue: false, subtractNumTakenFromJobCount: true));

            yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, TargetIndex.A));

            Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer();

            yield return(carryToContainer);

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

            Toil toil = Toils_General.Wait(Duration, TargetIndex.B);

            toil.WithProgressBarToilDelay(TargetIndex.B);
            yield return(toil);

            yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, TargetIndex.C));
        }
Ejemplo n.º 5
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDestroyedOrNull(TargetIndex.A);
                    this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
                    this.FailOn(() => TransporterUtility.WasLoadingCanceled(base.Container));
                    this.FailOn(delegate()
                    {
                        ThingOwner thingOwner = base.Container.TryGetInnerInteractableThingOwner();
                        bool result;
                        if (thingOwner != null && !thingOwner.CanAcceptAnyOf(base.ThingToCarry, true))
                        {
                            result = true;
                        }
                        else
                        {
                            IHaulDestination haulDestination = base.Container as IHaulDestination;
                            result = (haulDestination != null && !haulDestination.Accepts(base.ThingToCarry));
                        }
                        return(result);
                    });
                    getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);
                    this.$current   = getToHaulTarget;
                    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, true, false);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

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

                case 4u:
                    carryToContainer = Toils_Haul.CarryHauledThingToContainer();
                    this.$current    = carryToContainer;
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                    this.$current = Toils_Goto.MoveOffTargetBlueprint(TargetIndex.B);
                    if (!this.$disposing)
                    {
                        this.$PC = 6;
                    }
                    return(true);

                case 6u:
                    prepare = Toils_General.Wait(base.Duration, TargetIndex.B);
                    prepare.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f);
                    this.$current = prepare;
                    if (!this.$disposing)
                    {
                        this.$PC = 7;
                    }
                    return(true);

                case 7u:
                    this.$current = Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C);
                    if (!this.$disposing)
                    {
                        this.$PC = 8;
                    }
                    return(true);

                case 8u:
                    this.$current = Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C);
                    if (!this.$disposing)
                    {
                        this.$PC = 9;
                    }
                    return(true);

                case 9u:
                    this.$current = Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, TargetIndex.C);
                    if (!this.$disposing)
                    {
                        this.$PC = 10;
                    }
                    return(true);

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