From 83d635e4001ebf2a0bff590b43b2233a6c5a19b2 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 10 Aug 2022 16:57:16 -0400 Subject: [PATCH] Scale planet destruction volume too --- NewHorizons/Builder/Body/StarBuilder.cs | 2 ++ .../SizeControllers/StarEvolutionController.cs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 829be8e0..a3372832 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -144,6 +144,8 @@ namespace NewHorizons.Builder.Body controller.WillExplode = starModule.goSupernova; controller.lifespan = starModule.lifespan; controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp; + controller._destructionVolume = deathVolume.GetComponent(); + controller._planetDestructionVolume = planetDestructionVolume.GetComponent(); if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture)) { controller.collapseRamp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture); diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 26d0e283..7bc9474f 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -28,7 +28,8 @@ namespace NewHorizons.Components.SizeControllers private PlanetaryFogController _fog; private MeshRenderer[] _atmosphereRenderers; private HeatHazardVolume _heatVolume; - private DestructionVolume _destructionVolume; + public DestructionVolume _destructionVolume; + public DestructionVolume _planetDestructionVolume; private SolarFlareEmitter _flareEmitter; private MapMarker _mapMarker; private OWRigidbody _rigidbody; @@ -119,7 +120,7 @@ namespace NewHorizons.Components.SizeControllers } _heatVolume = GetComponentInChildren(); - _destructionVolume = GetComponentInChildren(); + if (_destructionVolume != null) _destructionVolume = GetComponentInChildren(); if (atmosphere != null) { @@ -222,6 +223,7 @@ namespace NewHorizons.Components.SizeControllers // Make the destruction volume scale slightly smaller so you really have to be in the supernova to die if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f; + if (_planetDestructionVolume != null) _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f; if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius(); if (Time.time > _supernovaStartTime + 45f) @@ -290,6 +292,7 @@ namespace NewHorizons.Components.SizeControllers _supernovaStartTime = Time.time; if (atmosphere != null) atmosphere.SetActive(false); if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova; + if (_planetDestructionVolume != null) _planetDestructionVolume._deathType = DeathType.Supernova; if (_proxy != null) _proxy.StartSupernova(); } @@ -308,6 +311,11 @@ namespace NewHorizons.Components.SizeControllers _destructionVolume._deathType = DeathType.Energy; _destructionVolume.transform.localScale = Vector3.one; } + if (_planetDestructionVolume != null) + { + _planetDestructionVolume._deathType = DeathType.Energy; + _planetDestructionVolume.transform.localScale = Vector3.one; + } if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one; gameObject.SetActive(true); transform.localScale = Vector3.one;