mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* 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
31 lines
1 KiB
C#
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;
|
|
}
|
|
}
|