Skip to content

Commit

Permalink
allow for configured presets in radiation settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SirMortimer committed Jul 11, 2019
1 parent 165ec86 commit 93cbe62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Added support for Universal Storage 2 fuel cells (lordcirth)
* Added config for Unkerballed start tech tree (Sir Mortimer)
* Added config for a new ReStock+ probe core RC-XL001 (Sir Mortimer)
* Radiation values in settings now take a preset from Settings.cfg (Sir Mortimer)

## v3.0.2 for all versions of KSP from 1.4.0 to 1.7.x

Expand Down
18 changes: 9 additions & 9 deletions src/Kerbalism/System/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class PreferencesMessages : GameParameters.CustomParameterNode
public bool supply = true;

[GameParameters.CustomParameterUI("Signal", toolTip = "Show a message when signal is lost or obtained\n(Preset, can be changed per vessel)")]
public bool signal = true;
public bool signal = false;

[GameParameters.CustomParameterUI("Failures", toolTip = "Show a message when a components fail\n(Preset, can be changed per vessel)")]
public bool malfunction = true;
Expand All @@ -136,7 +136,7 @@ public class PreferencesMessages : GameParameters.CustomParameterNode
public bool storm = true;

[GameParameters.CustomParameterUI("Scripts", toolTip = "Show a message when scripts are executed\n(Preset, can be changed per vessel)")]
public bool script = true;
public bool script = false;

[GameParameters.CustomParameterUI("Stock Messages", toolTip = "Use the stock message system instead of our own")]
public bool stockMessages = false;
Expand Down Expand Up @@ -286,25 +286,25 @@ public override void OnLoad(ConfigNode node)
public class PreferencesStorm : GameParameters.CustomParameterNode
{
[GameParameters.CustomIntParameterUI("Min Days Between Storms", minValue = 1, maxValue = 2000, toolTip = "Minimum days between storms over a system")]
public int stormMinDays = 100;
public int stormMinDays = Settings.StormMinDays;

[GameParameters.CustomIntParameterUI("Max Days Between Storms", minValue = 1, maxValue = 2000, toolTip = "Maximum days between storms over a system")]
public int stormMaxDays = 500;
public int stormMaxDays = Settings.StormMaxDays;

[GameParameters.CustomIntParameterUI("Storm Duration Hours", minValue = 1, maxValue = 200, toolTip = "Average duration of a storm in hours")]
public int stormDurationHours = 6;
public int stormDurationHours = Settings.StormDurationHours;//6;

[GameParameters.CustomFloatParameterUI("Storm Ejection Speed", asPercentage = true, minValue = 0.01f, maxValue = 1, displayFormat = "F2", toolTip = "CME speed as percentage of C")]
public float stormEjectionSpeedC = 0.33f;
public float stormEjectionSpeedC = Settings.StormEjectionSpeed;

[GameParameters.CustomFloatParameterUI("Shielding Efficiency", asPercentage = true, minValue = 0.01f, maxValue = 1, displayFormat = "F2", toolTip = "Proportion of radiation blocked by shielding (at max amount)")]
public float shieldingEfficiency = 0.9f;
public float shieldingEfficiency = Settings.ShieldingEfficiency;

[GameParameters.CustomFloatParameterUI("Storm Radiation rad/h", minValue = 1, maxValue = 15, displayFormat = "F2", toolTip = "Radiation during a solar storm")]
public float stormRadiation = 5;
public float stormRadiation = Settings.StormRadiation;

[GameParameters.CustomFloatParameterUI("External Radiation rad/h", minValue = 0.01f, maxValue = 2, displayFormat = "F2", toolTip = "Radiation outside the heliopause")]
public float externRadiation = 0.04f;
public float externRadiation = Settings.ExternRadiation;

public double StormMinTime { get { return stormMinDays * Lib.HoursInDay() * 3600.0; } }

Expand Down
22 changes: 19 additions & 3 deletions src/Kerbalism/System/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,18 @@ public static void Parse()
ComfortCallHome = Lib.ConfigValue(cfg, "ComfortCallHome", 0.1f);
ComfortPanorama = Lib.ConfigValue(cfg, "ComfortPanorama", 0.1f);
ComfortPlants = Lib.ConfigValue(cfg, "ComfortPlants", 0.1f);
}

// profile used
public static string Profile; // name of profile to use, if any
StormMinDays = Lib.ConfigValue(cfg, "StormMinDays", 100);
StormMaxDays = Lib.ConfigValue(cfg, "StormMaxDays", 500);
StormDurationHours = Lib.ConfigValue(cfg, "StormDurationHours", 6);
StormEjectionSpeed = Lib.ConfigValue(cfg, "StormEjectionSpeed", 0.33f);
ShieldingEfficiency = Lib.ConfigValue(cfg, "ShieldingEfficiency", 0.9f);
StormRadiation = Lib.ConfigValue(cfg, "StormRadiation", 5.0f);
ExternRadiation = Lib.ConfigValue(cfg, "ExternRadiation", 0.04f);
}

// profile used
public static string Profile; // name of profile to use, if any

// user-defined features
public static bool Reliability; // component malfunctions and critical failures
Expand Down Expand Up @@ -148,6 +156,14 @@ public static void Parse()
public static float ComfortCallHome;
public static float ComfortPanorama;
public static float ComfortPlants;

public static int StormMinDays;
public static int StormDurationHours;
public static int StormMaxDays;
public static float StormEjectionSpeed;
public static float ShieldingEfficiency;
public static float StormRadiation;
public static float ExternRadiation;
}


Expand Down

1 comment on commit 93cbe62

@sswelm
Copy link
Contributor

@sswelm sswelm commented on 93cbe62 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Please sign in to comment.