Remove server-side sprite references from chem master (#15888)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Leon Friedrich
2023-04-29 21:27:14 +12:00
committed by GitHub
parent 83c9e2bb50
commit a372daadb2
4 changed files with 45 additions and 2 deletions

View 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}");
}
}