Resolves DrinkCanVisualizer is Obsolete (#13895)
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Client.Nutrition.Visualizers
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class DrinkCanVisualizer : AppearanceVisualizer
|
||||
{
|
||||
[DataField("stateClosed")]
|
||||
private string? _stateClosed;
|
||||
|
||||
[DataField("stateOpen")]
|
||||
private string? _stateOpen;
|
||||
|
||||
[Obsolete("Subscribe to AppearanceChangeEvent instead.")]
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.TryGetData<bool>(DrinkCanStateVisual.Opened, out var opened) && opened)
|
||||
{
|
||||
sprite.LayerSetState(DrinkCanVisualLayers.Icon, $"{_stateOpen}");
|
||||
return;
|
||||
}
|
||||
|
||||
sprite.LayerSetState(DrinkCanVisualLayers.Icon, $"{_stateClosed}");
|
||||
}
|
||||
}
|
||||
|
||||
public enum DrinkCanVisualLayers : byte
|
||||
{
|
||||
Icon = 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user