From 0b92e0c335922e3f070953f148db0b19f654f30d Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Sat, 5 Oct 2024 09:21:18 -0400 Subject: [PATCH] Fix Mood (Revert PR#564) (#566) Fix Mood --- Content.Server/Mood/MoodSystem.cs | 6 ++++-- Content.Shared/CCVar/CCVars.cs | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/Mood/MoodSystem.cs b/Content.Server/Mood/MoodSystem.cs index 7e4789bf14f..0e287adccee 100644 --- a/Content.Server/Mood/MoodSystem.cs +++ b/Content.Server/Mood/MoodSystem.cs @@ -250,7 +250,8 @@ private void OnInit(EntityUid uid, MoodComponent component, ComponentStartup arg if (_debugMode) return; - if (TryComp(uid, out var mobThresholdsComponent) + if (_config.GetCVar(CCVars.MoodModifiesThresholds) + && TryComp(uid, out var mobThresholdsComponent) && _mobThreshold.TryGetThresholdForState(uid, MobState.Critical, out var critThreshold, mobThresholdsComponent)) component.CritThresholdBeforeModify = critThreshold.Value; @@ -343,7 +344,8 @@ private void RefreshShaders(EntityUid uid, int modifier) private void SetCritThreshold(EntityUid uid, MoodComponent component, int modifier) { - if (!TryComp(uid, out var mobThresholds) + if (!_config.GetCVar(CCVars.MoodModifiesThresholds) + || !TryComp(uid, out var mobThresholds) || !_mobThreshold.TryGetThresholdForState(uid, MobState.Critical, out var key)) return; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 0ef1aed2563..c64310fd7ec 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -2446,7 +2446,7 @@ public static readonly CVarDef #region Mood System public static readonly CVarDef MoodEnabled = - CVarDef.Create("mood.enabled", false, CVar.SERVER); + CVarDef.Create("mood.enabled", true, CVar.SERVER); public static readonly CVarDef MoodIncreasesSpeed = CVarDef.Create("mood.increases_speed", true, CVar.SERVER); @@ -2454,6 +2454,9 @@ public static readonly CVarDef public static readonly CVarDef MoodDecreasesSpeed = CVarDef.Create("mood.decreases_speed", true, CVar.SERVER); + public static readonly CVarDef MoodModifiesThresholds = + CVarDef.Create("mood.modify_thresholds", false, CVar.SERVER); + #endregion #region Material Reclaimer