Remove server-side sprite references from chem master (#15888)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
24
Content.Client/Chemistry/EntitySystems/PillSystem.cs
Normal file
24
Content.Client/Chemistry/EntitySystems/PillSystem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user