Skip to content

Commit 01a9552

Browse files
committed
Added option to disable dynamic-pressure-based ignition chance penalties
1 parent 2e551a2 commit 01a9552

File tree

2 files changed

+25
-40
lines changed

2 files changed

+25
-40
lines changed

TestFlightFailure_IgnitionFail.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class TestFlightFailure_IgnitionFail : TestFlightFailure_Engine
3232

3333
private ITestFlightCore core = null;
3434
private bool preLaunchFailures;
35+
private bool dynPressurePenalties;
3536

3637
public override void OnStart(StartState state)
3738
{
@@ -40,8 +41,9 @@ public override void OnStart(StartState state)
4041
if (core != null)
4142
Startup();
4243

43-
// Get the in-game setting for Launch Pad Ignition Failures
44+
// Get the in-game settings
4445
preLaunchFailures = HighLogic.CurrentGame.Parameters.CustomParams<TestFlightGameSettings>().preLaunchFailures;
46+
dynPressurePenalties = HighLogic.CurrentGame.Parameters.CustomParams<TestFlightGameSettings>().dynPressurePenalties;
4547
}
4648

4749
public override void Startup()
@@ -96,9 +98,12 @@ public override void OnUpdate()
9698
ignitionChance = 1f;
9799
}
98100

99-
multiplier = pressureCurve.Evaluate((float)(part.dynamicPressurekPa * 1000d));
100-
if (multiplier <= 0f)
101-
multiplier = 1f;
101+
if (dynPressurePenalties)
102+
{
103+
multiplier = pressureCurve.Evaluate((float)(part.dynamicPressurekPa * 1000d));
104+
if (multiplier <= 0f)
105+
multiplier = 1f;
106+
}
102107

103108
float minValue, maxValue = -1f;
104109
baseIgnitionChance.FindMinMaxValue(out minValue, out maxValue);

TestFlightSettings.cs

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,21 @@
99

1010
using TestFlightAPI;
1111

12-
namespace TestFlight {
13-
public class TestFlightGameSettings : GameParameters.CustomParameterNode {
14-
public override string Title { get { return "TestFlight Options"; } }
15-
public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } }
16-
public override string Section { get { return "TestFlight"; } }
17-
public override string DisplaySection { get { return Section; } }
18-
public override int SectionOrder { get { return 1; } }
19-
public override bool HasPresets { get { return true; } }
20-
21-
[GameParameters.CustomParameterUI("Pre-Launch Ignition Failures Enabled?", toolTip = "Set to enable ignition failures on the Launch Pad.")]
22-
public bool preLaunchFailures = true;
23-
24-
public override void SetDifficultyPreset(GameParameters.Preset preset) {
25-
Debug.Log("Setting difficulty preset");
26-
switch (preset)
27-
{
28-
case GameParameters.Preset.Easy:
29-
preLaunchFailures = true;
30-
break;
31-
case GameParameters.Preset.Normal:
32-
preLaunchFailures = true;
33-
break;
34-
case GameParameters.Preset.Moderate:
35-
preLaunchFailures = true;
36-
break;
37-
case GameParameters.Preset.Hard:
38-
preLaunchFailures = true;
39-
break;
40-
case GameParameters.Preset.Custom:
41-
preLaunchFailures = true;
42-
break;
43-
default:
44-
preLaunchFailures = true;
45-
break;
46-
}
12+
namespace TestFlight
13+
{
14+
public class TestFlightGameSettings : GameParameters.CustomParameterNode
15+
{
16+
public override string Title { get { return "TestFlight Options"; } }
17+
public override GameParameters.GameMode GameMode { get { return GameParameters.GameMode.ANY; } }
18+
public override string Section { get { return "TestFlight"; } }
19+
public override string DisplaySection { get { return Section; } }
20+
public override int SectionOrder { get { return 1; } }
21+
public override bool HasPresets { get { return true; } }
22+
23+
[GameParameters.CustomParameterUI("Pre-Launch Ignition Failures Enabled?", toolTip = "Set to enable ignition failures on the Launch Pad.")]
24+
public bool preLaunchFailures = true;
25+
26+
[GameParameters.CustomParameterUI("Penalty For High Dynamic Pressure Enabled?", toolTip = "Whether engine ignition chance will suffer a penalty based on dynamic pressure.")]
27+
public bool dynPressurePenalties = true;
4728
}
48-
}
4929
}

0 commit comments

Comments
 (0)