2021-06-19 13:25:05 +02:00
|
|
|
|
using Content.Shared.Atmos.Components;
|
2020-12-08 11:56:10 +01:00
|
|
|
|
using JetBrains.Annotations;
|
2020-09-21 11:39:17 +02:00
|
|
|
|
using Robust.Client.GameObjects;
|
2021-11-22 23:22:59 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-05 18:09:01 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-09-21 11:39:17 +02:00
|
|
|
|
|
2021-06-19 13:25:05 +02:00
|
|
|
|
namespace Content.Client.Atmos.Visualizers
|
2020-09-21 11:39:17 +02:00
|
|
|
|
{
|
2020-12-08 11:56:10 +01:00
|
|
|
|
[UsedImplicitly]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class GasAnalyzerVisualizer : AppearanceVisualizer
|
2020-09-21 11:39:17 +02:00
|
|
|
|
{
|
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);
|
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
|
var entities = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
if (!entities.TryGetComponent(component.Owner, 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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|