Health analyzer displays turns off when the battery dies (#16125)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -166,7 +166,6 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
|
||||
|
||||
return HasCharge(uid, battery.UseRate, cell, user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to use the <see cref="PowerCellDrawComponent.UseRate"/> for this entity.
|
||||
/// </summary>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,3 +24,8 @@ public enum PowerCellVisuals : byte
|
||||
{
|
||||
ChargeLevel
|
||||
}
|
||||
[Serializable, NetSerializable]
|
||||
public enum PowerCellSlotVisuals : byte
|
||||
{
|
||||
Enabled
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 622 B |
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user