From 657203d9ba21c969c6426ec557f95094a051a433 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 22 May 2022 12:30:10 -0400 Subject: [PATCH] Clean up tornado --- NewHorizons/Builder/Props/TornadoBuilder.cs | 2 +- NewHorizons/Components/TornadoFix.cs | 61 --------------------- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 NewHorizons/Components/TornadoFix.cs diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index d44281af..3bbe97c3 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -76,7 +76,7 @@ namespace NewHorizons.Builder.Props Logger.LogError($"Need either a position or an elevation for tornados"); return; } - info.type = "hurricane"; + if (info.type.ToLower() == "hurricane") MakeHurricane(planetGO, sector, info, position, hasClouds); else MakeTornado(planetGO, sector, info, position, info.type.ToLower() == "downwards"); } diff --git a/NewHorizons/Components/TornadoFix.cs b/NewHorizons/Components/TornadoFix.cs deleted file mode 100644 index a0283013..00000000 --- a/NewHorizons/Components/TornadoFix.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace NewHorizons.Components -{ - public class TornadoFix : SectoredMonoBehaviour - { - public TornadoController tornadoController; - - public new void Awake() - { - base.Awake(); - tornadoController = GetComponent(); - tornadoController._tornadoRoot.SetActive(false); - - tornadoController._formationDuration = 1f; - tornadoController._collapseDuration = 1f; - if (_sector != null) - { - _sector.OnOccupantEnterSector += OnOccupantEnterSector; - _sector.OnOccupantExitSector += OnOccupantExitSector; - } - } - - public new void SetSector(Sector sector) - { - if (_sector != null) - { - _sector.OnOccupantEnterSector -= OnOccupantEnterSector; - _sector.OnOccupantExitSector -= OnOccupantExitSector; - } - - base.SetSector(sector); - _sector.OnOccupantEnterSector += OnOccupantEnterSector; - _sector.OnOccupantExitSector += OnOccupantExitSector; - } - - public new void OnDestroy() - { - base.OnDestroy(); - _sector.OnOccupantEnterSector -= OnOccupantEnterSector; - _sector.OnOccupantExitSector -= OnOccupantExitSector; - } - - public void OnOccupantEnterSector(SectorDetector _) - { - // Only form if not active and not forming - if (tornadoController._tornadoRoot.activeInHierarchy || tornadoController._tornadoForming) return; - - tornadoController.StartFormation(); - } - - public void OnOccupantExitSector(SectorDetector _) - { - - if (_sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe | DynamicOccupant.Ship)) return; - - // If the root is inactive it has collapsed. Also don't collapse if we're already doing it - if (!tornadoController._tornadoRoot.activeInHierarchy || tornadoController._tornadoCollapsing) return; - - tornadoController.StartCollapse(); - } - } -}