Remove all obsolete BatteryComponent method calls (#25871)

Removed all obsolete, non-ECS method calls to BatteryComponent
This commit is contained in:
Tayrtahn
2024-03-06 00:34:50 -05:00
committed by GitHub
parent 4228305b12
commit 2935e5bd78
12 changed files with 44 additions and 57 deletions

View File

@@ -17,6 +17,7 @@ internal sealed class ChargerSystem : EntitySystem
{
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly BatterySystem _battery = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize()
@@ -201,11 +202,11 @@ internal sealed class ChargerSystem : EntitySystem
if (!SearchForBattery(targetEntity, out var heldBattery))
return;
heldBattery.CurrentCharge += component.ChargeRate * frameTime;
_battery.SetCharge(targetEntity, heldBattery.CurrentCharge + component.ChargeRate * frameTime, heldBattery);
// Just so the sprite won't be set to 99.99999% visibility
if (heldBattery.MaxCharge - heldBattery.CurrentCharge < 0.01)
{
heldBattery.CurrentCharge = heldBattery.MaxCharge;
_battery.SetCharge(targetEntity, heldBattery.MaxCharge, heldBattery);
}
UpdateStatus(uid, component);