2025-01-02 19:23:28 +01:00
|
|
|
using Content.Shared.Light;
|
|
|
|
|
using Content.Shared.PDA;
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.PDA;
|
|
|
|
|
|
|
|
|
|
public sealed class PdaVisualizerSystem : VisualizerSystem<PdaVisualsComponent>
|
|
|
|
|
{
|
2025-05-16 23:29:03 -04:00
|
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
2025-01-02 19:23:28 +01:00
|
|
|
protected override void OnAppearanceChange(EntityUid uid, PdaVisualsComponent comp, ref AppearanceChangeEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Sprite == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, PdaVisuals.PdaType, out var pdaType, args.Component))
|
2025-05-16 23:29:03 -04:00
|
|
|
_sprite.LayerSetRsiState((uid, args.Sprite), PdaVisualLayers.Base, pdaType);
|
2025-01-02 19:23:28 +01:00
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
|
2025-05-16 23:29:03 -04:00
|
|
|
_sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.Flashlight, isFlashlightOn);
|
2025-01-02 19:23:28 +01:00
|
|
|
|
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, PdaVisuals.IdCardInserted, out var isCardInserted, args.Component))
|
2025-05-16 23:29:03 -04:00
|
|
|
_sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.IdLight, isCardInserted);
|
2025-01-02 19:23:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum PdaVisualLayers : byte
|
|
|
|
|
{
|
|
|
|
|
Base,
|
|
|
|
|
Flashlight,
|
|
|
|
|
IdLight
|
|
|
|
|
}
|
|
|
|
|
}
|