Bonk power allocations (#2392)
linq bad. Last one on my hit list is PVS but that needs a full rewrite. Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -94,8 +94,10 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
totalCharge += battery.CurrentCharge;
|
||||
totalMaxCharge += battery.MaxCharge;
|
||||
}
|
||||
var availablePowerFraction = totalCharge / totalMaxCharge;
|
||||
foreach (var receiver in _providerReceivers.SelectMany(kvp => kvp.Value))
|
||||
|
||||
foreach (var (_, receivers) in _providerReceivers)
|
||||
{
|
||||
foreach (var receiver in receivers)
|
||||
{
|
||||
if (!receiver.NeedsPower || receiver.PowerDisabled)
|
||||
continue;
|
||||
@@ -103,6 +105,7 @@ namespace Content.Server.GameObjects.Components.NodeContainer.NodeGroups
|
||||
receiver.HasApcPower = TryUsePower(receiver.Load * frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryUsePower(float neededCharge)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user