Move to an extension

This commit is contained in:
Noah Pilarski 2025-03-15 02:58:34 -04:00
parent d759f1843b
commit 4519d2f257
3 changed files with 8 additions and 3 deletions

View File

@ -74,7 +74,7 @@ namespace NewHorizons.Builder.Body
if (string.IsNullOrEmpty(cometTailModule.primaryBody))
cometTailModule.primaryBody = !string.IsNullOrEmpty(config.Orbit.primaryBody) ? config.Orbit.primaryBody
: (primaryBody._name == AstroObject.Name.CustomString ? primaryBody.GetCustomName() : primaryBody._name.ToString());
: primaryBody.GetKey();
var rootObj = new GameObject("CometRoot");
rootObj.SetActive(false);

View File

@ -445,6 +445,11 @@ namespace NewHorizons.Utility
return globalMusicController._endTimesSource.clip.length;
}
public static string GetKey(this AstroObject ao)
{
return ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString();
}
public static CodeMatcher LogInstructions(this CodeMatcher matcher, string prefix)
{
matcher.InstructionEnumeration().LogInstructions(prefix);

View File

@ -65,7 +65,7 @@ namespace NewHorizons.Utility.OuterWilds
public static void RegisterCustomAstroObject(AstroObject ao)
{
var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString();
var key = ao.GetKey();
if (_customAstroObjectDictionary.ContainsKey(key))
{
@ -81,7 +81,7 @@ namespace NewHorizons.Utility.OuterWilds
public static void DeregisterCustomAstroObject(AstroObject ao)
{
var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString();
var key = ao.GetKey();
_customAstroObjectDictionary.Remove(key);
}