private static MoodLevel GetMoodLevel(Pawn pawn)
        {
            ValidateArg.NotNull(pawn, nameof(pawn));

            BreakLevelModel breakLevel = BCBManager.GetBreakLevelFor(pawn);

            if (breakLevel is null)
            {
                return(MoodLevel.Undefined);
            }

            float curMood = breakLevel.CurInstanLevel;

            if (curMood >= breakLevel.Minor)
            {
                return(MoodLevel.Satisfied);
            }
            else if (curMood >= breakLevel.Major)
            {
                return(MoodLevel.Minor);
            }
            else if (curMood >= breakLevel.Extreme)
            {
                return(MoodLevel.Major);
            }
            else
            {
                return(MoodLevel.Extreme);
            }
        }
        public override void FinalizeInit()
        {
            ColonistBarUitlity.Init();
            BCBManager.Reset();
            BetterColonistBarMod.Reset();

            if (_init)
            {
                BCBManager.UpdateColonistBar();
            }
        }
Beispiel #3
0
        public static bool ShouldShowBar(this Pawn pawn)
        {
            ValidateArg.NotNull(pawn, nameof(pawn));

            if (_settings.ShowInspiredPawn && pawn.Inspired)
            {
                return(true);
            }

            if (_settings.ShowSickPawn && BCBManager.GetStatusFor(pawn).HasTendingHediff)
            {
                return(true);
            }

            if (_settings.ShowGuestPawn && (pawn.IsQuestLodger() || pawn.IsQuestHelper()))
            {
                return(true);
            }

            if (_settings.ShowDraftedPawn && pawn.Drafted)
            {
                return(true);
            }

            if ((pawn.mindState?.IsIdle ?? false) && GenDate.DaysPassed > 1)
            {
                return(true);
            }

            if (pawn.InMentalState)
            {
                return(true);
            }

            if (pawn.IsBurning())
            {
                return(true);
            }

            if (pawn.CurJob?.def == JobDefOf.FleeAndCower)
            {
                return(true);
            }

            MoodLevel shownMoodLevel = BetterColonistBarMod.ModSettings.ShownMoodLevel;

            return(BCBManager.GetBreakLevelFor(pawn).MoodLevel <= shownMoodLevel);
        }