public void PatherTick() { if (this.WillCollideWithPawnAt(this.pawn.Position)) { if (!this.FailedToFindCloseUnoccupiedCellRecently()) { IntVec3 intVec; if (CellFinder.TryFindBestPawnStandCell(this.pawn, out intVec, true) && intVec != this.pawn.Position) { this.pawn.Position = intVec; this.ResetToCurrentPosition(); if (this.moving && this.TrySetNewPath()) { this.TryEnterNextPathCell(); } } else { this.failedToFindCloseUnoccupiedCellTicks = Find.TickManager.TicksGame; } } return; } if (this.pawn.stances.FullBodyBusy) { return; } if (!this.moving || !this.WillCollideWithPawnOnNextPathCell()) { this.lastMovedTick = Find.TickManager.TicksGame; if (this.nextCellCostLeft > 0f) { this.nextCellCostLeft -= this.CostToPayThisTick(); } else if (this.moving) { this.TryEnterNextPathCell(); } return; } this.nextCellCostLeft = this.nextCellCostTotal; if (((this.curPath != null && this.curPath.NodesLeftCount < 30) || PawnUtility.AnyPawnBlockingPathAt(this.nextCell, this.pawn, false, true, false)) && !this.BestPathHadPawnsInTheWayRecently() && this.TrySetNewPath()) { this.ResetToCurrentPosition(); this.TryEnterNextPathCell(); return; } if (Find.TickManager.TicksGame - this.lastMovedTick >= 180) { Pawn pawn = PawnUtility.PawnBlockingPathAt(this.nextCell, this.pawn, false, false, false); if (pawn != null && this.pawn.HostileTo(pawn) && this.pawn.TryGetAttackVerb(pawn, false) != null) { Job job = new Job(JobDefOf.AttackMelee, pawn); job.maxNumMeleeAttacks = 1; job.expiryInterval = 300; this.pawn.jobs.StartJob(job, JobCondition.Incompletable, null, false, true, null, null, false); return; } } }