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
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
state: icon
|
||||
layers:
|
||||
- state: icon
|
||||
map: ["enum.DrinkCanVisualLayers.Icon"]
|
||||
map: ["drinkCanIcon"]
|
||||
netsync: false
|
||||
- type: FitsInDispenser
|
||||
solution: drink
|
||||
@@ -36,10 +36,12 @@
|
||||
- type: DrainableSolution
|
||||
solution: drink
|
||||
- type: Appearance
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
- type: DrinkCanVisualizer
|
||||
stateClosed: icon
|
||||
stateOpen: icon_open
|
||||
enum.DrinkCanStateVisual.Opened:
|
||||
drinkCanIcon:
|
||||
True: {state: "icon_open"}
|
||||
False: {state: "icon"}
|
||||
- type: Spillable
|
||||
solution: drink
|
||||
- type: ItemCooldown
|
||||
|
||||
Reference in New Issue
Block a user