protected override IEnumerable <Toil> MakeNewToils() { this.FailOnIncapable(PawnCapacityDefOf.Manipulation); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); Toil prepare = Toils_General.Wait(this.useDuration, TargetIndex.None); prepare.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A); prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); yield return(prepare); Toil use = new Toil(); use.initAction = delegate() { Pawn actor = use.actor; CompUsable compUsable = actor.CurJob.targetA.Thing.TryGetComp <CompUsable>(); compUsable.UsedBy(actor); }; use.defaultCompleteMode = ToilCompleteMode.Instant; yield return(use); yield break; }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: this.FailOnIncapable(PawnCapacityDefOf.Manipulation); this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); if (!this.$disposing) { this.$PC = 1; } return(true); case 1u: prepare = Toils_General.Wait(this.useDuration, TargetIndex.None); prepare.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f); prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A); prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch); this.$current = prepare; if (!this.$disposing) { this.$PC = 2; } return(true); case 2u: { Toil use = new Toil(); use.initAction = delegate() { Pawn actor = use.actor; CompUsable compUsable = actor.CurJob.targetA.Thing.TryGetComp <CompUsable>(); compUsable.UsedBy(actor); }; use.defaultCompleteMode = ToilCompleteMode.Instant; this.$current = use; if (!this.$disposing) { this.$PC = 3; } return(true); } case 3u: this.$PC = -1; break; } return(false); }