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