[UsedImplicitly]
public sealed class BatterySystem : EntitySystem
{
+ [Dependency] private readonly SharedAppearanceSystem _sharedAppearanceSystem = default!;
public override void Initialize()
{
base.Initialize();
return HasCharge(uid, battery.UseRate, cell, user);
}
-
/// <summary>
/// Tries to use the <see cref="PowerCellDrawComponent.UseRate"/> for this entity.
/// </summary>
if (TryUseCharge(uid, battery.UseRate, cell, user))
{
+ _sharedAppearanceSystem.SetData(uid, PowerCellSlotVisuals.Enabled, HasActivatableCharge(uid, battery, cell, user));
_activatable.CheckUsage(uid);
return true;
}
return false;
}
+ _sharedAppearanceSystem.SetData(uid, PowerCellSlotVisuals.Enabled, battery.Charge > 0);
return true;
}
{
ChargeLevel
}
+[Serializable, NetSerializable]
+public enum PowerCellSlotVisuals : byte
+{
+ Enabled
+}
public abstract class SharedPowerCellSystem : EntitySystem
{
[Dependency] private readonly ItemSlotsSystem _itemSlots = default!;
+ [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize()
{
if (args.Container.ID != component.CellSlotId)
return;
-
+ _appearance.SetData(uid, PowerCellSlotVisuals.Enabled, true);
RaiseLocalEvent(uid, new PowerCellChangedEvent(false), false);
}
{
if (args.Container.ID != component.CellSlotId)
return;
-
+ _appearance.SetData(uid, PowerCellSlotVisuals.Enabled, false);
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
}
}
- 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
- 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
- type: ItemSlots
slots:
cell_slot:
- name: power-cell-slot-component-slot-name-default
+ name: power-cell-slot-component-slot-name-default