This commit is contained in:
Nick 2022-07-25 22:33:55 -04:00
commit 32837a314b
2 changed files with 21 additions and 5 deletions

View File

@ -47,7 +47,8 @@ namespace NewHorizons
public static bool IsSystemReady { get; private set; }
public static float FurthestOrbit { get; set; } = 50000f;
public string CurrentStarSystem { get { return Instance._currentStarSystem; } }
public string DefaultStarSystem => SystemDict.Keys.Contains(_defaultSystemOverride) ? _defaultSystemOverride : _defaultStarSystem;
public string CurrentStarSystem => _currentStarSystem;
public bool IsWarpingFromShip { get; private set; } = false;
public bool IsWarpingFromVessel { get; private set; } = false;
public bool WearingSuit { get; private set; } = false;
@ -227,6 +228,12 @@ namespace NewHorizons
{
Logger.LogVerbose($"Scene Loaded: {scene.name} {mode}");
if (!SystemDict.ContainsKey(_currentStarSystem) || !BodyDict.ContainsKey(_currentStarSystem))
{
Logger.LogError($"System \"{_currentStarSystem}\" does not exist!");
_currentStarSystem = DefaultStarSystem;
}
// Set time loop stuff if its enabled and if we're warping to a new place
if (IsChangingStarSystem && (SystemDict[_currentStarSystem].Config.enableTimeLoop || _currentStarSystem == "SolarSystem") && SecondsLeftInLoop > 0f)
{

View File

@ -21,8 +21,17 @@ namespace NewHorizons.Patches
{
RumorModeBuilder.Init();
ShipLogHandler.Init();
Logger.Log($"Beginning Ship Log Generation For: {Main.Instance.CurrentStarSystem}");
if (Main.Instance.CurrentStarSystem != "SolarSystem")
var currentStarSystem = Main.Instance.CurrentStarSystem;
if (!Main.SystemDict.ContainsKey(currentStarSystem) || !Main.BodyDict.ContainsKey(currentStarSystem))
{
currentStarSystem = Main.Instance.DefaultStarSystem;
}
Logger.Log($"Beginning Ship Log Generation For: {currentStarSystem}");
if (currentStarSystem != "SolarSystem")
{
__instance._shipLogXmlAssets = new TextAsset[] { };
foreach (ShipLogEntryLocation logEntryLocation in GameObject.FindObjectsOfType<ShipLogEntryLocation>())
@ -31,13 +40,13 @@ namespace NewHorizons.Patches
}
}
var curiosities = Main.SystemDict[Main.Instance.CurrentStarSystem].Config.curiosities;
var curiosities = Main.SystemDict[currentStarSystem].Config.curiosities;
if (curiosities != null)
{
RumorModeBuilder.AddCuriosityColors(curiosities);
}
foreach (NewHorizonsBody body in Main.BodyDict[Main.Instance.CurrentStarSystem])
foreach (NewHorizonsBody body in Main.BodyDict[currentStarSystem])
{
if (body.Config.ShipLog?.xmlFile != null)
{