// Token: 0x06000095 RID: 149 RVA: 0x000059E9 File Offset: 0x00003BE9 protected override IEnumerable <Toil> MakeNewToils() { var count = 0; this.FailOn(() => job.GetTarget(TargetIndex.A).Thing.DestroyedOrNull()); this.FailOn(() => !HaywireData.IsHaywired(pawn)); var count1 = count; this.FailOn(() => count1 > 4); yield return(Toils_Combat.TrySetJobToUseAttackVerb(TargetIndex.A)); var gotoCastPos = Toils_Combat.GotoCastPosition(TargetIndex.A, TargetIndex.None, false, 0.95f); yield return(gotoCastPos); var count2 = count; count = count2 + 1; if (count > 8) { EndJobWith(JobCondition.Incompletable); } var jumpIfCannotHit = Toils_Jump.JumpIfTargetNotHittable(TargetIndex.A, gotoCastPos); yield return(jumpIfCannotHit); yield return(Toils_Combat.CastVerb(TargetIndex.A)); yield return(Toils_Jump.Jump(jumpIfCannotHit)); }
// Token: 0x06000073 RID: 115 RVA: 0x00004C58 File Offset: 0x00002E58 public static void DoHaywireEffect(Pawn pawn) { if (pawn != null && pawn.RaceProps.IsMechanoid && HaywireData.TrySetHaywireTicks(pawn, 1.5f, 2.5f) && pawn.Map != null) { MoteMaker.ThrowText(new Vector3(pawn.Position.x + 1f, pawn.Position.y, pawn.Position.z + 1f), pawn.Map, "GhostGear.HayWired".Translate(), Color.yellow); } }
// Token: 0x06000069 RID: 105 RVA: 0x0000479C File Offset: 0x0000299C public static Mote MakeHaywireOverlay(Thing HaywiredThing) { if (HaywiredThing.DestroyedOrNull() || HaywiredThing is not Pawn pawn || !pawn.RaceProps.IsMechanoid || pawn.Dead || pawn.Map == null || !pawn.Spawned || !HaywireData.IsHaywired(pawn)) { return(null); } var mote = (Mote)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("Mote_GGHaywired")); mote.Attach(HaywiredThing); GenSpawn.Spawn(mote, pawn.Position, pawn.Map); return(mote); }
// Token: 0x06000077 RID: 119 RVA: 0x00004DD0 File Offset: 0x00002FD0 public static Job TryGetHaywireJob(Pawn pawn, int HWTicks) { Job haywireJob = null; if (pawn.Map == null || pawn.Downed || pawn.Dead || !pawn.Spawned) { return(null); } if (!HaywireData.IsHaywired(pawn)) { return(null); } if (pawn.CurJob != null && IsHaywireJobDef(pawn.CurJobDef)) { return(null); } if (pawn.jobs.jobQueue.Count > 0 && IsHaywireJobDef(pawn.jobs.jobQueue.Peek().job.def)) { return(null); } var minTicks = 0; var maxTicks = 0; var tickBlock = 5; var haywireJobDef = TryGetHWJobDef(pawn, out var targ); if (haywireJobDef == null) { return(null); } if (haywireJobDef == HWJobDef.HWAttackPawn || haywireJobDef == HWJobDef.HWAttackThing) { if (targ != null) { haywireJob = new Job(haywireJobDef, targ) { locomotionUrgency = LocomotionUrgency.Jog }; minTicks = HWTicks * tickBlock * 4; maxTicks = HWTicks * tickBlock * 6; } else { haywireJobDef = DefDatabase <JobDef> .GetNamed("HWWander", false); } } if (haywireJobDef == HWJobDef.HWBreakDown || haywireJobDef == HWJobDef.HWExplosion || haywireJobDef == HWJobDef.HWWander) { haywireJob = new Job(haywireJobDef); if (haywireJob.def == HWJobDef.HWWander) { var wanderCell = TryGetHWWanderCell(pawn); minTicks = HWTicks * tickBlock; maxTicks = HWTicks * tickBlock * 3; haywireJob = new Job(haywireJobDef, wanderCell) { locomotionUrgency = LocomotionUrgency.Walk }; } else { minTicks = HWTicks * tickBlock; maxTicks = HWTicks * tickBlock * 3; haywireJob = new Job(haywireJobDef) { locomotionUrgency = LocomotionUrgency.None }; } } if (haywireJob != null) { haywireJob.expiryInterval = RndTicks(minTicks, maxTicks); } return(haywireJob); }
// Token: 0x0600009B RID: 155 RVA: 0x00005A2D File Offset: 0x00003C2D public virtual void DecorateWaitToil(Toil wait) { wait.AddFailCondition(() => !HaywireData.IsHaywired(pawn)); }