Skip to content

Commit

Permalink
Add setting for tech node discount
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Apr 8, 2023
1 parent ad6ff4c commit 83691b0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions TestFlightCore/TestFlightCore/TestFlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,10 @@ public class TestFlightManagerScenario : ScenarioModule

[KSPField(isPersistant = true)] public bool settingsEnabled = true;
[KSPField(isPersistant = true)] public bool settingsAlwaysMaxData = false;
[KSPField(isPersistant = true)] public bool settingsTechDiscountEnabled = false;
public bool SettingsEnabled { get { return settingsEnabled; } set { settingsEnabled = value; } }
public bool SettingsAlwaysMaxData { get { return settingsAlwaysMaxData; } set { settingsAlwaysMaxData = value; } }
public bool SettingsTechDiscountEnabled { get { return settingsTechDiscountEnabled; } set { settingsTechDiscountEnabled = value; } }

private bool rp1Available = false;
private bool careerLogging = false;
Expand Down
7 changes: 7 additions & 0 deletions TestFlightCore/TestFlightCore/TestFlightKSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ internal override void DrawWindow(int id)
tfScenario.SettingsAlwaysMaxData = saveMaxData;
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
bool techDiscountEnabled = tfScenario.SettingsTechDiscountEnabled;
if (DrawToggle(ref techDiscountEnabled, "Apply discount to tech node cost for flown parts", Styles.styleToggle))
{
tfScenario.SettingsTechDiscountEnabled = techDiscountEnabled;
}
GUILayout.EndHorizontal();
break;
}
break;
Expand Down
3 changes: 2 additions & 1 deletion TestFlightCore/TestFlightCore/TestFlightRnD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public void Start()

public void OnTreeSpawn(RDController controller)
{
if (TestFlightManagerScenario.Instance == null || controller.nodes == null)
if (TestFlightManagerScenario.Instance == null || controller.nodes == null ||
!TestFlightManagerScenario.Instance.SettingsTechDiscountEnabled)
{
return;
}
Expand Down

0 comments on commit 83691b0

Please sign in to comment.