CatStation/Content.Client/Nutrition/EntitySystems/ClientSatiationSystem.cs
ScarKy0 091180655d
Changeling Chemicals (#45239)
* initially works i think

* yeah

* pulled these numbers outta my ass

* text

* silly

* fixy fix

* fix

* This sure is a videogame

* init test fuck everything

* sprites

* fix dirty

* query

* another query

* craftable changeling sting

* remove todo

* \n

* doc
2026-08-19 19:25:16 +00:00

31 lines
1 KiB
C#

using Content.Shared.Alert.Components;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
namespace Content.Client.Nutrition.EntitySystems;
/// <inheritdoc/>
public sealed partial class ClientSatiationSystem : SatiationSystem
{
[Dependency] private EntityQuery<SatiationCounterAlertComponent> _counterQuery = default!;
[SubscribeLocalEvent]
private void OnGenericCounter(Entity<SatiationComponent> entity, ref GetGenericAlertCounterAmountEvent args)
{
if (args.Handled)
return;
// We use a seperate component to avoid having to resolve every single satiation type on an entity.
// Instead, we just have a component that specifies which one we're looking for.
if (!_counterQuery.TryComp(args.SpriteView, out var alert))
return;
if (!ProtoMan.Resolve(alert.SatiationType, out var satiation))
return;
if (GetValueOrNull(entity, satiation) is not { } amount)
return;
args.Amount = (int) amount;
}
}