From d42df46a33c52303f29a9926713028744b10db39 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 23 Jan 2023 08:48:22 -0500 Subject: [PATCH] Only use primary body sector if its a binary focal point --- NewHorizons/Builder/Body/FunnelBuilder.cs | 8 +++++--- NewHorizons/Handlers/PlanetCreationHandler.cs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index cde0e76a..aeeea881 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.Utility; using UnityEngine; using Logger = NewHorizons.Utility.Logger; using NewHorizons.External.Modules.VariableSize; +using NewHorizons.Components.Orbital; namespace NewHorizons.Builder.Body { @@ -34,7 +35,7 @@ namespace NewHorizons.Builder.Body if (_lavaMaterial == null) _lavaMaterial = new Material(SearchUtilities.Find("VolcanicMoon_Body/MoltenCore_VM/LavaSphere").GetComponent().sharedMaterial).DontDestroyOnLoad(); } - public static void Make(GameObject planetGO, Sector sector, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module) + public static void Make(GameObject planetGO, Sector sector, OWRigidbody rigidbody, FunnelModule module) { InitPrefabs(); @@ -55,7 +56,7 @@ namespace NewHorizons.Builder.Body var detectorGO = new GameObject("Detector_Funnel"); detectorGO.transform.parent = funnelGO.transform; var funnelDetector = detectorGO.AddComponent(); - funnelDetector._inheritDetector = detector; + funnelDetector._inheritDetector = planetGO.GetComponentInChildren(); funnelDetector._detectableFields = new ForceVolume[0]; detectorGO.AddComponent(); @@ -165,8 +166,9 @@ namespace NewHorizons.Builder.Body break; } + // We take the sector of the binary focal point if it exists for this funnel (like with the twins) var primaryBody = planetGO.GetComponent().GetPrimaryBody(); - if (primaryBody != null) sector = primaryBody.GetRootSector(); + if (primaryBody?.GetComponent() != null) sector = primaryBody.GetRootSector(); proxyGO.GetComponent().SetSector(sector); geoGO.GetComponent().SetSector(sector); diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index ca07f1a1..6c2bb0a0 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -638,7 +638,7 @@ namespace NewHorizons.Handlers if (body.Config.Funnel != null) { - FunnelBuilder.Make(go, sector, go.GetComponentInChildren(), rb, body.Config.Funnel); + FunnelBuilder.Make(go, sector, rb, body.Config.Funnel); } // Has to go last probably