If smaller than 1000 don't explode by default

This commit is contained in:
Nick 2022-08-25 23:34:41 -04:00
parent 6da2425809
commit a447b80307
2 changed files with 18 additions and 6 deletions

View File

@ -11,8 +11,15 @@ namespace NewHorizons.Builder.Body
{
public static class StellarRemnantBuilder
{
public const float whiteDwarfSize = 1000;
public const float neutronStarSize = 2000;
public const float blackholeSize = 4000;
public static GameObject Make(GameObject go, OWRigidbody rb, float soi, IModBehaviour mod, NewHorizonsBody star)
{
var remnantType = star.Config.Star.stellarRemnantType;
if (remnantType == StellarRemnantType.Default && star.Config.Star.size < whiteDwarfSize) return null;
try
{
Logger.Log($"Creating stellar remnant for [{star.Config.name}]");
@ -22,8 +29,6 @@ namespace NewHorizons.Builder.Body
sector.gameObject.SetActive(false);
var remnantType = star.Config.Star.stellarRemnantType;
if (remnantType == StellarRemnantType.Default) remnantType = GetDefault(star.Config.Star.size);
switch (remnantType)
@ -60,8 +65,8 @@ namespace NewHorizons.Builder.Body
private static StellarRemnantType GetDefault(float progenitorSize)
{
if (progenitorSize >= 4000) return StellarRemnantType.BlackHole;
else if (2000 < progenitorSize && progenitorSize < 4000) return StellarRemnantType.NeutronStar;
if (progenitorSize >= blackholeSize) return StellarRemnantType.BlackHole;
else if (neutronStarSize < progenitorSize && progenitorSize < blackholeSize) return StellarRemnantType.NeutronStar;
else return StellarRemnantType.WhiteDwarf;
}

View File

@ -511,8 +511,15 @@ namespace NewHorizons.Handlers
remnantGO = StellarRemnantBuilder.Make(go, rb, sphereOfInfluence, body.Mod, body);
}
remnantGO.SetActive(false);
starEvolutionController.SetStellarRemnant(remnantGO);
if (remnantGO != null)
{
remnantGO.SetActive(false);
starEvolutionController.SetStellarRemnant(remnantGO);
}
else
{
starEvolutionController.willExplode = false;
}
}
}