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

@@ -1,4 +1,5 @@
using Content.Server.Popups;
using Content.Server.Power.EntitySystems;
using Content.Server.PowerCell;
using Content.Server.Radio.Components;
using Content.Shared.Examine;
@@ -10,6 +11,7 @@ namespace Content.Server.Radio.EntitySystems;
public sealed class JammerSystem : EntitySystem
{
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly BatterySystem _battery = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
@@ -29,7 +31,7 @@ public sealed class JammerSystem : EntitySystem
while (query.MoveNext(out var uid, out var _, out var jam))
{
if (_powerCell.TryGetBatteryFromSlot(uid, out var battery) &&
!battery.TryUseCharge(jam.Wattage * frameTime))
!_battery.TryUseCharge(uid, jam.Wattage * frameTime, battery))
{
RemComp<ActiveRadioJammerComponent>(uid);
}
@@ -38,7 +40,7 @@ public sealed class JammerSystem : EntitySystem
private void OnActivate(EntityUid uid, RadioJammerComponent comp, ActivateInWorldEvent args)
{
var activated = !HasComp<ActiveRadioJammerComponent>(uid) &&
var activated = !HasComp<ActiveRadioJammerComponent>(uid) &&
_powerCell.TryGetBatteryFromSlot(uid, out var battery) &&
battery.CurrentCharge > comp.Wattage;
if (activated)