Files
tbd-station-14/Content.Client/Construction/MachineFrameVisualizer.cs
Vera Aguilera Puerto b835bea086 Inline GetComponent
2021-12-03 11:55:25 +01:00

25 lines
721 B
C#

using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Construction
{
[UsedImplicitly]
public class MachineFrameVisualizer : AppearanceVisualizer
{
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (component.TryGetData<int>(MachineFrameVisuals.State, out var data))
{
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
sprite.LayerSetState(0, $"box_{data}");
}
}
}
}