mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
field to not check for existing body
This commit is contained in:
parent
5beb803835
commit
b8d7af90f1
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
5
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -64,6 +64,11 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public string[] removeChildren;
|
||||
|
||||
/// <summary>
|
||||
/// optimization. turn this off if you know you're generating a new body and aren't worried about other mods editing it.
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool checkForExisting = true;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Modules
|
||||
|
||||
@ -168,26 +168,29 @@ namespace NewHorizons.Handlers
|
||||
|
||||
// I don't remember doing this why is it exceptions what am I doing
|
||||
GameObject existingPlanet = null;
|
||||
try
|
||||
if (body.Config.checkForExisting)
|
||||
{
|
||||
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.name).gameObject;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (body?.Config?.name == null)
|
||||
try
|
||||
{
|
||||
NHLogger.LogError($"How is there no name for {body}");
|
||||
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.name).gameObject;
|
||||
}
|
||||
else
|
||||
catch (Exception)
|
||||
{
|
||||
existingPlanet = SearchUtilities.Find(body.Config.name.Replace(" ", "") + "_Body", false);
|
||||
if (body?.Config?.name == null)
|
||||
{
|
||||
NHLogger.LogError($"How is there no name for {body}");
|
||||
}
|
||||
else
|
||||
{
|
||||
existingPlanet = SearchUtilities.Find(body.Config.name.Replace(" ", "") + "_Body", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (existingPlanet == null && body.Config.destroy)
|
||||
{
|
||||
NHLogger.LogError($"{body.Config.name} was meant to be destroyed, but was not found");
|
||||
return false;
|
||||
if (existingPlanet == null && body.Config.destroy)
|
||||
{
|
||||
NHLogger.LogError($"{body.Config.name} was meant to be destroyed, but was not found");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (existingPlanet != null)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user