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));
        }
Exemplo n.º 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0065: stateMachine*/)._0024this.Container));
            this.FailOn(delegate
            {
                ThingOwner thingOwner = ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_007d: stateMachine*/)._0024this.Container.TryGetInnerInteractableThingOwner();
                if (thingOwner != null && !thingOwner.CanAcceptAnyOf(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_007d: stateMachine*/)._0024this.ThingToCarry))
                {
                    return(true);
                }
                IHaulDestination haulDestination = ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_007d: stateMachine*/)._0024this.Container as IHaulDestination;
                if (haulDestination != null && !haulDestination.Accepts(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_007d: stateMachine*/)._0024this.ThingToCarry))
                {
                    return(true);
                }
                return(false);
            });
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0061: stateMachine*/)._0024this.Container));
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 7
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            // This is mostly the same list of toils as HaulToContainer, except without reserving the container,
            // and also added some things from JobDriver_PrepareCaravan_GatherItems that handle coordination between
            // colonists. Many of the toils here seem to be intended for construction jobs and are thus probably not
            // necessary, but I'm leaving them in just in case. Possibly another mod will assume they're there, who knows.
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedNullOrForbidden(TargetIndex.B);
            this.FailOn(() => TransporterUtility.WasLoadingCanceled(this.Transporter));
            Toil reserve = Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null).FailOnDespawnedOrNull(TargetIndex.A);

            yield return(reserve);

            //yield return Toils_Reserve.ReserveQueue(TargetIndex.A, 1, -1, null);
            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A);

            yield return(getToHaulTarget);

            yield return(DetermineNumToHaul());

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

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

            yield return(AddCarriedThingToTransferables());

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None, true, (Thing x) => Transferable.things.Contains(x)));

            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));
        }
Exemplo n.º 8
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);
            }