mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Improved astroobjectlocator + funnels on existing planets
This commit is contained in:
parent
572e5d2bca
commit
084ab5ea76
@ -331,18 +331,11 @@ namespace NewHorizons
|
|||||||
|
|
||||||
private bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
private bool LoadBody(NewHorizonsBody body, bool defaultPrimaryToSun = false)
|
||||||
{
|
{
|
||||||
var stringID = body.Config.Name.ToUpper().Replace(" ", "_").Replace("'", "");
|
// I don't remember doing this why is it exceptions what am I doing
|
||||||
if (stringID.Equals("ATTLEROCK")) stringID = "TIMBER_MOON";
|
|
||||||
if (stringID.Equals("HOLLOWS_LANTERN")) stringID = "VOLCANIC_MOON";
|
|
||||||
if (stringID.Equals("ASH_TWIN")) stringID = "TOWER_TWIN";
|
|
||||||
if (stringID.Equals("EMBER_TWIN")) stringID = "CAVE_TWIN";
|
|
||||||
if (stringID.Equals("INTERLOPER")) stringID = "COMET";
|
|
||||||
|
|
||||||
GameObject existingPlanet = null;
|
GameObject existingPlanet = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
existingPlanet = AstroObjectLocator.GetAstroObject(stringID).gameObject;
|
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name).gameObject;
|
||||||
if (existingPlanet == null) existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.Name.Replace(" ", "")).gameObject;
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -356,8 +349,8 @@ namespace NewHorizons
|
|||||||
if (body.Config.Destroy)
|
if (body.Config.Destroy)
|
||||||
{
|
{
|
||||||
var ao = existingPlanet.GetComponent<AstroObject>();
|
var ao = existingPlanet.GetComponent<AstroObject>();
|
||||||
if (ao != null) Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveBody(ao), 2);
|
if (ao != null) Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestroyer.RemoveBody(ao), 5);
|
||||||
else Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
else Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 5);
|
||||||
}
|
}
|
||||||
else UpdateBody(body, existingPlanet);
|
else UpdateBody(body, existingPlanet);
|
||||||
}
|
}
|
||||||
@ -395,7 +388,7 @@ namespace NewHorizons
|
|||||||
{
|
{
|
||||||
foreach (var child in body.Config.ChildrenToDestroy)
|
foreach (var child in body.Config.ChildrenToDestroy)
|
||||||
{
|
{
|
||||||
GameObject.Find(go.name + "/" + child).SetActive(false);
|
Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child).SetActive(false), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,9 +497,6 @@ namespace NewHorizons
|
|||||||
|
|
||||||
if (!body.Config.Orbit.IsStatic) DetectorBuilder.Make(go, owRigidBody, primaryBody, ao);
|
if (!body.Config.Orbit.IsStatic) DetectorBuilder.Make(go, owRigidBody, primaryBody, ao);
|
||||||
|
|
||||||
if (body.Config.Funnel != null)
|
|
||||||
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), owRigidBody, body.Config.Funnel);
|
|
||||||
|
|
||||||
if (ao.GetAstroObjectName() == AstroObject.Name.CustomString) AstroObjectLocator.RegisterCustomAstroObject(ao);
|
if (ao.GetAstroObjectName() == AstroObject.Name.CustomString) AstroObjectLocator.RegisterCustomAstroObject(ao);
|
||||||
|
|
||||||
HeavenlyBodyBuilder.Make(go, body.Config, sphereOfInfluence, gv, initialMotion);
|
HeavenlyBodyBuilder.Make(go, body.Config, sphereOfInfluence, gv, initialMotion);
|
||||||
@ -570,7 +560,6 @@ namespace NewHorizons
|
|||||||
AtmosphereBuilder.Make(go, body.Config.Atmosphere, body.Config.Base.SurfaceSize);
|
AtmosphereBuilder.Make(go, body.Config.Atmosphere, body.Config.Base.SurfaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do this next tick so we can raycast the planet to place things on the surface
|
|
||||||
if (body.Config.Props != null)
|
if (body.Config.Props != null)
|
||||||
PropBuildManager.Make(go, sector, body.Config, body.Mod.Assets, body.Mod.Manifest.UniqueName);
|
PropBuildManager.Make(go, sector, body.Config, body.Mod.Assets, body.Mod.Manifest.UniqueName);
|
||||||
|
|
||||||
@ -580,6 +569,9 @@ namespace NewHorizons
|
|||||||
if (body.Config.Base.BlackHoleSize != 0 || body.Config.Singularity != null)
|
if (body.Config.Base.BlackHoleSize != 0 || body.Config.Singularity != null)
|
||||||
SingularityBuilder.Make(go, sector, rb, body.Config);
|
SingularityBuilder.Make(go, sector, rb, body.Config);
|
||||||
|
|
||||||
|
if (body.Config.Funnel != null)
|
||||||
|
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel);
|
||||||
|
|
||||||
return go;
|
return go;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,17 +17,27 @@ namespace NewHorizons.Utility
|
|||||||
|
|
||||||
private static List<AstroObject> _list = new List<AstroObject>();
|
private static List<AstroObject> _list = new List<AstroObject>();
|
||||||
|
|
||||||
public static AstroObject GetAstroObject(string name)
|
public static AstroObject GetAstroObject(string name, bool flag = false)
|
||||||
{
|
{
|
||||||
if (name.ToUpper().Replace("_", "").Equals("MAPSATELLITE"))
|
if (_customAstroObjectDictionary.ContainsKey(name)) return _customAstroObjectDictionary[name];
|
||||||
|
|
||||||
|
var stringID = name.ToUpper().Replace(" ", "_").Replace("'", "");
|
||||||
|
if (stringID.Equals("ATTLEROCK")) stringID = "TIMBER_MOON";
|
||||||
|
if (stringID.Equals("HOLLOWS_LANTERN")) stringID = "VOLCANIC_MOON";
|
||||||
|
if (stringID.Equals("ASH_TWIN")) stringID = "TOWER_TWIN";
|
||||||
|
if (stringID.Equals("EMBER_TWIN")) stringID = "CAVE_TWIN";
|
||||||
|
if (stringID.Equals("INTERLOPER")) stringID = "COMET";
|
||||||
|
|
||||||
|
if (stringID.ToUpper().Replace("_", "").Equals("MAPSATELLITE"))
|
||||||
return GetAstroObject(AstroObject.Name.MapSatellite);
|
return GetAstroObject(AstroObject.Name.MapSatellite);
|
||||||
var aoName = AstroObject.StringIDToAstroObjectName(name);
|
|
||||||
if(aoName == AstroObject.Name.None) aoName = AstroObject.StringIDToAstroObjectName(name.ToUpper().Replace(" ", "_"));
|
var aoName = AstroObject.StringIDToAstroObjectName(stringID);
|
||||||
if (aoName != AstroObject.Name.None && aoName != AstroObject.Name.CustomString)
|
if (aoName != AstroObject.Name.None && aoName != AstroObject.Name.CustomString) return GetAstroObject(aoName);
|
||||||
return GetAstroObject(aoName);
|
|
||||||
if (_customAstroObjectDictionary.ContainsKey(name))
|
// Try again
|
||||||
return _customAstroObjectDictionary[name];
|
if (!flag) return GetAstroObject(name.Replace(" ", ""), true);
|
||||||
else return null;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AstroObject GetAstroObject(AstroObject.Name astroObjectName, string customName = null)
|
public static AstroObject GetAstroObject(AstroObject.Name astroObjectName, string customName = null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user