use planet sector if no primary body

This commit is contained in:
Noah Pilarski 2023-01-22 18:00:42 -05:00
parent 53ea4a055d
commit 7ebfd1ebf6
2 changed files with 5 additions and 3 deletions

View File

@ -34,7 +34,7 @@ namespace NewHorizons.Builder.Body
if (_lavaMaterial == null) _lavaMaterial = new Material(SearchUtilities.Find("VolcanicMoon_Body/MoltenCore_VM/LavaSphere").GetComponent<MeshRenderer>().sharedMaterial).DontDestroyOnLoad(); if (_lavaMaterial == null) _lavaMaterial = new Material(SearchUtilities.Find("VolcanicMoon_Body/MoltenCore_VM/LavaSphere").GetComponent<MeshRenderer>().sharedMaterial).DontDestroyOnLoad();
} }
public static void Make(GameObject planetGO, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module) public static void Make(GameObject planetGO, Sector sector, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module)
{ {
InitPrefabs(); InitPrefabs();
@ -165,7 +165,9 @@ namespace NewHorizons.Builder.Body
break; break;
} }
var sector = planetGO.GetComponent<AstroObject>().GetPrimaryBody().GetRootSector(); var primaryBody = planetGO.GetComponent<AstroObject>().GetPrimaryBody();
if (primaryBody != null) sector = primaryBody.GetRootSector();
proxyGO.GetComponent<SectorProxy>().SetSector(sector); proxyGO.GetComponent<SectorProxy>().SetSector(sector);
geoGO.GetComponent<SectorCullGroup>().SetSector(sector); geoGO.GetComponent<SectorCullGroup>().SetSector(sector);
volumesGO.GetComponent<SectorCollisionGroup>().SetSector(sector); volumesGO.GetComponent<SectorCollisionGroup>().SetSector(sector);

View File

@ -638,7 +638,7 @@ namespace NewHorizons.Handlers
if (body.Config.Funnel != null) if (body.Config.Funnel != null)
{ {
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel); FunnelBuilder.Make(go, sector, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel);
} }
// Has to go last probably // Has to go last probably