2020-09-21 11:39:17 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.Atmos;
|
2020-12-08 11:56:10 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2020-09-21 11:39:17 +02:00
|
|
|
|
using Robust.Client.GameObjects;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-09-21 11:39:17 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.GameObjects.Components.Atmos
|
|
|
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
|
[UsedImplicitly]
|
2020-09-21 11:39:17 +02:00
|
|
|
|
public class GasAnalyzerVisualizer : AppearanceVisualizer
|
|
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataField("state_off")]
|
2021-03-10 14:48:29 +01:00
|
|
|
|
private string? _stateOff;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataField("state_working")]
|
2021-03-10 14:48:29 +01:00
|
|
|
|
private string? _stateWorking;
|
2020-09-21 11:39:17 +02:00
|
|
|
|
|
|
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
|
|
|
|
|
|
if (component.Deleted)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-03-10 14:48:29 +01:00
|
|
|
|
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite))
|
2020-09-21 11:39:17 +02:00
|
|
|
|
{
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|