made AstroObjectLocator also register astro objects under the name of their game object, eg MyPlanet_Body

This commit is contained in:
FreezeDriedMangoes 2022-06-25 22:53:38 -04:00
parent d04f36881b
commit f30320e758
2 changed files with 3 additions and 5 deletions

View File

@ -69,7 +69,8 @@ namespace NewHorizons.Utility
else
{
Logger.Log($"Registering [{ao.name}] as [{key}]");
_customAstroObjectDictionary.Add(key, ao);
_customAstroObjectDictionary.Add(key, ao);
_customAstroObjectDictionary.Add(ao.name, ao);
}
}

View File

@ -144,13 +144,10 @@ namespace NewHorizons.Utility.DebugUtilities
public static string GetAstroObjectName(string bodyName)
{
if (bodyName.EndsWith("_Body")) bodyName = bodyName.Substring(0, bodyName.Length-"_Body".Length);
var astroObject = AstroObjectLocator.GetAstroObject(bodyName);
if (astroObject == null) return null;
var astroObjectName = astroObject.name;
if (astroObjectName.EndsWith("_Body")) astroObjectName = astroObjectName.Substring(0, astroObjectName.Length-"_Body".Length);
return astroObjectName;
}
@ -202,7 +199,7 @@ namespace NewHorizons.Utility.DebugUtilities
string bodyName = GetAstroObjectName(bodyGameObjectName);
Logger.Log("Adding prop to " + Main.Instance.CurrentStarSystem + "::" + bodyName);
Logger.Log("Adding prop to " + Main.Instance.CurrentStarSystem + "::" + bodyName + " (passed name: "+bodyGameObjectName+")");
detailInfo = detailInfo == null ? new DetailInfo() : detailInfo;