Fix orbit updater issue

This commit is contained in:
Nick 2022-03-20 21:10:21 -04:00
parent 7fd523743a
commit a1e84d8152
2 changed files with 6 additions and 1 deletions

View File

@ -18,7 +18,7 @@ namespace NewHorizons.Builder.Updater
public static void Update(NewHorizonsBody body, GameObject go) public static void Update(NewHorizonsBody body, GameObject go)
{ {
var mapping = Planet.defaultMapping; var mapping = Planet.defaultMapping;
var heavenlyBody = CommonResourcesUtilities.HeavenlyBodyFromAstroObject(AstroObjectLocator.GetAstroObject(body.Config.Name)); var heavenlyBody = CommonResourcesUtilities.HeavenlyBodyFromAstroObject(go.GetComponent<AstroObject>());
Logger.Log($"Updating position of {body.Config.Name}/{heavenlyBody}"); Logger.Log($"Updating position of {body.Config.Name}/{heavenlyBody}");

View File

@ -13,6 +13,11 @@ namespace NewHorizons.Utility.CommonResources
{ {
public static HeavenlyBody HeavenlyBodyFromAstroObject(AstroObject obj) public static HeavenlyBody HeavenlyBodyFromAstroObject(AstroObject obj)
{ {
if(obj == null)
{
Logger.LogError("Asking for a heavenly body from astro object but it is null");
}
switch (obj.GetAstroObjectName()) switch (obj.GetAstroObjectName())
{ {
case AstroObject.Name.CustomString: case AstroObject.Name.CustomString: