コード例 #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            var wait = Toils_General.Wait(50, TargetIndex.A).FailOnNotDiningQueued(TargetIndex.A);

            //this.FailOnNotDining(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnForbidden(TargetIndex.B);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch));

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

            yield return(Toils_Waiting.UpdateOrderConsumableTo(TargetIndex.A, TargetIndex.B));

            yield return(Toils_Waiting.FindRandomAdjacentCell(TargetIndex.A, TargetIndex.C)); // A is the patron, C is the spot

            yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.C));

            yield return(wait);

            yield return(Toils_Jump.JumpIf(wait, () => pawn.jobs.curJob?.GetTarget(TargetIndex.A).Pawn?.GetDriver <JobDriver_Dine>() == null)); // Driver not available

            yield return(Toils_Waiting.GetDiningSpot(TargetIndex.A, TargetIndex.C));

            yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.C));

            yield return(Toils_Jump.JumpIf(wait, () => pawn.jobs.curJob?.GetTarget(TargetIndex.A).Pawn?.GetDriver <JobDriver_Dine>() == null)); // Driver not available

            yield return(Toils_Waiting.ClearOrder(TargetIndex.A, TargetIndex.B));

            yield return(Toils_Waiting.AnnounceServing(TargetIndex.A, TargetIndex.B));
        }
コード例 #2
0
        //public override string GetReport()
        //{
        //    //if (job?.plantDefToSow == null) return base.GetReport();
        //    return "JobDineGoReport".Translate();
        //}

        protected override IEnumerable <Toil> MakeNewToils()
        {
            var wait = Toils_General.Wait(50, IndexSpot).FailOnNotDiningQueued(IndexPatron);
            var end  = Toils_General.Wait(5);

            this.FailOnNotDiningQueued(IndexPatron);                                      // Careful never to use B for something else

            yield return(Toils_Waiting.FindRandomAdjacentCell(IndexSpot, IndexStanding)); // A is first the dining spot, then where we'll stand

            yield return(Toils_Goto.GotoCell(IndexStanding, PathEndMode.OnCell).FailOnRestaurantClosed());

            yield return(Toils_Interpersonal.WaitToBeAbleToInteract(pawn));

            yield return(wait);

            yield return(Toils_Jump.JumpIf(wait, () => !(Patron?.jobs.curDriver is JobDriver_Dine))); // Not dining right now

            yield return(Toils_Waiting.GetDiningSpot(IndexPatron, IndexSpot));                        // A is dining spot again now

            yield return(Toils_Waiting.GetSpecificDiningSpotCellForMakingTable(IndexSpot, IndexPatron, IndexChairPos));

            yield return(Toils_Waiting.TakeOrder(IndexPatron));

            yield return(Toils_Interpersonal.SetLastInteractTime(IndexPatron));

            yield return(Toils_Jump.JumpIf(end, () => DiningSpot?.IsSpotReady(ChairPos) == true));

            yield return(Toils_Goto.GotoCell(IndexSpot, PathEndMode.ClosestTouch));

            yield return(Toils_Waiting.MakeTableReady(IndexSpot, IndexChairPos));

            yield return(end);
        }