Use AllEntityQuery<> In power systems (#15336)

This commit is contained in:
Leon Friedrich
2023-04-15 07:45:02 +12:00
committed by GitHub
parent 9b8b844386
commit 5b09ee3102
3 changed files with 31 additions and 15 deletions

View File

@@ -33,7 +33,7 @@ namespace Content.Server.Power.Pow3r
foreach (var group in state.GroupedNets)
{
// Note that many net-layers only have a handful of networks.
// E.g., the number of nets from lowest to heights for box and saltern are:
// E.g., the number of nets from lowest to highest for box and saltern are:
// Saltern: 1477, 11, 2, 2, 3.
// Box: 3308, 20, 1, 5.
//
@@ -164,7 +164,7 @@ namespace Content.Server.Power.Pow3r
battery.AvailableSupply = Math.Min(scaledSpace, supplyAndPassthrough);
battery.LoadingNetworkDemand = unmet;
battery.MaxEffectiveSupply = Math.Min(battery.CurrentStorage / frameTime, battery.MaxSupply + battery.CurrentReceiving * battery.Efficiency);
battery.MaxEffectiveSupply = Math.Min(battery.CurrentStorage / frameTime, battery.MaxSupply + battery.CurrentReceiving * battery.Efficiency);
totalBatterySupply += battery.AvailableSupply;
totalMaxBatterySupply += battery.MaxEffectiveSupply;
}
@@ -174,7 +174,7 @@ namespace Content.Server.Power.Pow3r
network.LastCombinedMaxSupply = totalMaxSupply + totalMaxBatterySupply;
var met = Math.Min(demand, network.LastCombinedSupply);
if (met == 0)
if (met == 0)
return;
var supplyRatio = met / demand;
@@ -228,7 +228,7 @@ namespace Content.Server.Power.Pow3r
supply.SupplyRampTarget = supply.MaxSupply * targetRelativeSupplyOutput;
}
}
if (unmet <= 0 || totalBatterySupply <= 0)
return;