Display current load and maximum capacity (#20181)

This commit is contained in:
daerSeebaer
2023-10-18 19:46:32 +02:00
committed by GitHub
parent badb601dd1
commit 8edd5257c4
7 changed files with 75 additions and 13 deletions

View File

@@ -126,11 +126,7 @@ public sealed class AmeNodeGroup : BaseNodeGroup
var safeFuelLimit = CoreCount * 2;
// Note the float conversions. The maths will completely fail if not done using floats.
// Oh, and don't ever stuff the result of this in an int. Seriously.
var floatFuel = (float) fuel;
var floatCores = (float) CoreCount;
var powerOutput = 20000f * floatFuel * floatFuel / floatCores;
var powerOutput = CalculatePower(fuel, CoreCount);
if (fuel <= safeFuelLimit)
return powerOutput;
@@ -177,6 +173,17 @@ public sealed class AmeNodeGroup : BaseNodeGroup
return powerOutput;
}
/// <summary>
/// Calculates the amount of power the AME can produce with the given settings
/// </summary>
public float CalculatePower(int fuel, int cores)
{
// Fuel is squared so more fuel vastly increases power and efficiency
// We divide by the number of cores so a larger AME is less efficient at the same fuel settings
// this results in all AMEs having the same efficiency at the same fuel-per-core setting
return 20000f * fuel * fuel / cores;
}
public int GetTotalStability()
{
if (CoreCount < 1)