diff --git a/Content.Server/Power/EntitySystems/BatterySystem.cs b/Content.Server/Power/EntitySystems/BatterySystem.cs index 410aa30bba..7906682a8d 100644 --- a/Content.Server/Power/EntitySystems/BatterySystem.cs +++ b/Content.Server/Power/EntitySystems/BatterySystem.cs @@ -11,6 +11,7 @@ namespace Content.Server.Power.EntitySystems [UsedImplicitly] public sealed class BatterySystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _sharedAppearanceSystem = default!; public override void Initialize() { base.Initialize(); diff --git a/Content.Server/PowerCell/PowerCellSystem.cs b/Content.Server/PowerCell/PowerCellSystem.cs index 6574acfb89..6c6cd92d4c 100644 --- a/Content.Server/PowerCell/PowerCellSystem.cs +++ b/Content.Server/PowerCell/PowerCellSystem.cs @@ -166,7 +166,6 @@ public sealed class PowerCellSystem : SharedPowerCellSystem return HasCharge(uid, battery.UseRate, cell, user); } - /// /// Tries to use the for this entity. /// @@ -179,6 +178,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem if (TryUseCharge(uid, battery.UseRate, cell, user)) { + _sharedAppearanceSystem.SetData(uid, PowerCellSlotVisuals.Enabled, HasActivatableCharge(uid, battery, cell, user)); _activatable.CheckUsage(uid); return true; } @@ -243,6 +243,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem return false; } + _sharedAppearanceSystem.SetData(uid, PowerCellSlotVisuals.Enabled, battery.Charge > 0); return true; } diff --git a/Content.Shared/PowerCell/Components/PowerCellComponent.cs b/Content.Shared/PowerCell/Components/PowerCellComponent.cs index 27a0d2ef97..3f353c1352 100644 --- a/Content.Shared/PowerCell/Components/PowerCellComponent.cs +++ b/Content.Shared/PowerCell/Components/PowerCellComponent.cs @@ -24,3 +24,8 @@ public enum PowerCellVisuals : byte { ChargeLevel } +[Serializable, NetSerializable] +public enum PowerCellSlotVisuals : byte +{ + Enabled +} diff --git a/Content.Shared/PowerCell/SharedPowerCellSystem.cs b/Content.Shared/PowerCell/SharedPowerCellSystem.cs index 00a9895f88..5c18152a23 100644 --- a/Content.Shared/PowerCell/SharedPowerCellSystem.cs +++ b/Content.Shared/PowerCell/SharedPowerCellSystem.cs @@ -8,6 +8,7 @@ namespace Content.Shared.PowerCell; public abstract class SharedPowerCellSystem : EntitySystem { [Dependency] private readonly ItemSlotsSystem _itemSlots = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -48,7 +49,7 @@ public abstract class SharedPowerCellSystem : EntitySystem if (args.Container.ID != component.CellSlotId) return; - + _appearance.SetData(uid, PowerCellSlotVisuals.Enabled, true); RaiseLocalEvent(uid, new PowerCellChangedEvent(false), false); } @@ -56,7 +57,7 @@ public abstract class SharedPowerCellSystem : EntitySystem { if (args.Container.ID != component.CellSlotId) return; - + _appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false); RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false); } } diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml index 24a7108454..137b6118bf 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/healthanalyzer.yml @@ -9,7 +9,13 @@ - type: Sprite sprite: Objects/Specific/Medical/healthanalyzer.rsi netsync: false - state: analyzer + state: icon + layers: + - state: icon + - state: analyzer + shader: unshaded + visible: true + map: [ "enum.PowerDeviceVisualLayers.Powered" ] - type: PowerCellDraw drawRate: 0 useRate: 20 @@ -27,6 +33,13 @@ - type: Tag tags: - DiscreteHealthAnalyzer + - type: Appearance + - type: GenericVisualizer + visuals: + enum.PowerCellSlotVisuals.Enabled: + enum.PowerDeviceVisualLayers.Powered: + True: { visible: true } + False: { visible: false } - type: entity id: HandheldHealthAnalyzerEmpty @@ -36,4 +49,4 @@ - type: ItemSlots slots: cell_slot: - name: power-cell-slot-component-slot-name-default + name: power-cell-slot-component-slot-name-default diff --git a/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/analyzer.png b/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/analyzer.png index 3fbab3f112..539f8ff452 100644 Binary files a/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/analyzer.png and b/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/analyzer.png differ diff --git a/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/icon.png b/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/icon.png index 4517250a5a..776c3f4f6b 100644 Binary files a/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/icon.png and b/Resources/Textures/Objects/Specific/Medical/healthanalyzer.rsi/icon.png differ