Resolves PowerDeviceVisualizer is Obsolete (#13900)

This commit is contained in:
TemporalOroboros
2023-04-22 02:37:40 -07:00
committed by GitHub
parent 485fee30f0
commit d78110bebd
4 changed files with 17 additions and 29 deletions

View File

@@ -1,27 +0,0 @@
using Content.Shared.Power;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Client.Power
{
[UsedImplicitly]
public sealed class PowerDeviceVisualizer : AppearanceVisualizer
{
[Obsolete("Subscribe to AppearanceChangeEvent instead.")]
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner);
var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar;
sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
}
}
public enum PowerDeviceVisualLayers : byte
{
Powered
}
}

View File

@@ -0,0 +1,7 @@
namespace Content.Client.Power;
/// Remains in use by portable scrubbers and lathes.
public enum PowerDeviceVisualLayers : byte
{
Powered
}

View File

@@ -72,8 +72,12 @@
- key: enum.ResearchClientUiKey.Key - key: enum.ResearchClientUiKey.Key
type: ResearchClientBoundUserInterface type: ResearchClientBoundUserInterface
- type: Appearance - type: Appearance
- type: GenericVisualizer
visuals: visuals:
- type: PowerDeviceVisualizer enum.PowerDeviceVisuals.Powered:
enum.PowerDeviceVisualLayers.Powered:
True: {visible: true}
False: {visible: false}
- type: Destructible - type: Destructible
thresholds: thresholds:
- trigger: - trigger:

View File

@@ -51,8 +51,12 @@
powerLoad: 2000 powerLoad: 2000
- type: ExtensionCableReceiver - type: ExtensionCableReceiver
- type: Appearance - type: Appearance
- type: GenericVisualizer
visuals: visuals:
- type: PowerDeviceVisualizer enum.PowerDeviceVisuals.Powered:
enum.PowerDeviceVisualLayers.Powered:
True: {visible: true}
False: {visible: false}
- type: PortableScrubberVisuals - type: PortableScrubberVisuals
idleState: icon idleState: icon
runningState: icon-running runningState: icon-running