Material generators from Afterlight (#18387)

This commit is contained in:
Nemanja
2023-07-31 14:42:38 -04:00
committed by GitHub
parent b9af7d3668
commit 2d08f02d23
34 changed files with 639 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
namespace Content.Shared.Power.Generator;
/// <summary>
/// This handles small, portable generators that run off a material fuel.
/// </summary>
public abstract class SharedGeneratorSystem : EntitySystem
{
/// <summary>
/// Calculates the expected fuel efficiency based on the optimal and target power levels.
/// </summary>
/// <param name="targetPower">Target power level</param>
/// <param name="optimalPower">Optimal power level</param>
/// <param name="component"></param>
/// <returns>Expected fuel efficiency as a percentage</returns>
public static float CalcFuelEfficiency(float targetPower, float optimalPower, FuelGeneratorComponent component)
{
return MathF.Pow(optimalPower / targetPower, component.FuelEfficiencyConstant);
}
}