CatStation/Content.Client/Nutrition/EntitySystems/InfantSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

36 lines
1.1 KiB
C#

using Content.Shared.Nutrition.AnimalHusbandry;
using Robust.Client.GameObjects;
namespace Content.Client.Nutrition.EntitySystems;
/// <summary>
/// This handles visuals for <see cref="InfantComponent"/>
/// </summary>
public sealed partial class InfantSystem : EntitySystem
{
[Dependency] private SpriteSystem _sprite = default!;
/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<InfantComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<InfantComponent, ComponentShutdown>(OnShutdown);
}
private void OnStartup(EntityUid uid, InfantComponent component, ComponentStartup args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
component.DefaultScale = sprite.Scale;
_sprite.SetScale((uid, sprite), component.VisualScale);
}
private void OnShutdown(EntityUid uid, InfantComponent component, ComponentShutdown args)
{
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
_sprite.SetScale((uid, sprite), component.DefaultScale);
}
}