protected override Job TryGiveJob(Pawn pawn)
        {
            Pawn meleeThreat = pawn.mindState.meleeThreat;

            if (meleeThreat == null)
            {
                return(null);
            }
            if (IsHunting(pawn, meleeThreat))
            {
                return(null);
            }
            if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                return(null);
            }
            if (pawn.playerSettings != null && pawn.playerSettings.UsesConfigurableHostilityResponse && pawn.playerSettings.hostilityResponse != HostilityResponseMode.Attack)
            {
                return(null);
            }
            if (!pawn.mindState.MeleeThreatStillThreat)
            {
                pawn.mindState.meleeThreat = null;
                return(null);
            }
            if (pawn.story != null && pawn.story.WorkTagIsDisabled(WorkTags.Violent))
            {
                return(null);
            }
            Job job = new Job(JobDefOf.AttackMelee, meleeThreat);

            job.maxNumMeleeAttacks = 1;
            job.expiryInterval     = 200;
            return(job);
        }
Пример #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.playerSettings == null || !pawn.playerSettings.UsesConfigurableHostilityResponse)
            {
                return(null);
            }
            if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                return(null);
            }
            switch (pawn.playerSettings.hostilityResponse)
            {
            case HostilityResponseMode.Ignore:
                return(null);

            case HostilityResponseMode.Attack:
                return(this.TryGetAttackNearbyEnemyJob(pawn));

            case HostilityResponseMode.Flee:
                return(this.TryGetFleeJob(pawn));

            default:
                return(null);
            }
        }
Пример #3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Job result;

            if (pawn.playerSettings == null || !pawn.playerSettings.UsesConfigurableHostilityResponse)
            {
                result = null;
            }
            else if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                result = null;
            }
            else
            {
                switch (pawn.playerSettings.hostilityResponse)
                {
                case HostilityResponseMode.Ignore:
                    result = null;
                    break;

                case HostilityResponseMode.Attack:
                    result = this.TryGetAttackNearbyEnemyJob(pawn);
                    break;

                case HostilityResponseMode.Flee:
                    result = this.TryGetFleeJob(pawn);
                    break;

                default:
                    result = null;
                    break;
                }
            }
            return(result);
        }
        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);
        }
 protected override Job TryGiveJob(Pawn pawn)
 {
     if (pawn.playerSettings == null || !pawn.playerSettings.UsesConfigurableHostilityResponse)
     {
         return(null);
     }
     if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
     {
         return(null);
     }
     return(pawn.playerSettings.hostilityResponse switch
     {
         HostilityResponseMode.Ignore => null,
         HostilityResponseMode.Attack => TryGetAttackNearbyEnemyJob(pawn),
         HostilityResponseMode.Flee => TryGetFleeJob(pawn),
         _ => null,
     });
Пример #6
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);
        }