示例#1
0
        /*
         * public static Building_HackingTable HackingTable(this Pawn pawn)
         * {
         *  List<Thing> thingList = pawn.Position.GetThingList(pawn.Map);
         *  Building_HackingTable hackingTable = null;
         *  for (int i = 0; i < thingList.Count; i++)
         *  {
         *      hackingTable = (thingList[i] as Building_HackingTable);
         *      if (hackingTable != null)
         *      {
         *          break;
         *      }
         *  }
         *  if (hackingTable == null)
         *  {
         *      return null;
         *  }
         *  if(hackingTable.GetCurOccupant(0) == pawn)
         *  {
         *      return hackingTable;
         *  }
         *  return null;
         * }
         */
        /*
         * public static bool OnHackingTable(this Pawn pawn)
         * {
         *  if(pawn.HackingTable() != null)
         *  {
         *      return true;
         *  }
         *  return false;
         * }
         */

        public static void FailOnPlatformNoLongerUsable(this Toil toil, TargetIndex bedIndex)
        {
            toil.FailOnDespawnedOrNull(bedIndex);
            toil.FailOn(() => ((Building_Bed)toil.actor.CurJob.GetTarget(bedIndex).Thing).IsBurning());
            toil.FailOn(() => !HealthAIUtility.ShouldSeekMedicalRest(toil.actor) && !HealthAIUtility.ShouldSeekMedicalRestUrgent(toil.actor) && ((Building_Bed)toil.actor.CurJob.GetTarget(bedIndex).Thing).Medical);
            toil.FailOn(() => toil.actor.IsColonist && !toil.actor.CurJob.ignoreForbidden && !toil.actor.Downed && toil.actor.CurJob.GetTarget(bedIndex).Thing.IsForbidden(toil.actor));
        }
示例#2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            job.count = 1;
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.B));


            Toil toil = Toils_General.Wait(100);

            toil.WithProgressBarToilDelay(TargetIndex.B);
            toil.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            toil.FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch);
            if (job.targetB.IsValid)
            {
                toil.FailOnDespawnedOrNull(TargetIndex.B);
            }
            yield return(toil);

            Toil use = new Toil();

            use.initAction = delegate
            {
                Pawn pawn = job.targetA.Pawn;
                this.Map.GetComponent <ArchotechExtractableAnimals_MapComponent>().RemoveAnimalToCarry(pawn);

                float ParagonOrHybridFactor = 0.5f;

                if (pawn.kindDef.GetModExtension <DefExtension_Hybrid>()?.dominantGenome == pawn.kindDef.GetModExtension <DefExtension_Hybrid>()?.secondaryGenome)
                {
                    ParagonOrHybridFactor = 1f;
                }


                float DNAExtractionFactor = pawn.TryGetComp <CompHybrid>()?.GetDNAExtractionFactor() ?? 0f;

                Building_DNAStorageBank building = (Building_DNAStorageBank)job.targetB.Thing;

                float totalProgress = building.progress + (DNAExtractionFactor * ParagonOrHybridFactor);

                if (totalProgress >= 1)
                {
                    building.progress = 1;
                }
                else
                {
                    building.progress += DNAExtractionFactor * ParagonOrHybridFactor;
                }


                pawn.Destroy();
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
示例#3
0
        protected Toil FinalizeTraining()
        {
            Toil finalizeTraining = new Toil();

            finalizeTraining.initAction = delegate
            {
                Pawn actor = finalizeTraining.actor;
                if (!practice)
                {
                    ThingDef      weapon   = job.targetB.Thing.def;
                    CompKnowledge techComp = actor.TryGetComp <CompKnowledge>();
                    bool          safe     = true;
                    if (unknown)
                    {
                        safe = !CheckExperimentFail(actor, TargetThingB);
                    }
                    if (!techComp.proficientWeapons.Contains(weapon) && safe)
                    {
                        LearnWeaponGroup(weapon, actor, techComp);
                    }
                }
                job.bill.Notify_IterationCompleted(actor, new List <Thing> {
                });
                actor.jobs.EndCurrentJob(JobCondition.Succeeded, false);
            };
            finalizeTraining.defaultCompleteMode = ToilCompleteMode.Instant;
            finalizeTraining.FailOnDespawnedOrNull(TargetIndex.A);
            return(finalizeTraining);
        }
示例#4
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

            Toil toil = Toils_General.Wait(1000);

            toil.FailOnDespawnedOrNull(TargetIndex.A);
            toil.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            toil.WithEffect(Building.def.repairEffect, TargetIndex.A);
            toil.WithProgressBarToilDelay(TargetIndex.A);
            toil.activeSkill = () => SkillDefOf.Construction;
            yield return(toil);

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                Components.Destroy();
                if (Rand.Value > pawn.GetStatValue(StatDefOf.FixBrokenDownBuildingSuccessChance))
                {
                    MoteMaker.ThrowText((pawn.DrawPos + Building.DrawPos) / 2f, base.Map, "TextMote_FixBrokenDownBuildingFail".Translate(), 3.65f);
                }
                else
                {
                    Building.GetComp <CompBreakdownable>().Notify_Repaired();
                }
            };
            yield return(toil2);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

            Toil repair = Toils_General.Wait(1000, TargetIndex.None);

            repair.FailOnDespawnedOrNull(TargetIndex.A);
            repair.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            repair.WithEffect(this.Building.def.repairEffect, TargetIndex.A);
            repair.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(repair);

            yield return(new Toil
            {
                initAction = delegate
                {
                    this.$this.Components.Destroy(DestroyMode.Vanish);
                    if (Rand.Value > this.$this.pawn.GetStatValue(StatDefOf.FixBrokenDownBuildingSuccessChance, true))
                    {
                        Vector3 loc = (this.$this.pawn.DrawPos + this.$this.Building.DrawPos) / 2f;
                        MoteMaker.ThrowText(loc, this.$this.Map, "TextMote_FixBrokenDownBuildingFail".Translate(), 3.65f);
                    }
                    else
                    {
                        this.$this.Building.GetComp <CompBreakdownable>().Notify_Repaired();
                    }
                }
            });
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Log.Message("Toil start:" + this.pawn +" is taking " + Bedding + " to " + Bed);
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            base.AddEndCondition(() => (!bedComp.Loaded) ? JobCondition.Ongoing : JobCondition.Succeeded);
            job.count = 1;
            Toil reserveBedding = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(reserveBedding);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveBedding, TargetIndex.B, TargetIndex.None, true, null));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            yield return(Toils_General.Wait(MakingDuration, TargetIndex.None).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            Toil makeTheBed = new Toil();

            makeTheBed.initAction = delegate
            {
                Pawn actor = makeTheBed.actor;
                bedComp.LoadBedding(actor.CurJob.targetB.Thing.def, actor.CurJob.targetB.Thing);//, 1);
                //Building_SoftWarmBed SoftWarmBed = Bed as Building_SoftWarmBed;
                actor.carryTracker.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            };
            makeTheBed.defaultCompleteMode = ToilCompleteMode.Instant;
            makeTheBed.FailOnDespawnedOrNull(TargetIndex.A);
            yield return(makeTheBed);

            yield break;
        }
