fix(BatterySelfRecharger): Fully charge BatterySelfRechargers (#30627)

This commit is contained in:
Brandon Hu
2024-09-24 21:37:45 +00:00
committed by GitHub
parent 89dbef7461
commit 95a159f950

View 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);