Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions GameData/RealSolarSystem/RealSolarSystem.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ REALSOLARSYSTEM
cam01FarClip = 1875000
}
}
}

RSSRUNWAYFIX
{
debug = false
holdThreshold = 2700
RSSRUNWAYFIX
{
debug = false
holdThreshold = 2700
}
}
29 changes: 16 additions & 13 deletions Source/CommNetFixer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using CommNet;
using System;
using System.Linq;
using UnityEngine;

namespace RealSolarSystem
Expand All @@ -19,23 +20,25 @@ public void Start()

Debug.Log("[RealSolarSystem] Checking for custom CommNet settings...");

foreach (ConfigNode RSSSettings in GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM"))
{
RSSSettings.TryGetValue("overrideCommNetParams", ref overrideCommNetParams);
RSSSettings.TryGetValue("enableGroundStations", ref enableExtraGroundStations);
RSSSettings.TryGetValue("occlusionMultiplierAtm", ref occlusionMultiplierInAtm);
RSSSettings.TryGetValue("occlusionMultiplierVac", ref occlusionMultiplierInVac);
}
ConfigNode node = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault();

if (overrideCommNetParams)
if (node != null)
{
// Set the default CommNet parameters for RealSolarSystem.
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...");
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;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().enableGroundStations = enableExtraGroundStations;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().occlusionMultiplierAtm = occlusionMultiplierInAtm;
HighLogic.CurrentGame.Parameters.CustomParams<CommNetParams>().occlusionMultiplierVac = occlusionMultiplierInVac;
}
}
}
catch (Exception exceptionStack)
Expand Down
9 changes: 6 additions & 3 deletions Source/RSSRunwayFix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections;
using System.Linq;
using UnityEngine;
using static RunwayCollisionHandler;

Expand Down Expand Up @@ -43,14 +44,16 @@ public void Awake()

public void Start()
{
foreach (ConfigNode n in GameDatabase.Instance.GetConfigNodes("RSSRUNWAYFIX"))
ConfigNode node = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault(n => n.HasNode("RSSRUNWAYFIX"))?.GetNode("RSSRUNWAYFIX");

if (node != null)
{
if (bool.TryParse(n.GetValue("debug"), out bool bTemp))
if (bool.TryParse(node.GetValue("debug"), out bool bTemp))
{
debug = bTemp;
}

if (float.TryParse(n.GetValue("holdThreshold"), out float fTemp))
if (float.TryParse(node.GetValue("holdThreshold"), out float fTemp))
{
holdThreshold = fTemp;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/TimeWarpFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Update()
{
fixedTimeWarp = true;

ConfigNode twNode = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault(n => n.HasNode("timeWarpRates"));
ConfigNode twNode = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault(n => n.HasNode("timeWarpRates"))?.GetNode("timeWarpRates");

if (twNode != null)
{
Expand Down
8 changes: 5 additions & 3 deletions Source/Watchdogs.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.Rendering;
using System.Linq;

namespace RealSolarSystem
{
Expand All @@ -19,8 +20,7 @@ public class RSSWatchDog : MonoBehaviour

public void Start()
{
foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM"))
rssSettings = node;
rssSettings = GameDatabase.Instance.GetConfigNodes("REALSOLARSYSTEM").FirstOrDefault(n => n.HasNode("ClipPlanes"));

GameEvents.onVesselSOIChanged.Add(OnVesselSOIChanged);
GameEvents.onVesselSituationChange.Add(OnVesselSituationChanged);
Expand All @@ -47,7 +47,9 @@ public void Update()
Camera[] cameras = Camera.allCameras;
string bodyName = FlightGlobals.getMainBody().name;

ConfigNode clipPlaneSettings;
if (rssSettings == null) return;

ConfigNode clipPlaneSettings = null;
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 ||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12)
{
Expand Down
Loading