Fix #933 probably

This commit is contained in:
xen-42 2024-10-02 22:25:26 -04:00
parent 36cbf67ff0
commit 95bd1f78e2
2 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,8 @@ namespace NewHorizons.Builder.General
{
public static class AstroObjectBuilder
{
public static GameObject CenterOfUniverse { get; private set; }
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, NewHorizonsBody nhBody, bool isVanilla)
{
NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
@ -62,6 +64,8 @@ namespace NewHorizons.Builder.General
if (config.Base.centerOfSolarSystem)
{
CenterOfUniverse = body;
NHLogger.Log($"Setting center of universe to {config.name}");
Delay.RunWhen(

View File

@ -421,8 +421,8 @@ namespace NewHorizons.Handlers
if (defaultPrimaryToSun)
{
NHLogger.LogError($"Couldn't find {body.Config.Orbit.primaryBody}, defaulting to center of solar system");
// TODO: Make this work in other systems. We tried using Locator.GetCenterOfUniverse before but that doesn't work since its too early now
primaryBody = SearchUtilities.Find("Sun_Body")?.GetComponent<AstroObject>();
// Fix #933 not defaulting primary body
primaryBody = (SearchUtilities.Find("Sun_Body") ?? AstroObjectBuilder.CenterOfUniverse)?.GetComponent<AstroObject>();
}
else
{