forked from KSP-RO/RealSolarSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommNetFixer.cs
More file actions
54 lines (46 loc) · 2.06 KB
/
CommNetFixer.cs
File metadata and controls
54 lines (46 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using CommNet;
using System;
using System.Linq;
using UnityEngine;
namespace RealSolarSystem
{
[KSPAddon(KSPAddon.Startup.SpaceCentre, true)]
public class RSSCommNetSettings : MonoBehaviour
{
public void Start()
{
try
{
bool enableExtraGroundStations = true;
bool overrideCommNetParams = true;
float occlusionMultiplierInAtm = 1.0f;
float occlusionMultiplierInVac = 1.0f;
Debug.Log("[RealSolarSystem] Checking for custom CommNet settings...");
ConfigNode node = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault();
if (node != null)
{
node.TryGetValue("overrideCommNetParams", ref overrideCommNetParams);
node.TryGetValue("enableGroundStations", ref enableExtraGroundStations);
node.TryGetValue("occlusionMultiplierAtm", ref occlusionMultiplierInAtm);
node.TryGetValue("occlusionMultiplierVac", ref occlusionMultiplierInVac);
if (overrideCommNetParams)
{
// Set the default CommNet parameters for RealSolarSystem.
Debug.Log("[RealSolarSystem] Updating the CommNet settings...");
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().enableGroundStations = enableExtraGroundStations;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().occlusionMultiplierAtm = occlusionMultiplierInAtm;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().occlusionMultiplierVac = occlusionMultiplierInVac;
}
}
}
catch (Exception exceptionStack)
{
Debug.Log("[RealSolarSystem] RSSCommNetSettings.Start() caught an exception: " + exceptionStack);
}
finally
{
Destroy(this);
}
}
}
}