protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_General.DoAtomic(delegate
            {
                Pawn pawn = job.targetA.Thing as Pawn;
                if (pawn != null && pawn.Downed && base.pawn.mindState.duty != null && base.pawn.mindState.duty.attackDownedIfStarving && base.pawn.Starving())
                {
                    job.killIncappedTarget = true;
                }
            }));

            yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.A));

            yield return(Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, delegate
            {
                Thing thing = job.GetTarget(TargetIndex.A).Thing;
                Pawn p;
                if (job.reactingToMeleeThreat && (p = thing as Pawn) != null && !p.Awake())
                {
                    EndJobWith(JobCondition.InterruptForced);
                }
                else if (pawn.meleeVerbs.TryMeleeAttack(thing, job.verbToUse) && pawn.CurJob != null && pawn.jobs.curDriver == this)
                {
                    numMeleeAttacksMade++;
                    if (numMeleeAttacksMade >= job.maxNumMeleeAttacks)
                    {
                        EndJobWith(JobCondition.Succeeded);
                    }
                }
            }).FailOnDespawnedOrNull(TargetIndex.A));
        }
Пример #2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_General.DoAtomic(delegate
            {
                Pawn pawn = this.job.targetA.Thing as Pawn;
                if (pawn != null && pawn.Downed && this.pawn.mindState.duty != null && this.pawn.mindState.duty.attackDownedIfStarving && this.pawn.Starving())
                {
                    this.job.killIncappedTarget = true;
                }
            }));

            yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.A));

            yield return(Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, delegate
            {
                Thing thing = this.job.GetTarget(TargetIndex.A).Thing;
                if (this.pawn.meleeVerbs.TryMeleeAttack(thing, this.job.verbToUse, false))
                {
                    if (this.pawn.CurJob != null && this.pawn.jobs.curDriver == this)
                    {
                        this.numMeleeAttacksMade++;
                        if (this.numMeleeAttacksMade >= this.job.maxNumMeleeAttacks)
                        {
                            base.EndJobWith(JobCondition.Succeeded);
                        }
                    }
                }
            }).FailOnDespawnedOrNull(TargetIndex.A));

            yield break;
        }
Пример #3
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            yield return(Toils_General.StopDead());

            yield return(Toils_Combat.CastVerb(TargetIndex.A));
        }
Пример #4
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = Toils_General.DoAtomic(delegate
                    {
                        Pawn pawn = this.job.targetA.Thing as Pawn;
                        if (pawn != null && pawn.Downed && this.pawn.mindState.duty != null && this.pawn.mindState.duty.attackDownedIfStarving && this.pawn.Starving())
                        {
                            this.job.killIncappedTarget = true;
                        }
                    });
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

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

                case 2u:
                    this.$current = Toils_Combat.FollowAndMeleeAttack(TargetIndex.A, delegate
                    {
                        Thing thing = this.job.GetTarget(TargetIndex.A).Thing;
                        if (this.pawn.meleeVerbs.TryMeleeAttack(thing, this.job.verbToUse, false))
                        {
                            if (this.pawn.CurJob != null && this.pawn.jobs.curDriver == this)
                            {
                                this.numMeleeAttacksMade++;
                                if (this.numMeleeAttacksMade >= this.job.maxNumMeleeAttacks)
                                {
                                    base.EndJobWith(JobCondition.Succeeded);
                                }
                            }
                        }
                    }).FailOnDespawnedOrNull(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell));

            if (job.def.waitAfterArriving > 0)
            {
                yield return(Toils_General.Wait(job.def.waitAfterArriving));
            }
        }
Пример #6
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));
        }
Пример #7
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_General.DoAtomic(delegate
            {
                Pawn pawn = ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002a: stateMachine*/)._0024this.job.targetA.Thing as Pawn;
                if (pawn != null && pawn.Downed && ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002a: stateMachine*/)._0024this.pawn.mindState.duty != null && ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002a: stateMachine*/)._0024this.pawn.mindState.duty.attackDownedIfStarving && ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002a: stateMachine*/)._0024this.pawn.Starving())
                {
                    ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002a: stateMachine*/)._0024this.job.killIncappedTarget = true;
                }
            }));

            /*Error: Unable to find new state assignment for yield return*/;
        }
Пример #8
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));
        }
        // Token: 0x06000054 RID: 84 RVA: 0x0000427A File Offset: 0x0000247A
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_General.DoAtomic(delegate
            {
                Pawn pawn = this.job.targetA.Thing as Pawn;
                bool flag = pawn != null && pawn.Downed && this.pawn.mindState.duty != null && this.pawn.mindState.duty.attackDownedIfStarving && this.pawn.Starving();
                if (flag)
                {
                    this.job.killIncappedTarget = true;
                }
            }));

            yield return(Toils_Combat.TrySetJobToUseAttackVerb(TargetIndex.A));

            yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.A));

            yield return(Toils_Combat.GotoCastPosition(TargetIndex.A, false, 1f));

            yield return(Toils_Combat.CastVerb(TargetIndex.A, true));

            yield break;
        }
Пример #11
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);
            }