Files
tbd-station-14/Content.Client/GameObjects/Components/Atmos/GasAnalyzerVisualizer.cs
DrSmugleaf 902aa128c2 Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
2021-03-10 14:48:29 +01:00

45 lines
1.3 KiB
C#

using Content.Shared.GameObjects.Components.Atmos;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.GameObjects.Components.Atmos
{
[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.Deleted)
{
return;
}
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;
}
}
}
}
}