protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Misc.ThrowColonistAttackingMote(TargetIndex.B)); yield return(new Toil { initAction = delegate { verb = pawn.CurJob.verbToUse as Verb_Psionic; if (verb == null) { Log.Error("PsiTech tried to start a SingleTargetPsionic job with no verb."); EndJobWith(JobCondition.Errored); return; } ticksLeftThisToil = verb.Ability.Def.CastTimeTicks; totalTicksRequired = ticksLeftThisToil; var target = TargetThingB as Pawn; if (!target?.Dead ?? false) { pawn.stances.SetStance(new Stance_PsiWarmup(ticksLeftThisToil, TargetB, true)); } else { pawn.pather.StopDead(); EndJobWith(JobCondition.Incompletable); } }, tickAction = delegate { if (!TargetA.IsValid || !TargetB.IsValid) { EndJobWith(JobCondition.Incompletable); return; } var target = TargetThingB as Pawn; if ((target?.Dead ?? true) || !(target.ParentHolder is Map)) { EndJobWith(JobCondition.Incompletable); return; } if (!verb.Ability.CanHitTarget(target)) { EndJobWith(JobCondition.Incompletable); return; } if (ticksLeftThisToil > 0) { return; } verb.DoCast(TargetB.Thing as Pawn); EndJobWith(JobCondition.Succeeded); }, defaultCompleteMode = ToilCompleteMode.Never }); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(new Toil { initAction = delegate { verb = pawn.CurJob.verbToUse as Verb_Psionic; if (verb == null) { Log.Error("PsiTech tried to start a BurstPsionic job with no verb."); EndJobWith(JobCondition.Errored); return; } ticksLeftThisToil = verb.Ability.Def.CastTimeTicks; totalTicksRequired = ticksLeftThisToil; pawn.stances.SetStance(new Stance_PsiWarmup(ticksLeftThisToil, pawn.Position + IntVec3.South * 2, true)); }, tickAction = delegate { if (jobInterrupted) { EndJobWith(JobCondition.InterruptForced); } if (ticksLeftThisToil > 0) { return; } verb.DoCast(null); EndJobWith(JobCondition.Succeeded); }, defaultCompleteMode = ToilCompleteMode.Never }); }