示例#7
0
        //Copy of Verse.AI.Toils_CombatGotoCastPosition
        Toil GotoCastPosition(TargetIndex targetInd, bool closeIfDowned = false)
        {
            var toil = new Toil();

            toil.initAction = delegate
            {
                Pawn  actor      = toil.actor;
                Job   curJob     = actor.CurJob;
                Thing thing      = curJob.GetTarget(targetInd).Thing;
                var   pawnVictim = thing as Pawn;

                if (!CastPositionFinder.TryFindCastPosition(new CastPositionRequest
                {
                    caster = toil.actor,
                    target = thing,
                    verb = curJob.verbToUse,
                    maxRangeFromTarget = GetOptimalHuntRange(actor, pawnVictim),
                    wantCoverFromTarget = false
                }, out var intVec))
                {
                    toil.actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                    return;
                }
                toil.actor.pather.StartPath(intVec, PathEndMode.OnCell);
                actor.Map.pawnDestinationReservationManager.Reserve(actor, job, intVec);
            };
            toil.FailOnDespawnedOrNull(targetInd);
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            return(toil);
        }
示例#8
0
        //Base: Toils_General.WaitWith
        private Toil Toils_WaitWithSoundAndEffect(int duration, string soundDefName, string effecterDefName, TargetIndex targetIndex)
        {
            Toil toil = new Toil();

            toil.initAction = () =>
            {
                //toil.actor.pather.StopDead();
                //toil.actor.Drawer.rotator.FaceCell(toil.actor.CurJob.GetTarget(targetIndex).Cell);

                Pawn pawn = toil.actor.CurJob.GetTarget(targetIndex).Thing as Pawn;
                if (pawn != null) // If target is a pawn force him to watch me
                {
                    PawnUtility.ForceWait(pawn, duration, null, true);
                }
            };
            toil.handlingFacing = true;
            toil.FailOnDespawnedOrNull(targetIndex);
            toil.FailOnCannotTouch(targetIndex, PathEndMode.Touch);

            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = duration;
            toil.WithProgressBarToilDelay(targetIndex, false, -0.5f);

            toil.PlaySustainerOrSound(() => SoundDef.Named(soundDefName));

            // Throws errors?
            //toil.WithEffect(() => EffecterDef.Named(effecterDefName), targetIndex);

            return(toil);
        }
        //Copy of Verse.AI.Toils_CombatGotoCastPosition
        Toil GotoCastPosition(TargetIndex targetInd, bool closeIfDowned = false)
        {
            var toil = new Toil();

            toil.initAction = delegate
            {
                Pawn    actor      = toil.actor;
                Job     curJob     = actor.CurJob;
                Thing   thing      = curJob.GetTarget(targetInd).Thing;
                var     pawnVictim = thing as Pawn;
                IntVec3 intVec;
                if (!CastPositionFinder.TryFindCastPosition(new CastPositionRequest
                {
                    caster = toil.actor,
                    target = thing,
                    verb = curJob.verbToUse,
                    maxRangeFromTarget = ((closeIfDowned && pawnVictim != null && pawnVictim.Downed)
                                          ? Mathf.Min(curJob.verbToUse.verbProps.range, (float)pawnVictim.RaceProps.executionRange)
                                          //The following line is changed
                                            : HuntRangePerBodysize(pawnVictim.RaceProps.baseBodySize, (float)pawnVictim.RaceProps.executionRange, curJob.verbToUse.verbProps.range)),
                    wantCoverFromTarget = false
                }, out intVec))
                {
                    toil.actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                    return;
                }
                toil.actor.pather.StartPath(intVec, PathEndMode.OnCell);
                actor.Map.pawnDestinationReservationManager.Reserve(actor, job, intVec);
            };
            toil.FailOnDespawnedOrNull(targetInd);
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            return(toil);
        }
