diff --git a/NewHorizons/Builder/General/DetectorBuilder.cs b/NewHorizons/Builder/General/DetectorBuilder.cs index b0c143e6..96568a46 100644 --- a/NewHorizons/Builder/General/DetectorBuilder.cs +++ b/NewHorizons/Builder/General/DetectorBuilder.cs @@ -13,7 +13,7 @@ namespace NewHorizons.Builder.General { static class DetectorBuilder { - public static GameObject Make(GameObject body, OWRigidbody OWRB, AstroObject primaryBody, AstroObject astroObject, bool inherit = true) + public static GameObject Make(GameObject body, OWRigidbody OWRB, AstroObject primaryBody, AstroObject astroObject, bool inherit, bool destroyedBySun) { GameObject detectorGO = new GameObject("FieldDetector"); detectorGO.SetActive(false); @@ -25,6 +25,13 @@ namespace NewHorizons.Builder.General forceDetector.SetValue("_inheritElement0", inherit); OWRB.RegisterAttachedForceDetector(forceDetector); + // For falling into sun + if(destroyedBySun) + { + var fluidDetector = detectorGO.AddComponent(); + // Could copy the splash from the interloper + } + GravityVolume parentGravityVolume = primaryBody?.GetAttachedOWRigidbody()?.GetAttachedGravityVolume(); if (parentGravityVolume != null) { diff --git a/NewHorizons/Builder/Props/RaftBuilder.cs b/NewHorizons/Builder/Props/RaftBuilder.cs index ba1729f4..b033f902 100644 --- a/NewHorizons/Builder/Props/RaftBuilder.cs +++ b/NewHorizons/Builder/Props/RaftBuilder.cs @@ -80,7 +80,7 @@ namespace NewHorizons.Builder.Props StreamingManager.LoadStreamingAssets(child.assetBundle); } - var detectorGO = DetectorBuilder.Make(raftObject, owRigidBody, ao, null, false); + var detectorGO = DetectorBuilder.Make(raftObject, owRigidBody, ao, null, false, false); var fluidDetector = detectorGO.AddComponent(); Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => fluidDetector._activeVolumes = new EffectVolume[] { body.GetComponentInChildren() }.ToList()); diff --git a/NewHorizons/Components/MapSatelliteOrbitFix.cs b/NewHorizons/Components/MapSatelliteOrbitFix.cs index 2b4fca89..e348c1df 100644 --- a/NewHorizons/Components/MapSatelliteOrbitFix.cs +++ b/NewHorizons/Components/MapSatelliteOrbitFix.cs @@ -14,7 +14,7 @@ namespace NewHorizons.Components { var detector = base.transform.GetComponentInChildren(); var ao = base.GetComponent(); - var newDetector = DetectorBuilder.Make(base.gameObject, ao.GetAttachedOWRigidbody(), ao.GetPrimaryBody(), ao); + var newDetector = DetectorBuilder.Make(base.gameObject, ao.GetAttachedOWRigidbody(), ao.GetPrimaryBody(), ao, true, false); newDetector.transform.parent = detector.transform.parent; GameObject.Destroy(detector); } diff --git a/NewHorizons/External/BaseModule.cs b/NewHorizons/External/BaseModule.cs index 3557db1b..7f735305 100644 --- a/NewHorizons/External/BaseModule.cs +++ b/NewHorizons/External/BaseModule.cs @@ -22,6 +22,7 @@ namespace NewHorizons.External public bool CenterOfSolarSystem { get; set; } = false; public bool IsSatellite { get; set; } public float CloakRadius { get; set; } = 0f; + public bool InvulnerableToSun { get; set; } // Old, see SingularityModule instead public float BlackHoleSize { get; set; }