* V1 commit * Remove PDA name and unnecessary pda state * Adds PDA to Chameleon backpack & thief toolbox * Change to use AppearanceDataInit * Add basic PDA state to ensure there's always a sprite before AppearanceData can be applied * Revert PDA name (this will be changed to another way later) * Update PDA name updating to new system * Fix yaml, and fix Agent ID chameleon * Updated based on review
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
using Content.Shared.Light;
|
|
using Content.Shared.PDA;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.PDA;
|
|
|
|
public sealed class PdaVisualizerSystem : VisualizerSystem<PdaVisualsComponent>
|
|
{
|
|
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))
|
|
args.Sprite.LayerSetState(PdaVisualLayers.Base, pdaType);
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
|
|
args.Sprite.LayerSetVisible(PdaVisualLayers.Flashlight, isFlashlightOn);
|
|
|
|
if (AppearanceSystem.TryGetData<bool>(uid, PdaVisuals.IdCardInserted, out var isCardInserted, args.Component))
|
|
args.Sprite.LayerSetVisible(PdaVisualLayers.IdLight, isCardInserted);
|
|
}
|
|
|
|
public enum PdaVisualLayers : byte
|
|
{
|
|
Base,
|
|
Flashlight,
|
|
IdLight
|
|
}
|
|
}
|