mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* 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
26 lines
774 B
C#
26 lines
774 B
C#
using Content.Shared.Chemistry.Components;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Chemistry.EntitySystems;
|
|
|
|
public sealed partial class PillSystem : EntitySystem
|
|
{
|
|
[Dependency] private SpriteSystem _sprite = default!;
|
|
|
|
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((uid, sprite), 0, out var layer, false))
|
|
return;
|
|
|
|
_sprite.LayerSetRsiState(layer, $"pill{component.PillType + 1}");
|
|
}
|
|
}
|