Resolves PDAVisualizer is Obsolete (#13896)
This commit is contained in:
@@ -1,10 +1,34 @@
|
||||
using Content.Shared.PDA;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Shared.Light;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.PDA
|
||||
namespace Content.Client.PDA;
|
||||
|
||||
public sealed class PDASystem : SharedPDASystem
|
||||
{
|
||||
public sealed class PDASystem : SharedPDASystem
|
||||
public override void Initialize()
|
||||
{
|
||||
// Nothing here. Have a lovely day.
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PDAComponent, AppearanceChangeEvent>(OnAppearanceChange);
|
||||
}
|
||||
|
||||
private void OnAppearanceChange(EntityUid uid, PDAComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
args.Sprite.LayerSetState(PDAVisualLayers.Base, component.State);
|
||||
if (_appearance.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
|
||||
args.Sprite.LayerSetVisible(PDAVisualLayers.Flashlight, isFlashlightOn);
|
||||
|
||||
if (_appearance.TryGetData<bool>(uid, PDAVisuals.IDCardInserted, out var isCardInserted, args.Component))
|
||||
args.Sprite.LayerSetVisible(PDAVisualLayers.IDLight, isCardInserted);
|
||||
}
|
||||
}
|
||||
|
||||
enum PDAVisualLayers : byte
|
||||
{
|
||||
Base,
|
||||
Flashlight,
|
||||
IDLight
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user