mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Check if system exists else revert to default
This commit is contained in:
parent
2e49a1df23
commit
46f6973534
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user