public override float GetPriority(Pawn pawn) { float zero = 0f; Need_Silence quietNeed = pawn.needs.TryGetNeed <Need_Silence>(); if (quietNeed == null) { return(zero); } if (FoodUtility.ShouldBeFedBySomeone(pawn)) { return(zero); } float num = 0.3f; if (pawn.mindState.IsIdle) { num = 0.5f; } Need_Rest restNeed = pawn.needs.TryGetNeed <Need_Rest>(); if (restNeed != null && restNeed.CurLevel > 0.95f) { num = 0.6f; } if (quietNeed.CurLevel < num) { return(8f); // Bad Hygiene's use toilet is 9.6f; } return(zero); }
protected override Job TryGiveJob(Pawn pawn) { if (GetPriority(pawn) == 0f) { return(null); } Need_Silence quietNeed = pawn.needs.TryGetNeed <Need_Silence>(); Region region = ClosestRegionWithinTemperatureRange(pawn.Position, pawn.Map, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), RegionType.Set_Passable); if (quietNeed != null && quietNeed.CurLevel == 0f && region != null) { return(JobMaker.MakeJob(QuietDefOf.GotoQuietPlace, region.RandomCell)); } return(null); }