]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix power cell exceptions with health analyzers (#15753)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Tue, 25 Apr 2023 01:11:03 +0000 (21:11 -0400)
committerGitHub <noreply@github.com>
Tue, 25 Apr 2023 01:11:03 +0000 (11:11 +1000)
Content.Server/PowerCell/PowerCellSystem.cs

index c6112c73553243d051ec5061183b735fb434b8f3..4b0f322c940a0be00af47fee24fd5e0b5c8d172d 100644 (file)
@@ -224,7 +224,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
     /// </summary>
     public bool TryUseCharge(EntityUid uid, float charge, PowerCellSlotComponent? component = null, EntityUid? user = null)
     {
-        if (!TryGetBatteryFromSlot(uid, out var battery, component))
+        if (!TryGetBatteryFromSlot(uid, out var batteryEnt, out var battery, component))
         {
             if (user != null)
                 _popup.PopupEntity(Loc.GetString("power-cell-no-battery"), uid, user.Value);
@@ -232,7 +232,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
             return false;
         }
 
-        if (!_battery.TryUseCharge(uid, charge, battery))
+        if (!_battery.TryUseCharge(batteryEnt.Value, charge, battery))
         {
             if (user != null)
                 _popup.PopupEntity(Loc.GetString("power-cell-insufficient"), uid, user.Value);