2021-06-19 13:25:05 +02:00
|
|
|
|
using Content.Shared.Atmos.Visuals;
|
2021-03-31 12:41:23 -07:00
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
|
|
2021-06-19 13:25:05 +02:00
|
|
|
|
namespace Content.Client.Atmos.Visualizers
|
2021-03-31 12:41:23 -07:00
|
|
|
|
{
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
|
public class AtmosPlaqueVisualizer : AppearanceVisualizer
|
|
|
|
|
|
{
|
2021-05-04 15:37:16 +02:00
|
|
|
|
[DataField("layer")]
|
2021-03-31 12:41:23 -07:00
|
|
|
|
private int Layer { get; }
|
|
|
|
|
|
|
|
|
|
|
|
public override void InitializeEntity(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.InitializeEntity(entity);
|
|
|
|
|
|
|
|
|
|
|
|
entity.GetComponentOrNull<SpriteComponent>()?.LayerMapReserveBlank(Layer);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
|
|
|
|
|
|
if (!component.Owner.TryGetComponent(out SpriteComponent? sprite))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!component.TryGetData(AtmosPlaqueVisuals.State, out string state))
|
|
|
|
|
|
{
|
|
|
|
|
|
sprite.LayerSetState(Layer, state);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|