From 8af6d11c52ba0ff1ace31e82058d6c79e8cdbdd0 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 18 Aug 2022 15:38:23 -0400 Subject: [PATCH] Quantum --- .../Builder/Body/StellarRemnantBuilder.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs index e8302954..ed7df638 100644 --- a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs +++ b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs @@ -18,11 +18,22 @@ namespace NewHorizons.Builder.Body { public static class StellarRemnantBuilder { - public static void Make(NewHorizonsBody star, GameObject go, OWRigidbody rb, IModBehaviour mod, NewHorizonsBody stellarRemnant = null) + public static StellarRemnantController Make(NewHorizonsBody star, GameObject go, OWRigidbody rb, IModBehaviour mod, NewHorizonsBody stellarRemnant = null) { - Logger.Log($"Creating stellar remnant for [{star.Config.name}]"); try { + var currentSRC = go.GetComponentInChildren(); + if (currentSRC != null) + { + foreach (var starEvolutionController1 in go.GetComponentsInChildren(true)) + { + starEvolutionController1.SetStellarRemnantController(currentSRC); + } + return currentSRC; + } + + Logger.Log($"Creating stellar remnant for [{star.Config.name}]"); + var config = star.Config; var starModule = star.Config.Star; var size = starModule.size; @@ -123,10 +134,13 @@ namespace NewHorizons.Builder.Body break; } } + + return stellarRemnantController; } catch (Exception ex) { Logger.LogError($"Couldn't make stellar remnant for [{star.Config.name}]:\n{ex}"); + return null; } } }