Skip to content

Commit

Permalink
Fix heirloom flickering bad moods.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyyapril committed Jan 14, 2025
1 parent cd4e99b commit 897ef63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Content.Server/Traits/Assorted/HeirloomSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ public override void Update(float frameTime)
while (query.MoveNext(out var uid, out var comp))
{
var children = RecursiveGetAllChildren(uid);
if (!children.Any(c => c == comp.Heirloom))
continue;
var ev = new MoodEffectEvent(comp.Moodlet);
var moodlet = comp.Moodlet;

if (children.Any(c => c != comp.Heirloom))
moodlet = "HeirloomLost";

var ev = new MoodEffectEvent(moodlet);
RaiseLocalEvent(uid, ev);
}

query.Dispose();

_nextUpdate = _gameTiming.CurTime + TimeSpan.FromSeconds(10);
_nextUpdate = _gameTiming.CurTime + TimeSpan.FromSeconds(30);
}

private IEnumerable<EntityUid> RecursiveGetAllChildren(EntityUid uid)
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/Mood/genericNegativeEffects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@
id: HeirloomLost
moodChange: -15
category: Heirloom

- type: moodEffect
id: HeirloomNeutral
moodChange: -5
category: Heirloom
2 changes: 1 addition & 1 deletion Resources/Prototypes/Mood/genericPositiveEffects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
category: Heirloom
moodChange: 5
timeout: 60 # A bit of time before they realize it's gone
moodletOnEnd: HeirloomLost
moodletOnEnd: HeirloomNeutral

0 comments on commit 897ef63

Please sign in to comment.