示例#10
0
		protected override IEnumerable<Toil> MakeNewToils()
		{
			this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
			yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
			Toil toil = Toils_General.Wait(useDuration);
			toil.WithProgressBarToilDelay(TargetIndex.A);
			toil.FailOnDespawnedNullOrForbidden(TargetIndex.A);
			toil.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
			if (job.targetB.IsValid)
			{
				toil.FailOnDespawnedOrNull(TargetIndex.B);
				CompTargetable compTargetable = job.GetTarget(TargetIndex.A).Thing.TryGetComp<CompTargetable>();
				if (compTargetable != null && compTargetable.Props.nonDownedPawnOnly)
				{
					toil.FailOnDownedOrDead(TargetIndex.B);
				}
			}
			yield return toil;
			Toil use = new Toil();
			use.initAction = delegate
			{
				Pawn actor = use.actor;
				actor.CurJob.targetA.Thing.TryGetComp<CompUsable>().UsedBy(actor);
			};
			use.defaultCompleteMode = ToilCompleteMode.Instant;
			yield return use;
		}
示例#11
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            job.count = 1;
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.B));


            Toil toil = Toils_General.Wait(useDuration);

            toil.WithProgressBarToilDelay(TargetIndex.B);
            toil.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            toil.FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch);
            if (job.targetB.IsValid)
            {
                toil.FailOnDespawnedOrNull(TargetIndex.B);
            }
            yield return(toil);

            Toil use = new Toil();

            use.initAction = delegate
            {
                Pawn actor = use.actor;
                actor.CurJob.targetA.Thing.TryGetComp <CompTargetEffect_Extract>().DoEffectOn(actor, job.targetB.Thing);
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
示例#12
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Map map = Item.Map;

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.B));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

            Toil toil = Toils_General.Wait(600, TargetIndex.None);

            toil.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            toil.FailOnDespawnedOrNull(TargetIndex.A);
            toil.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            yield return(toil);

            Toil createAnimaTree = new Toil();

            createAnimaTree.initAction = delegate()
            {
                Thing thing = ThingMaker.MakeThing(ThingDef.Named("Plant_TreeAnima"), null);
                thing.stackCount = 1;
                Thing t;
                GenPlace.TryPlaceThing(thing, TargetPosition, map, ThingPlaceMode.Direct, out t, null, null, default(Rot4));
                Item.Destroy();
            };
            yield return(createAnimaTree);

            yield break;
        }
示例#13
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            _003CMakeNewToils_003Ec__Iterator0 _003CMakeNewToils_003Ec__Iterator = (_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0036: stateMachine*/;

            this.FailOnDespawnedOrNull(TargetIndex.A);
            Toil beat     = new Toil();
            Toil approach = new Toil();

            approach.initAction = delegate
            {
                if (_003CMakeNewToils_003Ec__Iterator._0024this.Map.reservationManager.CanReserve(_003CMakeNewToils_003Ec__Iterator._0024this.pawn, _003CMakeNewToils_003Ec__Iterator._0024this.TargetFire))
                {
                    _003CMakeNewToils_003Ec__Iterator._0024this.pawn.Reserve(_003CMakeNewToils_003Ec__Iterator._0024this.TargetFire, _003CMakeNewToils_003Ec__Iterator._0024this.job);
                }
                _003CMakeNewToils_003Ec__Iterator._0024this.pawn.pather.StartPath(_003CMakeNewToils_003Ec__Iterator._0024this.TargetFire, PathEndMode.Touch);
            };
            approach.tickAction = delegate
            {
                if (_003CMakeNewToils_003Ec__Iterator._0024this.pawn.pather.Moving && _003CMakeNewToils_003Ec__Iterator._0024this.pawn.pather.nextCell != _003CMakeNewToils_003Ec__Iterator._0024this.TargetFire.Position)
                {
                    _003CMakeNewToils_003Ec__Iterator._0024this.StartBeatingFireIfAnyAt(_003CMakeNewToils_003Ec__Iterator._0024this.pawn.pather.nextCell, beat);
                }
                if (_003CMakeNewToils_003Ec__Iterator._0024this.pawn.Position != _003CMakeNewToils_003Ec__Iterator._0024this.TargetFire.Position)
                {
                    _003CMakeNewToils_003Ec__Iterator._0024this.StartBeatingFireIfAnyAt(_003CMakeNewToils_003Ec__Iterator._0024this.pawn.Position, beat);
                }
            };
            approach.FailOnDespawnedOrNull(TargetIndex.A);
            approach.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            approach.atomicWithPrevious  = true;
            yield return(approach);

            /*Error: Unable to find new state assignment for yield return*/;
        }
