protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); Toil toil = new Toil(); toil.tickAction = delegate() { this.pawn.rotationTracker.FaceTarget(base.TargetA); this.pawn.GainComfortFromCellIfPossible(false); Pawn pawn = this.pawn; Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, this.job.doUntilGatheringEnded ? JoyTickFullJoyAction.None : JoyTickFullJoyAction.EndJob, 1f, joySource); }; toil.handlingFacing = true; toil.defaultCompleteMode = ToilCompleteMode.Delay; toil.defaultDuration = (this.job.doUntilGatheringEnded ? this.job.expiryInterval : this.job.def.joyDuration); toil.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); this.MayStartSocialFight(this.pawn); }); this.ModifyPlayToil(toil); yield return(toil); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); Toil play = new Toil(); play.tickAction = delegate { this.$this.pawn.rotationTracker.FaceTarget(this.$this.TargetA); this.$this.pawn.GainComfortFromCellIfPossible(); Pawn pawn = this.$this.pawn; Building joySource = (Building)this.$this.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource); }; play.handlingFacing = true; play.defaultCompleteMode = ToilCompleteMode.Delay; play.defaultDuration = this.job.def.joyDuration; play.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.$this.pawn); }); this.ModifyPlayToil(play); yield return(play); }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); /*Error: Unable to find new state assignment for yield return*/; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.B); yield return(Toils_Goto.Goto(TargetIndex.B, this.PathEndMode)); Toil doWork = new Toil(); doWork.initAction = delegate() { this.workLeft = 65f; }; doWork.tickAction = delegate() { float statValue = doWork.actor.GetStatValue(StatDefOf.ConstructionSpeed, true); this.workLeft -= statValue; if (this.workLeft <= 0f) { this.DoEffect(); this.ReadyForNextToil(); } }; doWork.FailOnCannotTouch(TargetIndex.B, this.PathEndMode); doWork.PlaySoundAtStart(SoundDefOf.Roof_Start); doWork.PlaySoundAtEnd(SoundDefOf.Roof_Finish); doWork.WithEffect(EffecterDefOf.RoofWork, TargetIndex.A); doWork.FailOn(new Func <bool>(this.DoWorkFailOn)); doWork.WithProgressBar(TargetIndex.A, () => 1f - this.workLeft / 65f, false, -0.5f); doWork.defaultCompleteMode = ToilCompleteMode.Never; yield return(doWork); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { // Set up fail conditions this.FailOn(delegate { return(Quarry == null || Quarry.IsForbidden(pawn) || Quarry.Depleted); }); // Go to the quarry yield return(Toils_Goto.Goto(CellInd, PathEndMode.OnCell)); // Mine at the quarry. This is only for the delay yield return(Mine()); // Collect resources from the quarry yield return(Collect()); // Reserve the resource yield return(Toils_Reserve.Reserve(TargetIndex.B)); // Reserve the storage cell yield return(Toils_Reserve.Reserve(TargetIndex.C)); // Go to the resource yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch)); // Pick up the resource yield return(Toils_Haul.StartCarryThing(TargetIndex.B)); // Carry the resource to the storage cell, then place it down Toil carry = Toils_Haul.CarryHauledThingToCell(TargetIndex.C); yield return(carry); yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, carry, true)); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetIndex.B); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode)); Toil doWork = new Toil(); doWork.initAction = delegate { workLeft = 65f; }; doWork.tickAction = delegate { float num = doWork.actor.GetStatValue(StatDefOf.ConstructionSpeed) * 1.7f; workLeft -= num; if (workLeft <= 0f) { DoEffect(); ReadyForNextToil(); } }; doWork.FailOnCannotTouch(TargetIndex.B, PathEndMode); doWork.PlaySoundAtStart(SoundDefOf.Roof_Start); doWork.PlaySoundAtEnd(SoundDefOf.Roof_Finish); doWork.WithEffect(EffecterDefOf.RoofWork, TargetIndex.A); doWork.FailOn(DoWorkFailOn); doWork.WithProgressBar(TargetIndex.A, () => 1f - workLeft / 65f); doWork.defaultCompleteMode = ToilCompleteMode.Never; doWork.activeSkill = () => SkillDefOf.Construction; yield return(doWork); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A)); yield return(Scratch(TargetThingA).FailOnDespawnedOrNull(TargetIndex.A)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { if (this.job.targetA.HasThing) { // ターゲットがThing=水アイテムを摂取する場合 // 水が使用不可能になったらFail ToilFailConditions.FailOnDestroyedNullOrForbidden <JobDriver_DrinkWater>(this, WaterIndex); // 水を取得 if (this.drinkingFromInventory) { // 所持品から取り出す yield return(Toils_Mizu.StartCarryFromInventory(WaterIndex)); } else { // 水の場所まで行く yield return(Toils_Goto.Goto(WaterIndex, PathEndMode.OnCell)); // 水を拾う yield return(Toils_Ingest.PickupIngestible(WaterIndex, this.pawn)); } // 飲む場所を決めてそこへ移動 yield return(Toils_Mizu.StartPathToDrinkSpot(WaterIndex)); // 水を摂取 yield return(Toils_Mizu.Drink(WaterIndex)); // 水の摂取終了(心情、水分、アイテム個数の処理) yield return(Toils_Mizu.FinishDrink(WaterIndex)); if (this.drinkingFromInventory && !this.TargetA.ThingDestroyed) { // 所持品から取り出した&まだ残っている場合は所持品に戻す yield return(Toils_Mizu.AddCarriedThingToInventory()); } } else { // ターゲットがThingではない=水アイテムを摂取しない場合=水地形を利用する場合 // 選んだ水地形が使用不可能or到達不可能になったらFail ToilFailConditions.FailOn <JobDriver_DrinkWater>(this, () => { return(this.job.targetA.Cell.IsForbidden(pawn) || !pawn.CanReach(this.job.targetA.Cell, PathEndMode.ClosestTouch, Danger.Deadly)); }); // 水地形まで移動 yield return(Toils_Goto.GotoCell(WaterIndex, PathEndMode.OnCell)); // 水地形から水分を摂取 yield return(Toils_Mizu.DrinkTerrain(WaterIndex, BaseDrinkTicksFromTerrain)); // 終了 //yield return Toils_Mizu.FinishDrinkTerrain(WaterIndex); } }
protected override IEnumerable <Toil> MakeNewToils() { _003CMakeNewToils_003Ec__Iterator0 _003CMakeNewToils_003Ec__Iterator = (_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0036: stateMachine*/; this.FailOnDespawnedOrNull(TargetIndex.B); yield return(Toils_Goto.Goto(TargetIndex.B, this.PathEndMode)); /*Error: Unable to find new state assignment for yield return*/; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); yield return(Toils_Reserve.ReserveQueue(TargetIndex.A, 1)); yield return(Toils_Reserve.Reserve(TargetIndex.B, 1)); yield return(Toils_Reserve.ReserveQueue(TargetIndex.B, 1)); Toil toil = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A); yield return(toil); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true)); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(toil, TargetIndex.A)); Toil toil2 = Toils_Goto.Goto(TargetIndex.B, PathEndMode.ClosestTouch); yield return(toil2); Toil toil3 = new Toil(); toil3.defaultCompleteMode = ToilCompleteMode.Delay; toil3.defaultDuration = 500; toil3.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); yield return(toil3); yield return(new Toil { initAction = delegate { ShipBase ship = (ShipBase)TargetB.Thing; ThingWithComps thing = (ThingWithComps)TargetA.Thing; CompShipWeapon comp = thing.TryGetComp <CompShipWeapon>(); Action action = delegate { if (ship.TryInstallTurret(comp.slotToInstall, comp)) { this.pawn.carryTracker.GetInnerContainer().Remove(TargetA.Thing); ship.weaponsToInstall.Remove(comp.slotToInstall); } }; action(); }, defaultCompleteMode = ToilCompleteMode.Instant }); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch).FailOn(() => !Victim.Downed)); Toil execute = new Toil(); execute.initAction = delegate { ExecutionUtility.DoExecutionByCut(execute.actor, Victim); }; execute.defaultCompleteMode = ToilCompleteMode.Instant; execute.activeSkill = (() => SkillDefOf.Melee); yield return(execute); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_Goto.GotoCell(TargetA.Cell.RandomAdjacentCell8Way(), PathEndMode.Touch)); yield return(Toils_Goto.GotoCell(TargetA.Cell.RandomAdjacentCell8Way(), PathEndMode.Touch)); yield return(Toils_Goto.GotoCell(TargetA.Cell.RandomAdjacentCell8Way(), PathEndMode.Touch)); yield return(Toils_Goto.GotoCell(TargetA.Cell.RandomAdjacentCell8Way(), PathEndMode.Touch)); yield break; }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); this.$current = Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell); if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: play = new Toil(); play.tickAction = delegate() { this.pawn.rotationTracker.FaceTarget(base.TargetA); this.pawn.GainComfortFromCellIfPossible(); Pawn pawn = this.pawn; Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(pawn, JoyTickFullJoyAction.EndJob, 1f, joySource); }; play.handlingFacing = true; play.defaultCompleteMode = ToilCompleteMode.Delay; play.defaultDuration = this.job.def.joyDuration; play.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); }); this.ModifyPlayToil(play); this.$current = play; if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: this.$PC = -1; break; } return(false); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A)); yield return(new Toil { initAction = delegate { ThingWithComps thingWithComps = (ThingWithComps)this.job.targetA.Thing; ThingWithComps thingWithComps2; if (thingWithComps.def.stackLimit > 1 && thingWithComps.stackCount > 1) { thingWithComps2 = (ThingWithComps)thingWithComps.SplitOff(1); } else { thingWithComps2 = thingWithComps; thingWithComps2.DeSpawn(); } //this.pawn.equipment.MakeRoomFor(thingWithComps2); //this.pawn.equipment.AddEquipment(thingWithComps2); bool success = this.pawn.inventory.innerContainer.TryAdd(thingWithComps2); if (thingWithComps.def.soundInteract != null) { thingWithComps.def.soundInteract.PlayOneShot(new TargetInfo(this.pawn.Position, this.pawn.Map, false)); } if (success) { GoldfishModule pawnMemory = GoldfishModule.GetGoldfishForPawn(this.pawn); if (pawnMemory == null) { return; } pawnMemory.AddSidearm(thingWithComps2.def); } }, defaultCompleteMode = ToilCompleteMode.Instant }); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); }
protected override IEnumerable <Toil> MakeNewToils() { /* Log.Message("I got asked to do woohoo!!!!"); */ var list = new List <Toil>(); list.Add(Toils_Goto.Goto(TargetIndex.A, PathEndMode.ClosestTouch)); list.Add(Toils_Goto.Goto(TargetIndex.B, PathEndMode.ClosestTouch)); list.AddRange(WoohooManager.AnimateLovin(pawn, TargetA.Thing as Pawn, TargetB.Thing as Building_Bed)); Toil t; list.Add(t = new Toil { initAction = delegate { Log.Message("Getting Woohooing, will be done in 400 ticks"); }, defaultDuration = 400, defaultCompleteMode = ToilCompleteMode.Delay }); t.AddFinishAction(delegate { Log.Message("Done Woohing Get"); }); PawnHelper.DelayNextWooHoo(pawn); //add a moodlet for being asked return(list); }
protected override IEnumerable <Toil> MakeNewToils() { //FAIL ON OVERBURDENED this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnForbidden(TargetIndex.A); int ammocount = Utility.AmmoCount(pawn, Utility.WeaponCheck(pawn)); this.FailOn(() => ammocount >= SettingsHelper.LatestVersion.DesiredAmmo); int max = MassUtility.CountToPickUpUntilOverEncumbered(pawn, job.targetA.Thing); int num = 0; if (pawn.IsFighting()) { num = Mathf.Min(job.targetA.Thing.stackCount, max); } else { num = Mathf.Min(Mathf.Min(SettingsHelper.LatestVersion.DesiredAmmo - ammocount, job.targetA.Thing.stackCount), max); } Toil reserveTargetA = Toils_Reserve.Reserve(TargetIndex.A); yield return(reserveTargetA); Toil go = Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch); yield return(go); Toil take = Toils_Take.TakeToInventory(TargetIndex.A, () => num); yield return(take); if (pawn.Drafted) { Toil go2 = Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell); yield return(go2); } yield break; }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.B, ship.compShip.sProps.maxPassengers)); yield return(Toils_Haul.CarryHauledThingToContainer()); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.ClosestTouch)); Toil leaving = JobDriver_LeaveInShip.EnterShip(this.GetActor(), ship); leaving.AddFinishAction(delegate { if (ship.pilotPresent) { ship.PrepareForLaunchIn(1000); } }); yield return(leaving); yield break; }
public override IEnumerable <Toil> MakeNewToils() { this.FailOn(() => Comrade.Dead); this.FailOnNotDowned(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.A); yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.ClosestTouch)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A)); yield return(Toils_Goto.GotoCell(Position, PathEndMode.OnCell)); yield return(Toils_Haul.PlaceCarriedThingInCellFacing(TargetIndex.B)); yield return(Toils_General.Do(() => { var factionStore = pawn.factionInt.GetDataStore(); factionStore.alreadyRescuedPawns.Add(new PawnTimeSignature(Comrade)); pawn.GetLord().Notify_ReachedDutyLocation(pawn); })); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnDespawnedOrNull(TargetIndex.B); this.$current = Toils_Goto.Goto(TargetIndex.B, this.PathEndMode); if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: < MakeNewToils > c__AnonStorey.doWork = new Toil(); < MakeNewToils > c__AnonStorey.doWork.initAction = delegate() { < MakeNewToils > c__AnonStorey.< > f__ref$0.$this.workLeft = 65f; };
protected override IEnumerable <Toil> MakeNewToils() { // 水が使用不可能になったらFail ToilFailConditions.FailOnDestroyedNullOrForbidden <JobDriver_WaterDeliver>(this, WaterIndex); if (!this.pawn.CanReserveAndReach(this.TargetA, PathEndMode.Touch, Danger.Deadly, 1, this.job.count)) { // 水を予約できなかったら終了 this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable); yield break; } // 予約する if (!this.pawn.Map.reservationManager.ReservedBy(this.TargetA.Thing, pawn)) { yield return(Toils_Reserve.Reserve(WaterIndex, 1, this.job.count, null)); } if (this.drinkingFromInventory) { // 水を持ち物から取り出す yield return(Toils_Mizu.StartCarryFromInventory(WaterIndex)); } else { // 水の場所まで行く yield return(Toils_Goto.Goto(WaterIndex, PathEndMode.OnCell)); // 水を拾う yield return(Toils_Ingest.PickupIngestible(WaterIndex, this.pawn)); } // スポットまで移動する yield return(Toils_Goto.GotoCell(this.TargetC.Cell, PathEndMode.OnCell)); // 置いて囚人に予約させる yield return(Toils_Mizu.DropCarriedThing(PrisonerIndex, DropSpotIndex)); }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable); this.FailOnBurningImmobile(TargetIndex.A); yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch)); Toil toil = new Toil(); toil.initAction = delegate() { initialXP = TargetThingA.HitPoints; }; toil.tickAction = delegate() { this.pawn.rotationTracker.FaceTarget(base.TargetA); this.pawn.GainComfortFromCellIfPossible(false); if (this.pawn.meleeVerbs.TryMeleeAttack(TargetA.Thing)) { //SoundInfo var = SoundInfo.InMap(new TargetInfo(this.TargetThingA)); //var.volumeFactor = 0.25f; //SoundDef.Named("Pawn_Melee_Punch_HitBuilding_Quiet").PlayOneShot(var); this.pawn.skills.Learn(SkillDefOf.Melee, 30f, false); TargetThingA.HitPoints = initialXP; } Building joySource = (Building)base.TargetThingA; JoyUtility.JoyTickCheckEnd(this.pawn, this.job.doUntilGatheringEnded ? JoyTickFullJoyAction.None : JoyTickFullJoyAction.EndJob, 1f, joySource); }; toil.handlingFacing = true; toil.defaultCompleteMode = ToilCompleteMode.Delay; toil.defaultDuration = (this.job.doUntilGatheringEnded ? this.job.expiryInterval : this.job.def.joyDuration); toil.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(this.pawn); }); yield return(toil); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(TargetIndex.A); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); Toil toil = new Toil(); toil.tickAction = delegate { base.pawn.rotationTracker.FaceTarget(base.TargetA); base.pawn.GainComfortFromCellIfPossible(); JoyUtility.JoyTickCheckEnd(base.pawn, joySource: (Building)base.TargetThingA, fullJoyAction: job.doUntilGatheringEnded ? JoyTickFullJoyAction.None : JoyTickFullJoyAction.EndJob); }; toil.handlingFacing = true; toil.defaultCompleteMode = ToilCompleteMode.Delay; toil.defaultDuration = (job.doUntilGatheringEnded ? job.expiryInterval : job.def.joyDuration); toil.AddFinishAction(delegate { JoyUtility.TryGainRecRoomThought(pawn); }); ModifyPlayToil(toil); yield return(toil); }
protected override IEnumerable <Toil> MakeNewToils() { // ターゲットがThing=水アイテムを摂取する場合 // 水(食事)が使用不可能になったらFail ToilFailConditions.FailOnDestroyedNullOrForbidden(this, WaterIndex); ToilFailConditions.FailOn(this, () => { if (this.Patient == null) { return(true); } // 患者がベッドに入ってなかったらFail if (!this.Patient.InBed()) { return(true); } // 到達不能になっていたらFail if (!this.pawn.CanReach(this.Patient, PathEndMode.ClosestTouch, Danger.Deadly)) { return(true); } return(false); }); // 水が予約出来ない状態なら中断 if (!ReservationUtility.CanReserveAndReach(this.pawn, this.TargetA, PathEndMode.Touch, Danger.Deadly, 1, this.job.count, null, false)) { this.GetActor().jobs.EndCurrentJob(JobCondition.Incompletable); yield break; } // 水を予約する if (!this.pawn.Map.reservationManager.ReservedBy(this.TargetA.Thing, pawn)) { yield return(Toils_Reserve.Reserve(WaterIndex, 1, this.job.count, null)); } if (this.getItemFromInventory) { // 水を持ち物から取り出す yield return(Toils_Mizu.StartCarryFromInventory(WaterIndex)); } else { // 水の場所まで行く yield return(Toils_Goto.Goto(WaterIndex, PathEndMode.OnCell)); // 水を拾う yield return(Toils_Ingest.PickupIngestible(WaterIndex, this.pawn)); } // 患者のもとへ移動 yield return(Toils_Goto.Goto(PatientIndex, PathEndMode.Touch)); // 水を飲ませる yield return(Toils_Mizu.FeedToPatient(WaterIndex, PatientIndex)); // 水の摂取終了(心情、食事の処理) yield return(Toils_Mizu.FinishDrinkPatient(WaterIndex, PatientIndex)); if (this.getItemFromInventory && !this.TargetA.ThingDestroyed) { // 所持品から取り出した&まだ残っている場合は所持品に戻す yield return(Toils_Mizu.AddCarriedThingToInventory()); } }
public override Toil OnFinish() { return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.OnCell)); }
protected override IEnumerable <Toil> MakeNewToils() { bool itemIsInMap = Item.ParentHolder is Map; bool runeIsInMap = false; if (RuneThing != null) { runeIsInMap = RuneThing.ParentHolder is Map; } if (Workbench.def.hasInteractionCell) { this.AddFailCondition(() => !Workbench.InteractionCell.Standable(Workbench.Map)); } //Add conditions if (itemIsInMap) { this.FailOnDestroyedNullOrForbidden(TargetItem); } if (runeIsInMap) { this.FailOnDestroyedNullOrForbidden(TargetRune); } if (Workbench != null) { this.FailOnDestroyedNullOrForbidden(TargetWorkBench); } //Reserve if (itemIsInMap) { yield return(Toils_Reserve.Reserve(TargetItem)); } if (runeIsInMap) { yield return(Toils_Reserve.Reserve(TargetRune)); } if (Workbench != null) { yield return(Toils_Reserve.Reserve(TargetWorkBench)); } //Walk and carry as needed. Toil endToil = new Toil(); if (itemIsInMap) { yield return(Toils_Goto.GotoThing(TargetItem, PathEndMode.OnCell)); yield return(Toils_Haul.StartCarryThing(TargetItem)); if (job.GetTarget(TargetWorkBench).IsValid) { if (Workbench.def.hasInteractionCell) { yield return(Toils_Goto.GotoCell(Workbench.InteractionCell, PathEndMode.OnCell)); } else { yield return(Toils_Goto.Goto(TargetWorkBench, PathEndMode.ClosestTouch)); } yield return(Toils_Haul.PlaceHauledThingInCell(TargetWorkBench, endToil, false)); } } if (runeIsInMap) { yield return(Toils_Goto.GotoThing(TargetRune, PathEndMode.OnCell)); if (!job.GetTarget(TargetWorkBench).IsValid) { if (itemIsInMap) { yield return(Toils_Haul.PlaceHauledThingInCell(TargetRune, endToil, false)); } } else { yield return(Toils_Haul.StartCarryThing(TargetRune)); if (Workbench.def.hasInteractionCell) { yield return(Toils_Goto.GotoCell(Workbench.InteractionCell, PathEndMode.OnCell)); } else { yield return(Toils_Goto.Goto(TargetWorkBench, PathEndMode.ClosestTouch)); } yield return(Toils_Haul.PlaceHauledThingInCell(TargetWorkBench, endToil, false)); } } //Here do work happen. foreach (Toil toil in MakeWorkToils(endToil)) { yield return(toil); } //Failure toil if hauling did not work as intended. yield return(endToil); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.Goto(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_Sabotage.DoSabotage(TargetIndex.A)); }