(1cdaf2ba2) Make oxygen generator output decrease exponentially to make it easier to tune the output so there's enough oxygen regardless of the crew size when the generator is in a good condition, but not enough when it's damaged. Generator outputs should be adjusted a little higher now, for example multiplying them by 4 would mean the generator provides 100%-400% of the previous output when above 50% condition, and below that the output starts rapidly dropping.

This commit is contained in:
Joonas Rikkonen
2019-06-04 16:44:44 +03:00
parent 7056cbdeb3
commit 40890a7754
2 changed files with 7 additions and 46 deletions
@@ -22,7 +22,7 @@ namespace Barotrauma.Items.Components
private set;
}
[Editable(ToolTip = "How much oxygen the machine generates when operating at full power."), Serialize(100.0f, true)]
[Editable(ToolTip = "How much oxygen the machine generates when operating at full power."), Serialize(400.0f, true)]
public float GeneratedAmount
{
get { return generatedAmount; }
@@ -62,8 +62,13 @@ namespace Barotrauma.Items.Components
}
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 100.0f;
//less effective when in bad condition
CurrFlow *= MathHelper.Lerp(0.5f, 1.0f, item.Condition / item.MaxCondition);
float conditionMult = item.Condition / item.MaxCondition;
//100% condition = 100% oxygen
//50% condition = 25% oxygen
//20% condition = 4%
CurrFlow *= conditionMult * conditionMult;
UpdateVents(CurrFlow);