From 0703415a7bb0728187629eafdc59d3b27b050afb Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Thu, 16 Nov 2023 00:14:02 -0800 Subject: [PATCH] Remove usages of obsolete methods in ChargeBatteryArtifactSystem (#21664) * Remove usages of obsolete methods in ChargeBatteryArtifactSystem * Fix _maxCharge --- .../Effects/Systems/ChargeBatteryArtifactSystem.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ChargeBatteryArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ChargeBatteryArtifactSystem.cs index 3569a30c36..778c672729 100644 --- a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ChargeBatteryArtifactSystem.cs +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/ChargeBatteryArtifactSystem.cs @@ -1,6 +1,8 @@ using Content.Server.Power.Components; +using Content.Server.Power.EntitySystems; using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; using Content.Server.Xenoarchaeology.XenoArtifacts.Events; +using Robust.Server.GameObjects; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; @@ -9,7 +11,10 @@ namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; /// public sealed class ChargeBatteryArtifactSystem : EntitySystem { + [Dependency] private readonly BatterySystem _battery = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; + [Dependency] private readonly TransformSystem _transform = default!; + /// public override void Initialize() { @@ -18,9 +23,9 @@ public sealed class ChargeBatteryArtifactSystem : EntitySystem private void OnActivated(EntityUid uid, ChargeBatteryArtifactComponent component, ArtifactActivatedEvent args) { - foreach (var battery in _lookup.GetComponentsInRange(Transform(uid).MapPosition, component.Radius)) + foreach (var battery in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates(uid), component.Radius)) { - battery.CurrentCharge = battery.MaxCharge; + _battery.SetCharge(battery, battery.Comp.MaxCharge, battery); } } } -- 2.51.2