diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index c3969e90..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, 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,7 +166,10 @@ namespace NewHorizons.Builder.Body break; } - var sector = planetGO.GetComponent().GetPrimaryBody().GetRootSector(); + // 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?.GetComponent() != null) sector = primaryBody.GetRootSector(); + proxyGO.GetComponent().SetSector(sector); geoGO.GetComponent().SetSector(sector); volumesGO.GetComponent().SetSector(sector); diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 22ddba90..e0912246 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, go.GetComponentInChildren(), rb, body.Config.Funnel); + FunnelBuilder.Make(go, sector, rb, body.Config.Funnel); } // Has to go last probably