CatStation/Content.Shared/Nutrition/EntitySystems/SatiationGrantSystem.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

32 lines
915 B
C#

using Content.Shared.Nutrition.Components;
namespace Content.Shared.Nutrition.EntitySystems;
/// <summary>
/// <see cref="SatiationGrantComponent"/>
/// </summary>
public sealed partial class SatiationGrantSystem : EntitySystem
{
[Dependency] private SatiationSystem _satiation = default!;
[SubscribeLocalEvent]
private void OnMapInit(Entity<SatiationGrantComponent> ent, ref MapInitEvent args)
{
foreach (var satiation in ent.Comp.Satiation)
{
_satiation.AddSatiation(ent.Owner, satiation.Key, satiation.Value);
}
}
[SubscribeLocalEvent]
private void OnShutdown(Entity<SatiationGrantComponent> ent, ref ComponentShutdown args)
{
if (!ent.Comp.RemoveOnShutdown)
return;
foreach (var satiation in ent.Comp.Satiation)
{
_satiation.RemoveSatiationType(ent.Owner, satiation.Key);
}
}
}