field to not check for existing body

This commit is contained in:
JohnCorby 2025-02-13 21:31:03 -08:00
parent 5beb803835
commit b8d7af90f1
2 changed files with 31 additions and 23 deletions

View File

@ -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

View File

@ -168,6 +168,8 @@ namespace NewHorizons.Handlers
// I don't remember doing this why is it exceptions what am I doing
GameObject existingPlanet = null;
if (body.Config.checkForExisting)
{
try
{
existingPlanet = AstroObjectLocator.GetAstroObject(body.Config.name).gameObject;
@ -189,6 +191,7 @@ namespace NewHorizons.Handlers
NHLogger.LogError($"{body.Config.name} was meant to be destroyed, but was not found");
return false;
}
}
if (existingPlanet != null)
{