示例#14
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

            Toil repair = Toils_General.Wait(75, TargetIndex.None);

            repair.FailOnDespawnedOrNull(TargetIndex.A);
            repair.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            repair.WithEffect(Gun.def.repairEffect, TargetIndex.A);
            repair.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(repair);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    BeamColorThing.BeamColor = pawn.CurJob.maxNumMeleeAttacks;

                    var targetInfo = new TargetInfo(Gun.Position, Map, false);
                    Effecter effecter = EffecterDefOf.Deflect_Metal.Spawn();
                    effecter.Trigger(targetInfo, targetInfo);
                    effecter.Cleanup();
                    this.Prism.Destroy(DestroyMode.Vanish);
                }
            });

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

            Toil wait = new Toil();

            wait.initAction = delegate()
            {
                Pawn actor = wait.actor;
                actor.pather.StopDead();
            };
            wait.tickAction = delegate()
            {
                Pawn       actor = wait.actor;
                Plant_Nest nest  = (Plant_Nest)this.job.targetA.Thing;
                this.gatherProgress += actor.GetStatValue(StatDefOf.PlantWorkSpeed, true);
                if (this.gatherProgress >= this.WorkTotal)
                {
                    actor.jobs.EndCurrentJob(JobCondition.Succeeded, true, true);
                    if (!Rand.Chance(actor.GetStatValue(StatDefOf.PlantHarvestYield, true)))
                    {
                        nest.nectarAmount /= 2;
                        MoteMaker.ThrowText((actor.DrawPos + nest.DrawPos) / 2f, actor.Map, "TextMote_ProductWasted".Translate(), 3.65f);
                    }
                    else
                    {
                        int i = GenMath.RoundRandom((float)1 * (float)nest.nectarAmount);
                        int totalExtracted = 0;
                        while (i > 0)
                        {
                            int num = Mathf.Clamp(i, 1, PurpleIvyDefOf.PI_Nectar.stackLimit);
                            i -= num;
                            totalExtracted += num;
                            Thing thing = ThingMaker.MakeThing(PurpleIvyDefOf.PI_Nectar, null);
                            thing.stackCount = num;
                            GenPlace.TryPlaceThing(thing, actor.Position, actor.Map, ThingPlaceMode.Near, null, null, default(Rot4));
                        }
                        nest.nectarAmount -= totalExtracted;
                        if (nest.nectarAmount < 0)
                        {
                            nest.nectarAmount = 0;
                        }
                    }
                }
            };
            wait.FailOnDespawnedOrNull(TargetIndex.A);
            wait.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(delegate
            {
                return(JobCondition.Ongoing);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            wait.WithProgressBar(TargetIndex.A, () => this.gatherProgress / this.WorkTotal, false, -0.5f);
            wait.activeSkill = (() => SkillDefOf.Plants);
            yield return(wait);

            yield break;
        }
示例#16
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                {
                    Toil checkOpenable = new Toil();
                    checkOpenable.initAction = delegate()
                    {
                        if (!base.Openable.CanOpen)
                        {
                            Designation designation = base.Map.designationManager.DesignationOn(this.job.targetA.Thing, DesignationDefOf.Open);
                            if (designation != null)
                            {
                                designation.Delete();
                            }
                        }
                    };
                    this.$current = checkOpenable.FailOnDespawnedOrNull(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);
                }

                case 1u:
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnThingMissingDesignation(TargetIndex.A, DesignationDefOf.Open).FailOnDespawnedOrNull(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$current = Toils_General.Wait(300, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f).FailOnDespawnedOrNull(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    this.$current = Toils_General.Open(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
        // Token: 0x06000046 RID: 70 RVA: 0x000040B9 File Offset: 0x000022B9
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnDowned(TargetIndex.A);
            this.FailOnNotCasualInterruptible(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil wait = new Toil();

            wait.initAction = delegate()
            {
                Pawn actor = wait.actor;
                Pawn pawn  = (Pawn)wait.actor.CurJob.GetTarget(TargetIndex.A).Thing;
                actor.pather.StopDead();
                PawnUtility.ForceWait(pawn, 15000, null, true);
            };
            wait.tickAction = delegate()
            {
                Pawn actor = wait.actor;
                this.gatherProgress += actor.GetStatValue(StatDefOf.AnimalGatherSpeed, true);
                bool flag = this.gatherProgress >= this.WorkTotal;
                if (flag)
                {
                    this.GetComp((Pawn)((Thing)this.job.GetTarget(TargetIndex.A))).Gathered(this.pawn);
                    actor.jobs.EndCurrentJob(JobCondition.Succeeded, true, true);
                }
            };
            wait.AddFinishAction(delegate
            {
                Pawn pawn = (Pawn)wait.actor.CurJob.GetTarget(TargetIndex.A).Thing;
                bool flag = pawn.jobs.curJob.def == JobDefOf.Wait_MaintainPosture;
                if (flag)
                {
                    pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true, true);
                }
            });
            wait.FailOnDespawnedOrNull(TargetIndex.A);
            wait.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(delegate
            {
                bool flag = !this.GetComp((Pawn)((Thing)this.job.GetTarget(TargetIndex.A))).ActiveAndFull;
                JobCondition result;
                if (flag)
                {
                    result = JobCondition.Incompletable;
                }
                else
                {
                    result = JobCondition.Ongoing;
                }
                return(result);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            wait.WithProgressBar(TargetIndex.A, () => this.gatherProgress / this.WorkTotal, false, -0.5f);
            yield return(wait);

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnDowned(TargetIndex.A);
            this.FailOnNotCasualInterruptible(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil wait = new Toil();

            wait.initAction = delegate()
            {
                Pawn actor = wait.actor;
                Pawn pawn  = (Pawn)this.job.GetTarget(TargetIndex.A).Thing;
                actor.pather.StopDead();
                PawnUtility.ForceWait(pawn, 15000, null, true);
            };
            wait.tickAction = delegate()
            {
                Pawn actor = wait.actor;
                actor.skills.Learn(SkillDefOf.Animals, 0.13f, false);
                this.gatherProgress += actor.GetStatValue(StatDefOf.AnimalGatherSpeed, true);
                if (this.gatherProgress >= this.WorkTotal)
                {
                    this.GetSpecificComp((Pawn)((Thing)this.job.GetTarget(TargetIndex.A))).InformGathered(this.pawn);
                    actor.jobs.EndCurrentJob(JobCondition.Succeeded, true, true);
                    if (ModLister.HasActiveModWithName("Alpha Animals"))
                    {
                        actor.health.AddHediff(HediffDef.Named("AA_GatheredResource"));
                    }
                }
            };
            wait.AddFinishAction(delegate
            {
                Pawn pawn = (Pawn)this.job.GetTarget(TargetIndex.A).Thing;
                if (pawn != null && pawn.CurJobDef == JobDefOf.Wait_MaintainPosture)
                {
                    pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true, true);
                }
            });
            wait.FailOnDespawnedOrNull(TargetIndex.A);
            wait.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(delegate
            {
                if (!this.GetComp((Pawn)((Thing)this.job.GetTarget(TargetIndex.A))).ActiveAndFull)
                {
                    return(JobCondition.Incompletable);
                }
                return(JobCondition.Ongoing);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            wait.WithProgressBar(TargetIndex.A, () => this.gatherProgress / this.WorkTotal, false, -0.5f);
            wait.activeSkill = (() => SkillDefOf.Animals);

            yield return(wait);

            yield break;
        }
示例#19
0
        // Token: 0x0600026A RID: 618 RVA: 0x000170B4 File Offset: 0x000154B4
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            Toil beat     = new Toil();
            Toil approach = new Toil();

            approach.initAction = delegate()
            {
                if (this.Map.reservationManager.CanReserve(this.pawn, this.TargetWarpfire, 1, -1, null, false))
                {
                    this.pawn.Reserve(this.TargetWarpfire, this.job, 1, -1, null, true);
                }
                this.pawn.pather.StartPath(this.TargetWarpfire, PathEndMode.Touch);
            };
            approach.tickAction = delegate()
            {
                if (this.pawn.pather.Moving && this.pawn.pather.nextCell != this.TargetWarpfire.Position)
                {
                    this.StartBeatingWarpfireIfAnyAt(this.pawn.pather.nextCell, beat);
                }
                if (this.pawn.Position != this.TargetWarpfire.Position)
                {
                    this.StartBeatingWarpfireIfAnyAt(this.pawn.Position, beat);
                }
            };
            approach.FailOnDespawnedOrNull(TargetIndex.A);
            approach.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            approach.atomicWithPrevious  = true;
            yield return(approach);

            beat.tickAction = delegate()
            {
                if (!this.pawn.CanReachImmediate(this.TargetWarpfire, PathEndMode.Touch))
                {
                    this.JumpToToil(approach);
                }
                else
                {
                    if (this.pawn.Position != this.TargetWarpfire.Position && this.StartBeatingWarpfireIfAnyAt(this.pawn.Position, beat))
                    {
                        return;
                    }
                    this.pawn.natives.TryBeatFire(this.TargetWarpfire);
                    if (this.TargetWarpfire.Destroyed)
                    {
                        this.pawn.records.Increment(RecordDefOf.FiresExtinguished);
                        this.pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true);
                        return;
                    }
                }
            };
            beat.FailOnDespawnedOrNull(TargetIndex.A);
            beat.defaultCompleteMode = ToilCompleteMode.Never;
            yield return(beat);

            yield break;
        }
示例#20
0
        protected IEnumerable <Toil> MakeNewToils(HediffDef hediffDef)
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            //this.FailOnDowned(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil wait = new Toil();

            wait.initAction = delegate
            {
                Pawn actor2 = wait.actor;
                Pawn pawn2  = (Pawn)job.GetTarget(TargetIndex.A).Thing;
                actor2.pather.StopDead();
                PawnUtility.ForceWait(pawn2, 15000, null, maintainPosture: true);
            };
            wait.tickAction = delegate
            {
                ticks++;
            };
            wait.AddFinishAction(delegate
            {
                Pawn pawn = (Pawn)job.GetTarget(TargetIndex.A).Thing;
                if (pawn != null)
                {
                    Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(hediffDef, false);
                    if (hediff == null)
                    {
                        hediff = HediffMaker.MakeHediff(hediffDef, pawn, null);
                        pawn.health.AddHediff(hediff, null, null);
                    }
                    else
                    {
                        pawn.health.hediffSet.hediffs.Remove(hediff);
                    }
                    if (pawn.CurJobDef == JobDefOf.Wait_MaintainPosture)
                    {
                        pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
                    }
                }
            });
            wait.FailOnDespawnedOrNull(TargetIndex.A);
            wait.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(() =>
            {
                if (ticks >= BGP.Unchain_Ticks)
                {
                    return(JobCondition.Succeeded);
                }
                return(JobCondition.Ongoing);
            }
                                 );
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            wait.WithProgressBar(TargetIndex.A, () => ticks / BGP.Unchain_Ticks);
            yield return(wait);
        }
示例#21
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil waitLabel = Toils_General.Label();
            Toil endLabel  = Toils_General.Label();

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

            Toil approach = new Toil();

            approach.initAction = delegate
            {
                Job curJob = pawn.jobs.curJob;

                if (pawn == Victim || Victim == null)
                {
                    pawn.pather.StopDead();
                    ReadyForNextToil();
                }
                else
                {
                    CastPositionRequest newReq = default(CastPositionRequest);
                    newReq.caster              = pawn;
                    newReq.target              = Victim;
                    newReq.verb                = curJob.verbToUse;
                    newReq.maxRangeFromTarget  = (!Victim.Downed ? Mathf.Max(curJob.verbToUse.verbProps.range * maxRangeFactor, 1.42f) : Mathf.Min(curJob.verbToUse.verbProps.range, Victim.RaceProps.executionRange));
                    newReq.wantCoverFromTarget = false;
                    if (CastPositionFinder.TryFindCastPosition(newReq, out var dest))
                    {
                        pawn.pather.StartPath(dest, PathEndMode.OnCell);
                        pawn.Map.pawnDestinationReservationManager.Reserve(pawn, curJob, dest);
                    }
                    //else if (pawn.PositionHeld.DistanceTo(Victim.PositionHeld) <= waitRange)
                    //{
                    //    pawn.pather.StopDead();
                    //    pawn.jobs.curDriver.JumpToToil(waitLabel);
                    //}
                    else
                    {
                        pawn.pather.StartPath(Victim, PathEndMode.Touch);
                    }
                }
            };
            approach.FailOnDespawnedOrNull(VictimIndex);
            approach.defaultCompleteMode = ToilCompleteMode.Delay;
            approach.defaultDuration     = 60;
            yield return(approach);

            yield return(Toils_Jump.Jump(endLabel));

            yield return(waitLabel);

            yield return(Toils_General.Wait(60));

            yield return(endLabel);
        }
示例#22
0
        // Token: 0x06000014 RID: 20 RVA: 0x000027CB File Offset: 0x000009CB
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnDowned(TargetIndex.A);
            this.FailOnNotCasualInterruptible(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            var wait = new Toil();

            wait.initAction = delegate
            {
                var actor = wait.actor;
                var thing = (Pawn)wait.actor.CurJob.GetTarget(TargetIndex.A).Thing;
                actor.pather.StopDead();
                PawnUtility.ForceWait(thing, 15000, null, true);
            };
            wait.tickAction = delegate
            {
                var actor = wait.actor;
                actor.skills.Learn(SkillDefOf.Social, 0.142999992f);
                gatherProgress += actor.GetStatValue(StatDefOf.AnimalGatherSpeed);
                if (!(gatherProgress >= WorkTotal))
                {
                    return;
                }

                var thing = (Pawn)(Thing)job.GetTarget(TargetIndex.A);
                thing.TryGetComp <CompWidowMilkableHumanoid>().GatherMilk(pawn);
                actor.jobs.EndCurrentJob(JobCondition.Succeeded);
            };
            wait.AddFinishAction(delegate
            {
                var thing = (Pawn)wait.actor.CurJob.GetTarget(TargetIndex.A).Thing;
                if (thing.jobs.curJob.def == JobDefOf.Wait_MaintainPosture)
                {
                    thing.jobs.EndCurrentJob(JobCondition.InterruptForced);
                }
            });
            wait.FailOnDespawnedOrNull(TargetIndex.A);
            wait.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(delegate
            {
                var thing  = (Pawn)(Thing)job.GetTarget(TargetIndex.A);
                var result = !thing.TryGetComp <CompWidowMilkableHumanoid>().ActiveAndCanBeMilked
                    ? JobCondition.Incompletable
                    : JobCondition.Ongoing;

                return(result);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            wait.WithProgressBar(TargetIndex.A, () => gatherProgress / WorkTotal);
            yield return(wait);
        }
示例#23
0
        public static Toil GotoThing(TargetIndex ind, PathEndMode peMode)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn actor = toil.actor;
                actor.pather.StartPath(getBunkerNearCell(actor, actor.jobs.curJob.GetTarget(ind), ind, peMode), peMode);
            };
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            toil.FailOnDespawnedOrNull(ind);
            return(toil);
        }
示例#24
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            Toil beat     = new Toil();
            Toil approach = new Toil();

            approach.initAction = delegate
            {
                if (base.Map.reservationManager.CanReserve(pawn, TargetFire))
                {
                    pawn.Reserve(TargetFire, job);
                }
                pawn.pather.StartPath(TargetFire, PathEndMode.Touch);
            };
            approach.tickAction = delegate
            {
                if (pawn.pather.Moving && pawn.pather.nextCell != TargetFire.Position)
                {
                    StartBeatingFireIfAnyAt(pawn.pather.nextCell, beat);
                }
                if (pawn.Position != TargetFire.Position)
                {
                    StartBeatingFireIfAnyAt(pawn.Position, beat);
                }
            };
            approach.FailOnDespawnedOrNull(TargetIndex.A);
            approach.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            approach.atomicWithPrevious  = true;
            yield return(approach);

            beat.tickAction = delegate
            {
                if (!pawn.CanReachImmediate(TargetFire, PathEndMode.Touch))
                {
                    JumpToToil(approach);
                }
                else if (!(pawn.Position != TargetFire.Position) || !StartBeatingFireIfAnyAt(pawn.Position, beat))
                {
                    pawn.natives.TryBeatFire(TargetFire);
                    if (TargetFire.Destroyed)
                    {
                        pawn.records.Increment(RecordDefOf.FiresExtinguished);
                        pawn.jobs.EndCurrentJob(JobCondition.Succeeded);
                    }
                }
            };
            beat.FailOnDespawnedOrNull(TargetIndex.A);
            beat.defaultCompleteMode = ToilCompleteMode.Never;
            yield return(beat);
        }
示例#25
0
        // Verse.AI.Toils_Combat
        public Toil GotoCastPosition(TargetIndex targetInd, bool closeIfDowned = false)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn  actor  = toil.actor;
                Job   curJob = actor.jobs.curJob;
                Thing thing  = null;
                Pawn  pawn   = null;
                thing = curJob.GetTarget(targetInd).Thing;
                IntVec3 intVec;
                if (thing != null)
                {
                    pawn = thing as Pawn;
                    if (!CastPositionFinder.TryFindCastPosition(new CastPositionRequest
                    {
                        caster = toil.actor,
                        target = thing,
                        verb = curJob.verbToUse,
                        maxRangeFromTarget = ((closeIfDowned && pawn != null && pawn.Downed) ? Mathf.Min(curJob.verbToUse.verbProps.range, pawn.RaceProps.executionRange) : curJob.verbToUse.verbProps.range),
                        wantCoverFromTarget = false
                    }, out intVec))
                    {
                        toil.actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                        return;
                    }
                }
                else
                {
                    if (!TryFindCastPosition(new CastPositionRequest
                    {
                        caster = toil.actor,
                        target = null,
                        verb = curJob.verbToUse,
                        maxRangeFromTarget = ((closeIfDowned && pawn != null && pawn.Downed) ? Mathf.Min(curJob.verbToUse.verbProps.range, pawn.RaceProps.executionRange) : curJob.verbToUse.verbProps.range),
                        wantCoverFromTarget = false
                    }, out intVec))
                    {
                        toil.actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                        return;
                    }
                }
                toil.actor.pather.StartPath(intVec, PathEndMode.OnCell);
                actor.Map.pawnDestinationManager.ReserveDestinationFor(actor, intVec);
            };
            toil.FailOnDespawnedOrNull(targetInd);
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            return(toil);
        }
