-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
131 additions
and
122 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
HullBreachSettings | ||
{ | ||
CrushDepth = 20 | ||
flowRate = 0.5 | ||
critFlowRate = 0.90000000000000002 | ||
breachTemp = 0.59999999999999998 | ||
critBreachTemp = 0.90000000000000002 | ||
ecDrain = True | ||
isHullBreachEnabled = False | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using System; | ||
using KSP.UI.Screens; | ||
using UnityEngine; | ||
|
||
namespace HullBreach | ||
{ | ||
[KSPAddon(KSPAddon.Startup.EveryScene, false)] | ||
public class config : MonoBehaviour | ||
{ | ||
|
||
public static string SettingsConfigUrl = "GameData/HullBreach/settings.cfg"; | ||
|
||
public static double flowRate { get; set; } | ||
public static double critFlowRate { get; set; } | ||
public static double breachTemp { get; set; } | ||
public static double critBreachTemp { get; set; } | ||
|
||
public static bool ecDrain { get; set; } | ||
public static bool isHullBreachEnabled { get; set; } | ||
|
||
public ModuleHullBreach vesselHullBreach = null; | ||
public static config Instance; | ||
|
||
void Awake() | ||
{ | ||
LoadConfig(); | ||
Instance = this; | ||
} | ||
|
||
public static void LoadConfig() | ||
{ | ||
try | ||
{ | ||
Debug.Log("[HullBreach]: Loading settings.cfg "); | ||
|
||
ConfigNode fileNode = ConfigNode.Load(SettingsConfigUrl); | ||
if (!fileNode.HasNode("HullBreachSettings")) return; | ||
|
||
ConfigNode settings = fileNode.GetNode("HullBreachSettings"); | ||
|
||
flowRate = double.Parse(settings.GetValue("flowRate")); | ||
critFlowRate = double.Parse(settings.GetValue("critFlowRate")); | ||
breachTemp = double.Parse(settings.GetValue("breachTemp")); | ||
critBreachTemp = double.Parse(settings.GetValue("critBreachTemp")); | ||
|
||
ecDrain = bool.Parse(settings.GetValue("ecDrain")); | ||
isHullBreachEnabled = bool.Parse(settings.GetValue("isHullBreachEnabled")); | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
Debug.Log("[HullBreach]: Failed to load settings config:" + ex.Message); | ||
} | ||
} | ||
|
||
public static void SaveConfig() | ||
{ | ||
try | ||
{ | ||
Debug.Log("[HullBreach]: Saving settings.cfg =="); | ||
ConfigNode fileNode = ConfigNode.Load(SettingsConfigUrl); | ||
|
||
if (!fileNode.HasNode("HullBreachSettings")) return; | ||
|
||
ConfigNode settings = fileNode.GetNode("HullBreachSettings"); | ||
|
||
settings.SetValue("flowRate", flowRate); | ||
settings.SetValue("critFlowRate", critBreachTemp); | ||
settings.SetValue("breachTemp", breachTemp); | ||
settings.SetValue("critBreachTemp", critBreachTemp); | ||
settings.SetValue("ecDrain", ecDrain); | ||
settings.SetValue("isHullBreachEnabled", isHullBreachEnabled); | ||
|
||
fileNode.Save(SettingsConfigUrl); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Debug.Log("[HullBreach]: Failed to save settings config:" + ex.Message); throw; | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:\Games\KSP_Debug | ||
S:\Games\KSP_1.3_Debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters