protected override IEnumerable <Toil> MakeNewToils() { rotateToFace = Facing; AddEndCondition(delegate { if (PreacherPawn.CurJob.def == CultsDefOf.Cults_ReflectOnWorship) { return(JobCondition.Succeeded); } if (PreacherPawn.CurJob.def != CultsDefOf.Cults_HoldWorship) { return(JobCondition.Incompletable); } return(JobCondition.Ongoing); }); this.EndOnDespawnedOrNull(Spot); this.EndOnDespawnedOrNull(Build); yield return(Toils_Reserve.Reserve(Spot)); var gotoPreacher = TargetC.HasThing ? Toils_Goto.GotoThing(Spot, PathEndMode.OnCell) : Toils_Goto.GotoCell(Spot, PathEndMode.OnCell); yield return(gotoPreacher); var altarToil = new Toil { defaultCompleteMode = ToilCompleteMode.Delay, defaultDuration = CultUtility.ritualDuration }; altarToil.AddPreTickAction(() => { pawn.GainComfortFromCellIfPossible(); pawn.rotationTracker.FaceCell(TargetB.Cell); if (PreacherPawn.CurJob.def != CultsDefOf.Cults_HoldWorship) { ReadyForNextToil(); } }); yield return(altarToil); yield return(Toils_Jump.JumpIf(altarToil, () => PreacherPawn.CurJob.def == CultsDefOf.Cults_HoldWorship)); yield return(Toils_Reserve.Release(Spot)); AddFinishAction(() => { //When the ritual is finished -- then let's give the thoughts if (Altar.currentWorshipState == Building_SacrificialAltar.WorshipState.finishing || Altar.currentWorshipState == Building_SacrificialAltar.WorshipState.finished) { CultUtility.AttendWorshipTickCheckEnd(PreacherPawn, pawn); Utility.DebugReport("Called end tick check"); } pawn.ClearAllReservations(); //if (this.TargetC.HasThing && TargetC.Thing is Thing t) //{ // if (pawn.Res Map.reservationManager.IsReserved(this.job.targetC.Thing, Faction.OfPlayer)) // Map.reservationManager.Release(this.job.targetC.Thing, pawn); //} //else //{ // if (Map.reservationManager.IsReserved(this.job.targetC.Cell, Faction.OfPlayer)) // Map.reservationManager.Release(this.job.targetC.Cell, this.pawn); //} }); }