mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
# Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 sleepyyapril, Stop-Signs, Memeji - add: Changed the Warden suit's capabilities. (Original author: Stop-Signs) - add: Repeater, Argenti, and 45 magnum rubber box to Bartender's loadout. - add: Red cloak to loadout (Port from Floof PR #390) - add: Witch Robes to loadout (Port from Floof PR #390) - add: Sawed-off PKA (Port from Floof PR #390) - add: The ChemMaster now has 20, 75, and 80 unit options available. - tweak: Made the ChemMaster wider. - fix: Ported Frontier fix to mag visuals on specific guns. - fix: Fixed heirlooms flickering negative mood when the moodlet ended. --------- Signed-off-by: Stop-Signs <stopsign221@gmail.com> Signed-off-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> Co-authored-by: Stop-Signs <stopsign221@gmail.com> Co-authored-by: FoxxoTrystan <45297731+FoxxoTrystan@users.noreply.github.com> Co-authored-by: Radezolid <snappednexus@gmail.com> Co-authored-by: ErhardSteinhauer <65374927+ErhardSteinhauer@users.noreply.github.com> Co-authored-by: VMSolidus <evilexecutive@gmail.com> (cherry picked from commit a9f7fe8e9a337d13ef34ec643064432d0cec2b60)
60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System.Linq;
|
|
using Content.Shared.Mood;
|
|
using Content.Shared.Traits.Assorted.Components;
|
|
using Robust.Shared.Timing;
|
|
|
|
|
|
namespace Content.Server.Traits.Assorted;
|
|
|
|
public sealed class HeirloomSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
|
|
private const long HeirloomRepeatDuration = 60;
|
|
private TimeSpan _nextUpdate;
|
|
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
_nextUpdate = _gameTiming.CurTime;
|
|
}
|
|
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
if (_nextUpdate > _gameTiming.CurTime)
|
|
return;
|
|
|
|
var query = EntityManager.EntityQueryEnumerator<HeirloomHaverComponent>();
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
var children = RecursiveGetAllChildren(uid);
|
|
var moodlet = comp.Moodlet;
|
|
|
|
if (children.Any(c => c != comp.Heirloom))
|
|
continue;
|
|
|
|
var ev = new MoodEffectEvent(moodlet);
|
|
RaiseLocalEvent(uid, ev);
|
|
}
|
|
|
|
query.Dispose();
|
|
_nextUpdate = _gameTiming.CurTime + TimeSpan.FromSeconds(HeirloomRepeatDuration);
|
|
}
|
|
|
|
private IEnumerable<EntityUid> RecursiveGetAllChildren(EntityUid uid)
|
|
{
|
|
var xform = Transform(uid);
|
|
var children = xform.ChildEnumerator;
|
|
while (children.MoveNext(out var child))
|
|
{
|
|
yield return child;
|
|
foreach (var c in RecursiveGetAllChildren(child))
|
|
yield return c;
|
|
}
|
|
}
|
|
}
|