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); }
protected override bool Satisfied(Pawn pawn) { bool result; if (pawn.CurJob == null || !pawn.GetPosture().Laying()) { result = false; } else { if (!pawn.Downed) { if (RestUtility.DisturbancePreventsLyingDown(pawn)) { return(false); } if (!pawn.CurJob.restUntilHealed || !HealthAIUtility.ShouldSeekMedicalRest(pawn)) { if (!pawn.jobs.curDriver.asleep) { return(false); } if (!pawn.CurJob.playerForced) { if (RestUtility.TimetablePreventsLayDown(pawn)) { return(false); } } } } result = true; } return(result); }
protected override bool Satisfied(Pawn pawn) { if (pawn.CurJob != null && pawn.jobs.curDriver.layingDown != 0) { if (!pawn.Downed) { if (RestUtility.DisturbancePreventsLyingDown(pawn)) { return(false); } if (!pawn.CurJob.restUntilHealed || !HealthAIUtility.ShouldSeekMedicalRest(pawn)) { if (!pawn.jobs.curDriver.asleep) { return(false); } if (!pawn.CurJob.playerForced && RestUtility.TimetablePreventsLayDown(pawn)) { return(false); } } } return(true); } return(false); }
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)); }