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); } }
// Token: 0x06000030 RID: 48 RVA: 0x00002C83 File Offset: 0x00000E83 protected override IEnumerable <Toil> MakeNewToils() { CompUniversalFermenter comp = ThingCompUtility.TryGetComp <CompUniversalFermenter>(this.Fermenter); ToilFailConditions.FailOn <JobDriver_TakeProductOutOfUniversalFermenter>(this, () => !comp.Fermented); ToilFailConditions.FailOnDestroyedNullOrForbidden <JobDriver_TakeProductOutOfUniversalFermenter>(this, (TargetIndex)1); yield return(Toils_Reserve.Reserve((TargetIndex)1, 1, -1, null)); yield return(Toils_Goto.GotoThing((TargetIndex)1, (PathEndMode)3)); yield return(ToilEffects.WithProgressBarToilDelay(ToilFailConditions.FailOnDestroyedNullOrForbidden <Toil>(Toils_General.Wait(200, 0), (TargetIndex)1), (TargetIndex)1, false, -0.5f)); yield return(new Toil { initAction = delegate() { Thing thing = comp.TakeOutProduct(); GenPlace.TryPlaceThing(thing, this.pawn.Position, this.Map, (ThingPlaceMode)1, null, null); StoragePriority storagePriority = StoreUtility.CurrentStoragePriorityOf(thing); IntVec3 intVec; if (StoreUtility.TryFindBestBetterStoreCellFor(thing, this.pawn, this.Map, storagePriority, this.pawn.Faction, out intVec, true)) { this.job.SetTarget((TargetIndex)2, thing); this.job.count = thing.stackCount; this.job.SetTarget((TargetIndex)3, intVec); return; } this.EndJobWith((JobCondition)3); }, defaultCompleteMode = (ToilCompleteMode)1 }); yield return(Toils_Reserve.Reserve((TargetIndex)2, 1, -1, null)); yield return(Toils_Reserve.Reserve((TargetIndex)3, 1, -1, null)); yield return(Toils_Goto.GotoThing((TargetIndex)2, (PathEndMode)3)); yield return(Toils_Haul.StartCarryThing((TargetIndex)2, false, false, false)); Toil carry = Toils_Haul.CarryHauledThingToCell((TargetIndex)3); yield return(carry); yield return(Toils_Haul.PlaceHauledThingInCell((TargetIndex)3, carry, true)); yield break; }
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)); }
// Token: 0x0600002B RID: 43 RVA: 0x00002C03 File Offset: 0x00000E03 protected override IEnumerable <Toil> MakeNewToils() { CompUniversalFermenter comp = ThingCompUtility.TryGetComp <CompUniversalFermenter>(this.Fermenter); ToilFailConditions.FailOn <JobDriver_FillUniversalFermenter>(this, () => comp.SpaceLeftForIngredient <= 0); ToilFailConditions.FailOnDestroyedNullOrForbidden <JobDriver_FillUniversalFermenter>(this, (TargetIndex)1); ToilFailConditions.FailOnDestroyedNullOrForbidden <JobDriver_FillUniversalFermenter>(this, (TargetIndex)2); Toil ingrToil = Toils_Reserve.Reserve((TargetIndex)2, 1, -1, null); yield return(ingrToil); yield return(Toils_Reserve.Reserve((TargetIndex)1, 1, -1, null)); yield return(ToilFailConditions.FailOnDestroyedNullOrForbidden <Toil>(ToilFailConditions.FailOnSomeonePhysicallyInteracting <Toil>(Toils_Goto.GotoThing((TargetIndex)2, (PathEndMode)3), (TargetIndex)2), (TargetIndex)2)); yield return(ToilFailConditions.FailOnDestroyedNullOrForbidden <Toil>(Toils_Haul.StartCarryThing((TargetIndex)2, false, true, false), (TargetIndex)2)); yield return(Toils_Haul.CheckForGetOpportunityDuplicate(ingrToil, (TargetIndex)2, 0, true, null)); yield return(Toils_Haul.CarryHauledThingToCell((TargetIndex)1)); yield return(ToilEffects.WithProgressBarToilDelay(ToilFailConditions.FailOnDestroyedNullOrForbidden <Toil>(Toils_General.Wait(200, 0), (TargetIndex)1), (TargetIndex)1, false, -0.5f)); yield return(new Toil { initAction = delegate() { if (!comp.AddIngredient(this.Ingredient)) { this.EndJobWith((JobCondition)3); Log.Message("JobCondition.Incompletable", false); } }, defaultCompleteMode = (ToilCompleteMode)1 }); yield break; }
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()); } }