Example #1
0
        private static void Notify_DangerousPosition(this Pawn pawn, IntVec3 cell)
        {
            if (!pawn.Spawned)
            {
                return;
            }
            if (pawn.RaceProps.intelligence < Intelligence.ToolUser)
            {
                return;
            }
            if (PawnUtility.PlayerForcedJobNowOrSoon(pawn))
            {
                return;
            }

            if (!RCellFinder.TryFindDirectFleeDestination(cell, 9f, pawn, out IntVec3 cell2))
            {
                return;
            }
            pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
            Job job = JobMaker.MakeJob(JobDefOf.Goto, cell2);

            job.locomotionUrgency = LocomotionUrgency.Sprint;
            pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
        }
Example #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(TryGetAttackNearbyEnemyJob(pawn));

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

            default:
                return(null);
            }
        }
Example #3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Pawn meleeThreat = pawn.mindState.meleeThreat;

            if (meleeThreat == null)
            {
                return(null);
            }
            if (this.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);
            }
            // return new Job(JobDefOf.AttackMelee, meleeThreat)
            Thing pawn2 = this.FindPawnTarget(pawn);

            return(this.RangedAttackJob(pawn, pawn2));
        }