Make planets die in stars

This commit is contained in:
Nick 2022-03-20 22:22:39 -04:00
parent 9e05f5a49e
commit ff04a5d7b6
4 changed files with 11 additions and 3 deletions

View File

@ -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<DynamicFluidDetector>();
// Could copy the splash from the interloper
}
GravityVolume parentGravityVolume = primaryBody?.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
if (parentGravityVolume != null)
{

View File

@ -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<DynamicFluidDetector>();
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => fluidDetector._activeVolumes = new EffectVolume[] { body.GetComponentInChildren<RadialFluidVolume>() }.ToList());

View File

@ -14,7 +14,7 @@ namespace NewHorizons.Components
{
var detector = base.transform.GetComponentInChildren<DynamicForceDetector>();
var ao = base.GetComponent<AstroObject>();
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);
}

View File

@ -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; }