updated the rest of AstroObjectLocator to account for there now being multiple keys per astro object

This commit is contained in:
FreezeDriedMangoes 2022-06-26 22:12:45 -04:00
parent f30320e758
commit bfcee12e64

View File

@ -77,17 +77,18 @@ namespace NewHorizons.Utility
public static void DeregisterCustomAstroObject(AstroObject ao)
{
var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString();
_customAstroObjectDictionary.Remove(key);
_customAstroObjectDictionary.Remove(key);
_customAstroObjectDictionary.Remove(ao.name);
}
public static AstroObject[] GetAllAstroObjects()
{
return _customAstroObjectDictionary.Values.ToArray();
return _customAstroObjectDictionary.Values.Distinct().ToArray();
}
public static GameObject[] GetMoons(AstroObject primary)
{
return _customAstroObjectDictionary.Values.Where(x => x._primaryBody == primary).Select(x => x.gameObject).ToArray();
return _customAstroObjectDictionary.Values.Distinct().Where(x => x._primaryBody == primary).Select(x => x.gameObject).ToArray();
}
public static GameObject[] GetChildren(AstroObject primary)