Files
tbd-station-14/Content.Client/Atmos/Visualizers/GasAnalyzerVisualizer.cs
Leon Friedrich 339982d05b fix lantern visualizer animation error (#4800)
* fix lantern-visualizer

* remove deleted check

* Remove other component.Deleted checks
2021-10-20 18:45:46 -07:00

40 lines
1.2 KiB
C#

using Content.Shared.Atmos.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.Atmos.Visualizers
{
[UsedImplicitly]
public class GasAnalyzerVisualizer : AppearanceVisualizer
{
[DataField("state_off")]
private string? _stateOff;
[DataField("state_working")]
private string? _stateWorking;
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
{
return;
}
if (component.TryGetData(GasAnalyzerVisuals.VisualState, out GasAnalyzerVisualState visualState))
{
switch (visualState)
{
case GasAnalyzerVisualState.Off:
sprite.LayerSetState(0, _stateOff);
break;
case GasAnalyzerVisualState.Working:
sprite.LayerSetState(0, _stateWorking);
break;
}
}
}
}
}