public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams)
        {
            ThinkResult result;

            if (!HealthAIUtility.ShouldSeekMedicalRest(pawn))
            {
                result = ThinkResult.NoJob;
            }
            else if (this.respectTimetable && RestUtility.TimetablePreventsLayDown(pawn) && !HealthAIUtility.ShouldHaveSurgeryDoneNow(pawn) && !HealthAIUtility.ShouldBeTendedNowByPlayer(pawn))
            {
                result = ThinkResult.NoJob;
            }
            else if (RestUtility.DisturbancePreventsLyingDown(pawn))
            {
                result = ThinkResult.NoJob;
            }
            else
            {
                Thing thing = RestUtility.FindPatientBedFor(pawn);
                if (thing == null)
                {
                    result = ThinkResult.NoJob;
                }
                else
                {
                    Job job = new Job(JobDefOf.LayDown, thing);
                    result = new ThinkResult(job, this, null, false);
                }
            }
            return(result);
        }
Exemple #2
0
        public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams)
        {
            if (!HealthAIUtility.ShouldSeekMedicalRest(pawn))
            {
                return(ThinkResult.NoJob);
            }
            if (respectTimetable && RestUtility.TimetablePreventsLayDown(pawn) && !HealthAIUtility.ShouldHaveSurgeryDoneNow(pawn) && !HealthAIUtility.ShouldBeTendedNowByPlayer(pawn))
            {
                return(ThinkResult.NoJob);
            }
            if (RestUtility.DisturbancePreventsLyingDown(pawn))
            {
                return(ThinkResult.NoJob);
            }
            Thing thing = RestUtility.FindPatientBedFor(pawn);

            if (thing == null)
            {
                return(ThinkResult.NoJob);
            }
            return(new ThinkResult(JobMaker.MakeJob(JobDefOf.LayDown, thing), this));
        }