protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOnBurningImmobile(TargetIndex.A); this.FailOn(delegate() { CompPowerPlantHamsterWheel compHW = job.targetA.Thing.TryGetComp <CompPowerPlantHamsterWheel>(); return(!compHW.CanUseNow); }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell)); Toil work = new Toil(); work.initAction = delegate() { Pawn actor = work.actor; Building building = (Building)actor.CurJob.targetA.Thing; CompPowerPlantHamsterWheel comp = building.GetComp <CompPowerPlantHamsterWheel>(); comp.StartTurnning(actor.GetStatValue(StatDefOf.MoveSpeed, true), actor); }; work.tickAction = delegate() { if (Current.Game.tickManager.TicksGame % 10 == 0) { Pawn actor = work.actor; Traverse.Create(actor.Drawer).Field <JitterHandler>("jitterer").Value.AddOffset(0.07f, Rand.Range(0, 360)); } }; work.AddFinishAction(delegate() { Pawn actor = work.actor; Building building = (Building)actor.CurJob.targetA.Thing; CompPowerPlantHamsterWheel comp = building.GetComp <CompPowerPlantHamsterWheel>(); comp.UsingDone(); }); work.defaultCompleteMode = ToilCompleteMode.Delay; work.defaultDuration = 4000; work.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell); yield return(work); yield break; }