1
0

SharedGeneratorSystem.cs 837 B

1234567891011121314151617181920
  1. namespace Content.Shared.Power.Generator;
  2. /// <summary>
  3. /// This handles small, portable generators that run off a material fuel.
  4. /// </summary>
  5. /// <seealso cref="FuelGeneratorComponent"/>
  6. public abstract class SharedGeneratorSystem : EntitySystem
  7. {
  8. /// <summary>
  9. /// Calculates the expected fuel efficiency based on the optimal and target power levels.
  10. /// </summary>
  11. /// <param name="targetPower">Target power level</param>
  12. /// <param name="optimalPower">Optimal power level</param>
  13. /// <param name="component"></param>
  14. /// <returns>Expected fuel efficiency as a percentage</returns>
  15. public static float CalcFuelEfficiency(float targetPower, float optimalPower, FuelGeneratorComponent component)
  16. {
  17. return MathF.Pow(optimalPower / targetPower, component.FuelEfficiencyConstant);
  18. }
  19. }