fish-station/Content.Client/Overlays/ShowHungerIconsSystem.cs
iertis d5ec9f0e5b
Фиксы апстрима (#2778)
Co-authored-by: Vigers Ray <vigersray@gmail.com>
2025-08-15 12:45:53 +03:00

32 lines
988 B
C#

using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Overlays;
using Content.Shared.Standing;
using Content.Shared.StatusIcon.Components;
namespace Content.Client.Overlays;
public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsComponent>
{
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HungerComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}
private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent component, ref GetStatusIconsEvent ev)
{
if (!IsActive)
return;
if (!_standing.IsDown(uid))
return;
if (_hunger.TryGetStatusIconPrototype(component, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
}
}