protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOnBurningImmobile(TargetIndex.A); this.FailOn(delegate { HPGMcyclecomp compHPGM = this.job.targetA.Thing.TryGetComp <HPGMcyclecomp>(); //HPGMcyclecomp compHPGM = null; return(!compHPGM.CanUseNow); }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell)); Toil work = new Toil(); work.tickAction = delegate { Pawn actor = work.actor; Building building = (Building)actor.CurJob.targetA.Thing; HPGMcyclecomp comp = building.GetComp <HPGMcyclecomp>(); comp.Used(actor); //actor.skills.Learn(SkillDefOf.Intellectual, 0.035f, false); actor.skills.Learn(SkillDefOf.Melee, 0.02f, false); actor.GainComfortFromCellIfPossible(); }; work.defaultCompleteMode = ToilCompleteMode.Never; work.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell); //work.activeSkill = (() => SkillDefOf.Intellectual); yield return(work); }