Fix IDE0032

This commit is contained in:
RoosterDragon
2024-11-13 18:02:09 +00:00
committed by Pavel Penev
parent 9809f6ed08
commit ed90322a0b
4 changed files with 40 additions and 53 deletions

View File

@@ -42,16 +42,12 @@ namespace OpenRA.Mods.Common.Traits
readonly Dictionary<Actor, int> powerDrain = new();
[Sync]
int totalProvided;
public int PowerProvided => totalProvided;
public int PowerProvided { get; private set; }
[Sync]
int totalDrained;
public int PowerDrained { get; private set; }
public int PowerDrained => totalDrained;
public int ExcessPower => totalProvided - totalDrained;
public int ExcessPower => PowerProvided - PowerDrained;
public int PowerOutageRemainingTicks { get; private set; }
public int PowerOutageTotalTicks { get; private set; }
@@ -96,14 +92,14 @@ namespace OpenRA.Mods.Common.Traits
return;
if (old > 0)
totalProvided -= old;
PowerProvided -= old;
else if (old < 0)
totalDrained += old;
PowerDrained += old;
if (amount > 0)
totalProvided += amount;
PowerProvided += amount;
else if (amount < 0)
totalDrained -= amount;
PowerDrained -= amount;
UpdatePowerState();
}
@@ -122,9 +118,9 @@ namespace OpenRA.Mods.Common.Traits
return;
if (amount > 0)
totalProvided -= amount;
PowerProvided -= amount;
else if (amount < 0)
totalDrained += amount;
PowerDrained += amount;
UpdatePowerState();
}
@@ -147,17 +143,17 @@ namespace OpenRA.Mods.Common.Traits
{
if (wasHackEnabled != devMode.UnlimitedPower)
{
totalProvided = 0;
totalDrained = 0;
PowerProvided = 0;
PowerDrained = 0;
if (!devMode.UnlimitedPower)
{
foreach (var kv in powerDrain)
{
if (kv.Value > 0)
totalProvided += kv.Value;
PowerProvided += kv.Value;
else if (kv.Value < 0)
totalDrained -= kv.Value;
PowerDrained -= kv.Value;
}
}