Fix battery charging stopping just short of being full (#34028)
This commit is contained in:
@@ -87,8 +87,8 @@ namespace Content.Server.Power.EntitySystems
|
||||
var query = EntityQueryEnumerator<BatterySelfRechargerComponent, BatteryComponent>();
|
||||
while (query.MoveNext(out var uid, out var comp, out var batt))
|
||||
{
|
||||
if (!comp.AutoRecharge) continue;
|
||||
if (batt.IsFullyCharged) continue;
|
||||
if (!comp.AutoRecharge || IsFull(uid, batt))
|
||||
continue;
|
||||
|
||||
if (comp.AutoRechargePause)
|
||||
{
|
||||
@@ -212,14 +212,14 @@ namespace Content.Server.Power.EntitySystems
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the battery is at least 99% charged, basically full.
|
||||
/// Returns whether the battery is full.
|
||||
/// </summary>
|
||||
public bool IsFull(EntityUid uid, BatteryComponent? battery = null)
|
||||
{
|
||||
if (!Resolve(uid, ref battery))
|
||||
return false;
|
||||
|
||||
return battery.CurrentCharge / battery.MaxCharge >= 0.99f;
|
||||
return battery.CurrentCharge >= battery.MaxCharge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user