Resolves PDAVisualizer is Obsolete (#13896)

This commit is contained in:
TemporalOroboros
2023-02-05 10:34:54 -08:00
committed by GitHub
parent c398076620
commit b95f4f474b
5 changed files with 103 additions and 244 deletions

View File

@@ -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
}