Resolves PowerDeviceVisualizer is Obsolete (#13900)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
7
Content.Client/Power/Visualizers/PowerDeviceVisuals.cs
Normal file
7
Content.Client/Power/Visualizers/PowerDeviceVisuals.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Content.Client.Power;
|
||||
|
||||
/// Remains in use by portable scrubbers and lathes.
|
||||
public enum PowerDeviceVisualLayers : byte
|
||||
{
|
||||
Powered
|
||||
}
|
||||
@@ -72,8 +72,12 @@
|
||||
- key: enum.ResearchClientUiKey.Key
|
||||
type: ResearchClientBoundUserInterface
|
||||
- type: Appearance
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
- type: PowerDeviceVisualizer
|
||||
enum.PowerDeviceVisuals.Powered:
|
||||
enum.PowerDeviceVisualLayers.Powered:
|
||||
True: {visible: true}
|
||||
False: {visible: false}
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
|
||||
@@ -51,8 +51,12 @@
|
||||
powerLoad: 2000
|
||||
- type: ExtensionCableReceiver
|
||||
- type: Appearance
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
- type: PowerDeviceVisualizer
|
||||
enum.PowerDeviceVisuals.Powered:
|
||||
enum.PowerDeviceVisualLayers.Powered:
|
||||
True: {visible: true}
|
||||
False: {visible: false}
|
||||
- type: PortableScrubberVisuals
|
||||
idleState: icon
|
||||
runningState: icon-running
|
||||
|
||||
Reference in New Issue
Block a user