mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge pull request #206 from xen-42/fix-prop-placer-for-custom-planets
Fix prop placer for custom planets
This commit is contained in:
commit
e2272298d3
@ -70,6 +70,7 @@ namespace NewHorizons.Utility
|
||||
{
|
||||
Logger.Log($"Registering [{ao.name}] as [{key}]");
|
||||
_customAstroObjectDictionary.Add(key, ao);
|
||||
_customAstroObjectDictionary.Add(ao.name, ao);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,16 +78,17 @@ namespace NewHorizons.Utility
|
||||
{
|
||||
var key = ao._name == AstroObject.Name.CustomString ? ao.GetCustomName() : ao._name.ToString();
|
||||
_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)
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user