Made it do we can remove children of existing planets

This commit is contained in:
Nick J. Connors 2022-01-26 16:08:26 -05:00
parent 44f87131c9
commit 59647c7f4c
3 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,7 @@ namespace NewHorizons.External
string Name { get; }
string StarSystem { get; }
bool Destroy { get; }
string[] ChildrenToDestroy { get; }
int BuildPriority { get; }
BaseModule Base { get; }
AtmosphereModule Atmosphere { get; }

View File

@ -11,6 +11,7 @@ namespace NewHorizons.External
public string Name { get; set; }
public string StarSystem { get; set; } = "SolarSystem";
public bool Destroy { get; set; }
public string[] ChildrenToDestroy { get; set; }
public int BuildPriority { get; set; } = -1;
public BaseModule Base { get; set; }
public AtmosphereModule Atmosphere { get; set; }

View File

@ -391,6 +391,14 @@ namespace NewHorizons
var sector = go.GetComponentInChildren<Sector>();
var rb = go.GetAttachedOWRigidbody();
if (body.Config.ChildrenToDestroy != null && body.Config.ChildrenToDestroy.Length > 0)
{
foreach (var child in body.Config.ChildrenToDestroy)
{
GameObject.Find(go.name + "/" + child).SetActive(false);
}
}
// Do stuff that's shared between generating new planets and updating old ones
return SharedGenerateBody(body, go, sector, rb);
}
@ -564,7 +572,7 @@ namespace NewHorizons
// Do this next tick so we can raycast the planet to place things on the surface
if (body.Config.Props != null)
PropBuilder.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);
if (body.Config.Signal != null)
SignalBuilder.Make(go, sector, body.Config.Signal, body.Mod);