diff --git a/Content.Client/PDA/PDASystem.cs b/Content.Client/PDA/PDASystem.cs index 276f65a349..37834e0723 100644 --- a/Content.Client/PDA/PDASystem.cs +++ b/Content.Client/PDA/PDASystem.cs @@ -9,6 +9,7 @@ public sealed class PDASystem : SharedPDASystem public override void Initialize() { base.Initialize(); + SubscribeLocalEvent(OnAppearanceChange); } @@ -17,13 +18,26 @@ public sealed class PDASystem : SharedPDASystem if (args.Sprite == null) return; - args.Sprite.LayerSetState(PDAVisualLayers.Base, component.State); if (_appearance.TryGetData(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component)) args.Sprite.LayerSetVisible(PDAVisualLayers.Flashlight, isFlashlightOn); if (_appearance.TryGetData(uid, PDAVisuals.IDCardInserted, out var isCardInserted, args.Component)) args.Sprite.LayerSetVisible(PDAVisualLayers.IDLight, isCardInserted); } + + protected override void OnComponentInit(EntityUid uid, PDAComponent component, ComponentInit args) + { + base.OnComponentInit(uid, component, args); + + if(!TryComp(uid, out var sprite)) + return; + + if (component.State != null) + sprite.LayerSetState(PDAVisualLayers.Base, component.State); + + sprite.LayerSetVisible(PDAVisualLayers.Flashlight, component.FlashlightOn); + sprite.LayerSetVisible(PDAVisualLayers.IDLight, component.IdSlot.StartingItem != null); + } } enum PDAVisualLayers : byte diff --git a/Content.Shared/PDA/PDAComponent.cs b/Content.Shared/PDA/PDAComponent.cs index 4acbcf3582..1cc1832e85 100644 --- a/Content.Shared/PDA/PDAComponent.cs +++ b/Content.Shared/PDA/PDAComponent.cs @@ -1,11 +1,12 @@ using Content.Shared.Access.Components; using Content.Shared.Containers.ItemSlots; using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Shared.PDA { - [RegisterComponent] + [RegisterComponent, NetworkedComponent] public sealed class PDAComponent : Component { public const string PDAIdSlotId = "PDA-id"; diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml index e2881ef35d..272c96c171 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml @@ -8,9 +8,11 @@ - type: Appearance - type: Sprite sprite: Objects/Devices/pda.rsi + netsync: false layers: - map: [ "enum.PDAVisualLayers.Base" ] - - map: [ "enum.PDAVisualLayers.Flashlight" ] + - state: "light_overlay" + map: [ "enum.PDAVisualLayers.Flashlight" ] shader: "unshaded" visible: false - state: "id_overlay" @@ -417,7 +419,6 @@ state: pda-ce - type: PDABorderColor borderColor: "#949137" - state: pda-ce accentHColor: "#447987" - type: Icon state: pda-ce @@ -623,7 +624,6 @@ state: pda-ert - type: PDABorderColor borderColor: "#A32D26" - state: pda-ert accentHColor: "#447987" - type: Icon state: pda-ert