示例#26
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                {
                    this.FailOnDespawnedOrNull(TargetIndex.A);
                    Toil beat     = new Toil();
                    Toil approach = new Toil();
                    approach.initAction = delegate()
                    {
                        if (this.Map.reservationManager.CanReserve(this.pawn, this.TargetFire, 1, -1, null, false))
                        {
                            this.pawn.Reserve(this.TargetFire, this.job, 1, -1, null, true);
                        }
                        this.pawn.pather.StartPath(this.TargetFire, PathEndMode.Touch);
                    };
                    approach.tickAction = delegate()
                    {
                        if (this.pawn.pather.Moving && this.pawn.pather.nextCell != this.TargetFire.Position)
                        {
                            this.StartBeatingFireIfAnyAt(this.pawn.pather.nextCell, beat);
                        }
                        if (this.pawn.Position != this.TargetFire.Position)
                        {
                            this.StartBeatingFireIfAnyAt(this.pawn.Position, beat);
                        }
                    };
                    approach.FailOnDespawnedOrNull(TargetIndex.A);
                    approach.defaultCompleteMode = ToilCompleteMode.PatherArrival;
                    approach.atomicWithPrevious  = true;
                    this.$current = approach;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);
                }

                case 1u:
                    < MakeNewToils > c__AnonStorey.beat.tickAction = delegate()
                    {
                        if (! < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.pawn.CanReachImmediate(< MakeNewToils > c__AnonStorey.< > f__ref$0.$this.TargetFire, PathEndMode.Touch))
                        {
                            < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.JumpToToil(< MakeNewToils > c__AnonStorey.approach);
                        }
示例#27
0
        public static Toil ClaimBedIfNonMedical(TargetIndex ind, TargetIndex claimantIndex = TargetIndex.None)
        {
            Toil claim = new Toil();

            claim.initAction = delegate
            {
                Pawn actor = claim.GetActor();
                Pawn pawn  = (claimantIndex != 0) ? ((Pawn)actor.CurJob.GetTarget(claimantIndex).Thing) : actor;
                if (pawn.ownership != null)
                {
                    pawn.ownership.ClaimBedIfNonMedical((Building_Bed)actor.CurJob.GetTarget(ind).Thing);
                }
            };
            claim.FailOnDespawnedOrNull(ind);
            return(claim);
        }
        public static Toil DoSabotage(TargetIndex ind)
        {
            Toil toil = new Toil();

            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            toil.FailOnDespawnedOrNull(ind);
            toil.AddFinishAction(delegate
            {
                Building building = (Building)toil.actor.jobs.curJob.GetTarget(ind).Thing;
                if (!building.GetComp <CompBreakdownable>().BrokenDown)
                {
                    building.GetComp <CompBreakdownable>().DoBreakdown();
                }
            });
            return(toil);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            float workNeeded = 1000;
            float workDone   = 0;
            Toil  repair     = new Toil();

            repair.tickAction = delegate()
            {
                Pawn actor = repair.actor;
                actor.skills.Learn(SkillDefOf.Construction, 0.05f, false);
                float num = actor.GetStatValue(StatDefOf.ConstructionSpeed, true) * 1.7f;
                workDone += num;
                if (workDone >= workNeeded)
                {
                    PawnAutocleaner cleaner = TargetThingA as PawnAutocleaner;
                    if (cleaner == null)
                    {
                        EndJobWith(JobCondition.Incompletable);
                        return;
                    }

                    cleaner.health.Reset();

                    job.GetTarget(TargetIndex.B).Thing.Destroy(DestroyMode.Vanish);
                    actor.records.Increment(RecordDefOf.ThingsRepaired);

                    EffecterDefOf.Deflect_Metal.Spawn().Trigger(job.targetA.Thing, pawn);
                    EndJobWith(JobCondition.Succeeded);
                }
            };
            repair.defaultCompleteMode = ToilCompleteMode.Never;
            repair.activeSkill         = () => SkillDefOf.Construction;
            repair.FailOnDespawnedOrNull(TargetIndex.A);
            repair.WithProgressBar(TargetIndex.A, () => workDone / workNeeded, false, -0.5f);
            repair.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            repair.WithEffect(TargetThingA.def.repairEffect, TargetIndex.A);
            yield return(repair);

            yield break;
        }
示例#30
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.B).FailOnDespawnedOrNull(TargetIndex.A));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

            Toil toil = Toils_General.Wait(600);

            toil.WithProgressBarToilDelay(TargetIndex.A);
            toil.FailOnDespawnedOrNull(TargetIndex.A);
            toil.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            yield return(toil);

            yield return(Toils_General.Do(Resurrect));
        }