Files
tbd-station-14/Content.Client/Chemistry/EntitySystems/PillSystem.cs
2023-04-29 19:27:14 +10:00

25 lines
667 B
C#

using Content.Shared.Chemistry.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Chemistry.EntitySystems;
public sealed class PillSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PillComponent, AfterAutoHandleStateEvent>(OnHandleState);
}
private void OnHandleState(EntityUid uid, PillComponent component, ref AfterAutoHandleStateEvent args)
{
if (!TryComp(uid, out SpriteComponent? sprite))
return;
if (!sprite.TryGetLayer(0, out var layer))
return;
layer.SetState($"pill{component.PillType + 1}");
}
}