protected override IEnumerable <Toil> MakeNewToils() { //FAIL CONDITIONS ToilFailConditions.FailOnDestroyedOrNull <JobDriver_Training>(this, TargetIndex.A); ToilFailConditions.FailOnDespawnedNullOrForbidden <JobDriver_Training>(this, TargetIndex.A); this.FailOn(() => { Pawn p = this.pawn; if (this.IsContinuation(this.job) && this.CurToilIndex > 1) { if ((double)p.needs.food.CurLevel < 0.25) { Messages.Message(p.LabelCap + " has stopped training due hunger.", (GlobalTargetInfo)p, MessageTypeDefOf.NeutralEvent); } else if ((double)p.needs.rest.CurLevel < 0.25) { Messages.Message(p.LabelCap + " has stopped training due lack of sleep.", (GlobalTargetInfo)p, MessageTypeDefOf.NeutralEvent); } } return((double)p.needs.food.CurLevel < 0.25 || (double)p.needs.rest.CurLevel < 0.25 || p.Drafted || p.jobs.jobQueue.Any()); }); //SEQUENZA AZIONI PAWN yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell)); Toil Train = Toils_Training(TargetIndex.B); yield return(Train); yield return(Toils_General.Wait(100)); yield return(Toils_Jump.Jump(Train)); }
protected override IEnumerable <Toil> MakeNewToils() { Toil toil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch); ToilFailConditions.FailOnDestroyedOrNull <Toil>(toil, TargetIndex.B); yield return(toil); yield return(this.BashIt()); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { ToilFailConditions.FailOnDestroyedOrNull <JobDriver_Segmentation>(this, TargetIndex.A); ToilFailConditions.FailOnDespawnedOrNull <JobDriver_Segmentation>(this, TargetIndex.A); ToilFailConditions.FailOn <JobDriver_Segmentation>(this, new Func <bool>(this.eaterIsKilled)); Toil resCorpse = new Toil(); resCorpse.initAction = delegate() { Pawn actor = resCorpse.actor; Thing thing = resCorpse.actor.CurJob.GetTarget(TargetIndex.A).Thing; bool flag = !thing.Spawned || !this.Map.reservationManager.CanReserve(actor, thing, 1); bool flag2 = flag; if (flag2) { actor.jobs.EndCurrentJob(JobCondition.Incompletable, true); } else { this.Map.reservationManager.Reserve(actor, actor.CurJob, thing, 1); } }; resCorpse.defaultCompleteMode = ToilCompleteMode.Instant; yield return(resCorpse); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_General.Wait(400)); Toil toil = new Toil { defaultCompleteMode = ToilCompleteMode.Instant }; toil.initAction = new Action(this.doStripCorpse); yield return(toil); yield return(Toils_General.Wait(60)); Toil toil2 = new Toil { defaultCompleteMode = ToilCompleteMode.Instant }; toil2.initAction = new Action(this.doChewCorpse); ToilEffects.WithEffect(toil2, EffecterDefOf.EatMeat, TargetIndex.A); ToilFailConditions.EndOnDespawnedOrNull <Toil>(toil2, TargetIndex.A, JobCondition.Incompletable); yield return(toil2); yield break; }