protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(AltarIndex, JobCondition.Incompletable); yield return(Toils_Reserve.Reserve(AltarIndex, 1)); yield return(Toils_Reserve.Reserve(AltarInteractionCell, 1)); Toil gotoAltarToil; gotoAltarToil = Toils_Goto.GotoThing(AltarInteractionCell, PathEndMode.OnCell); yield return(gotoAltarToil); // Log.Message("A"); // if (this.CurJob == null) Log.Message("NOJob?"); var altarToil = new Toil(); altarToil.defaultCompleteMode = ToilCompleteMode.Delay; altarToil.defaultDuration = this.CurJob.def.joyDuration; altarToil.AddPreTickAction(() => { // if (this.pawn == null) Log.Message("No Pawn??"); // if (this.TargetA == null) Log.Message("NoTargetA"); this.pawn.Drawer.rotator.FaceCell(this.TargetA.Cell); this.pawn.GainComfortFromCellIfPossible(); ThrowPreacherMote(this.pawn); }); yield return(altarToil); // Log.Message("B"); // if (this.pawn.jobs.curDriver == null) Log.Message("NoDriver"); // if (this.pawn.jobs.curJob == null) Log.Message("NoJob"); this.AddFinishAction(() => { if (this.TargetA.HasThing) { this.Map.reservationManager.Release(this.CurJob.targetA.Thing, pawn); } else { this.Map.reservationManager.Release(this.CurJob.targetA.Cell, this.pawn); } BuildingAltar altar = this.TargetA.Thing as BuildingAltar; altar.CalledInFlock = false; SermonUtility.HoldSermonTickCheckEnd(this.pawn, altar); // Log.Message("C"); }); }
protected override IEnumerable <Toil> MakeNewToils() { this.EndOnDespawnedOrNull(AltarIndex, JobCondition.Incompletable); yield return(Toils_Reserve.Reserve(AltarIndex, 1)); yield return(Toils_Reserve.Reserve(AltarInteractionCell, 1)); Toil gotoAltarToil; gotoAltarToil = Toils_Goto.GotoThing(AltarInteractionCell, PathEndMode.OnCell); yield return(gotoAltarToil); List <Pawn> Listeners = Find.MapPawns.AllPawnsSpawned.FindAll(x => x.CurJob.def == CorruptionDefOfs.AttendSermon); var altarToil = new Toil(); altarToil.defaultCompleteMode = ToilCompleteMode.Delay; altarToil.defaultDuration = this.CurJob.def.joyDuration; altarToil.AddPreTickAction(() => { this.pawn.Drawer.rotator.FaceCell(this.TargetA.Cell); this.pawn.GainComfortFromCellIfPossible(); }); yield return(altarToil); this.AddFinishAction(() => { if (this.TargetA.HasThing) { Find.Reservations.Release(this.CurJob.targetA.Thing, pawn); } else { Find.Reservations.Release(this.CurJob.targetA.Cell, this.pawn); } SermonUtility.HoldSermonTickCheckEnd(this.pawn, this.TargetA.Thing as BuildingAltar); }); }