MyGasGenerator PowerConsumption

slimeradio shared this bug 5 years ago
Not a Bug

Gas generator power consumption doesn't depend on how much gas it produces.

Here is a small code rework, that will make it.

private static float ComputeRequiredPower(MyGasGenerator generator) {
    if (!generator.Enabled || !generator.IsFunctional) { return 0f; }
    var def = (MyOxygenGeneratorDefinition) generator.BlockDefinition;
    if (!MySession.Static.Settings.EnableOxygen && def.ProducedGases.TrueForAll(info => info.Id == generator.m_oxygenGasId)) { return 0f; }
    
    float max = 0;
    foreach (var gas in def.ProducedGases) {
        var output = generator.SourceComp.CurrentOutputByType(gas.Id);
        var maxOutput = generator.SourceComp.MaxOutputByType(gas.Id);
        var current = output / maxOutput;
        if (current > max) {
            max = current;
        }
    }
    return MathHelper.Lerp(def.StandbyPowerConsumption, def.OperationalPowerConsumption, max) * (generator as IMyGasGenerator).PowerConsumptionMultiplier;
}

Replies (2)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.

Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department

photo
1

Hello Engineer!

Thank you for your feedback! We have been revisiting some older tickets and re-evaluating them, and in this case we came to a conclusion that this is not a bug. The power is either idle or operational. So if it's generating any amount of gas, for that period of time it will be operating at full required power. Because of that, we will close this ticket.

Once again, thank you for your feedback!

Kind Regards,

Keen Software House: QA Department

Leave a Comment
 
Attach a file
You can't vote. Please authorize!