]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix(BatterySelfRecharger): Fully charge BatterySelfRechargers (#30627)
authorBrandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
Tue, 24 Sep 2024 21:37:45 +0000 (21:37 +0000)
committerGitHub <noreply@github.com>
Tue, 24 Sep 2024 21:37:45 +0000 (23:37 +0200)
Content.Server/Power/EntitySystems/BatterySystem.cs

index 0a0f2068b58e82c70b77c888bf973c4a561dac9c..ed2d54ffaa60f0aa3432809050324d630481ab71 100644 (file)
@@ -84,7 +84,6 @@ namespace Content.Server.Power.EntitySystems
             while (query.MoveNext(out var uid, out var comp, out var batt))
             {
                 if (!comp.AutoRecharge) continue;
-                if (batt.IsFullyCharged) continue;
                 SetCharge(uid, batt.CurrentCharge + comp.AutoRechargeRate * frameTime, batt);
             }
         }
@@ -138,7 +137,8 @@ namespace Content.Server.Power.EntitySystems
 
             var old = battery.CurrentCharge;
             battery.CurrentCharge = MathHelper.Clamp(value, 0, battery.MaxCharge);
-            if (MathHelper.CloseTo(battery.CurrentCharge, old))
+            if (MathHelper.CloseTo(battery.CurrentCharge, old) &&
+                !(old != battery.CurrentCharge && battery.CurrentCharge == battery.MaxCharge))
                 return;
 
             var ev = new ChargeChangedEvent(battery.CurrentCharge, battery.MaxCharge);