Add SetDefaultSystem to API

This commit is contained in:
Noah Pilarski 2022-06-28 01:21:25 -04:00
parent a622404e23
commit 0354a3081c
2 changed files with 14 additions and 3 deletions

View File

@ -370,7 +370,11 @@ namespace NewHorizons
if (starSystemConfig.startHere)
{
// We always want to allow mods to overwrite setting the main SolarSystem as default but not the other way around
if (name != "SolarSystem") SetDefaultSystem(name);
if (name != "SolarSystem")
{
SetDefaultSystem(name);
_currentStarSystem = name;
}
}
if (SystemDict.ContainsKey(name))
@ -494,7 +498,6 @@ namespace NewHorizons
public void SetDefaultSystem(string defaultSystem)
{
_defaultStarSystem = defaultSystem;
_currentStarSystem = defaultSystem;
}
#endregion Load

View File

@ -1,4 +1,4 @@
using NewHorizons.Builder.Props;
using NewHorizons.Builder.Props;
using NewHorizons.Utility;
using OWML.Common;
using OWML.Utils;
@ -77,6 +77,14 @@ namespace NewHorizons
return Main.Instance.OnStarSystemLoaded;
}
public bool SetDefaultSystem(string name)
{
if (!Main.SystemDict.ContainsKey(name)) return false;
Main.Instance.SetDefaultSystem(name);
return true;
}
public bool ChangeCurrentStarSystem(string name)
{
if (!Main.SystemDict.ContainsKey(name)) return false;