Update CloseTo to CloseToPercent (#4708)
This commit is contained in:
@@ -175,7 +175,7 @@ namespace Content.Server.Power.Components
|
||||
}
|
||||
|
||||
var delta = netBat.CurrentReceiving - netBat.LoadingNetworkDemand;
|
||||
if (!MathHelper.CloseTo(delta, 0, 0.1f) && delta < 0)
|
||||
if (!MathHelper.CloseToPercent(delta, 0, 0.1f) && delta < 0)
|
||||
{
|
||||
return ApcExternalPowerState.Low;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Content.Server.Power.Components
|
||||
public override string Name => "ApcPowerReceiver";
|
||||
|
||||
[ViewVariables]
|
||||
public bool Powered => (MathHelper.CloseTo(NetworkLoad.ReceivingPower, Load) || !NeedsPower) && !PowerDisabled;
|
||||
public bool Powered => (MathHelper.CloseToPercent(NetworkLoad.ReceivingPower, Load) || !NeedsPower) && !PowerDisabled;
|
||||
|
||||
/// <summary>
|
||||
/// The max distance from a <see cref="ApcPowerProviderComponent"/> that this can receive power from.
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Power.Components
|
||||
/// <summary>
|
||||
/// True if the battery is fully charged.
|
||||
/// </summary>
|
||||
[ViewVariables] public bool IsFullyCharged => MathHelper.CloseTo(CurrentCharge, MaxCharge);
|
||||
[ViewVariables] public bool IsFullyCharged => MathHelper.CloseToPercent(CurrentCharge, MaxCharge);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("autoRecharge")] public bool AutoRecharge { get; set; }
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
var recv = apcReceiver.NetworkLoad.ReceivingPower;
|
||||
ref var last = ref apcReceiver.LastPowerReceived;
|
||||
|
||||
if (!MathHelper.CloseTo(recv, last))
|
||||
if (!MathHelper.CloseToPercent(recv, last))
|
||||
{
|
||||
last = recv;
|
||||
apcReceiver.ApcPowerChanged();
|
||||
@@ -200,7 +200,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
{
|
||||
var newRecv = consumer.NetworkLoad.ReceivingPower;
|
||||
ref var lastRecv = ref consumer.LastReceived;
|
||||
if (!MathHelper.CloseTo(lastRecv, newRecv))
|
||||
if (!MathHelper.CloseToPercent(lastRecv, newRecv))
|
||||
{
|
||||
lastRecv = newRecv;
|
||||
var msg = new PowerConsumerReceivedChanged(newRecv, consumer.DrawRate);
|
||||
|
||||
Reference in New Issue
Block a user