protected override Job TryGiveJob(Pawn pawn)
        {
            if ((int)pawn.RaceProps.intelligence < 2)
            {
                return(null);
            }
            if (pawn.mindState.knownExploder == null)
            {
                return(null);
            }
            if (!pawn.mindState.knownExploder.Spawned)
            {
                pawn.mindState.knownExploder = null;
                return(null);
            }
            if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                return(null);
            }
            Thing knownExploder = pawn.mindState.knownExploder;

            if ((float)(pawn.Position - knownExploder.Position).LengthHorizontalSquared > 81f)
            {
                return(null);
            }
            if (!RCellFinder.TryFindDirectFleeDestination(knownExploder.Position, 9f, pawn, out var result))
            {
                return(null);
            }
            Job job = JobMaker.MakeJob(JobDefOf.Goto, result);

            job.locomotionUrgency = LocomotionUrgency.Sprint;
            return(job);
        }
예제 #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Job result;

            if (pawn.RaceProps.intelligence < Intelligence.Humanlike)
            {
                result = null;
            }
            else if (pawn.mindState.knownExploder == null)
            {
                result = null;
            }
            else if (!pawn.mindState.knownExploder.Spawned)
            {
                pawn.mindState.knownExploder = null;
                result = null;
            }
            else if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                result = null;
            }
            else
            {
                Thing   knownExploder = pawn.mindState.knownExploder;
                IntVec3 c;
                if ((float)(pawn.Position - knownExploder.Position).LengthHorizontalSquared > 81f)
                {
                    result = null;
                }
                else if (!RCellFinder.TryFindDirectFleeDestination(knownExploder.Position, 9f, pawn, out c))
                {
                    result = null;
                }
                else
                {
                    result = new Job(JobDefOf.Goto, c)
                    {
                        locomotionUrgency = LocomotionUrgency.Sprint
                    };
                }
            }
            return(result);
        }