Пример #1
0
        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));
        }