From 59980f8635fe0b2dcbfcc61b683e89a739158716 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 4 Aug 2023 21:15:28 -0400 Subject: [PATCH] Do non detailed --- .../Builder/Props/GravityCannonBuilder.cs | 41 ++++++++++++------- .../Props/Shuttle/GravityCannonInfo.cs | 6 +++ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/NewHorizons/Builder/Props/GravityCannonBuilder.cs b/NewHorizons/Builder/Props/GravityCannonBuilder.cs index 39ae8bdf..54d5ce5b 100644 --- a/NewHorizons/Builder/Props/GravityCannonBuilder.cs +++ b/NewHorizons/Builder/Props/GravityCannonBuilder.cs @@ -13,7 +13,7 @@ namespace NewHorizons.Builder.Props public static class GravityCannonBuilder { private static GameObject _interfacePrefab; - private static GameObject _platformPrefab; + private static GameObject _detailedPlatformPrefab, _platformPrefab; private static GameObject _orbPrefab; internal static void InitPrefab() @@ -25,23 +25,34 @@ namespace NewHorizons.Builder.Props .Rename("Prefab_GravityCannon") .DontDestroyOnLoad(); } - if (_platformPrefab == null) + if (_detailedPlatformPrefab == null) { // Creating it in the original position so we can instantiate the other parts in the right relative positions var original = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Geometry_GravityCannon/ControlledByProxy_OPC/Structure_NOM_GravityCannon_BH"); - _platformPrefab = original + _detailedPlatformPrefab = original + .InstantiateInactive() + .Rename("Prefab_GravityCannonPlatform_Detailed") + .DontDestroyOnLoad(); + _detailedPlatformPrefab.transform.position = original.transform.position; + _detailedPlatformPrefab.transform.rotation = original.transform.rotation; + + GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Interactables_GravityCannon/Prefab_NOM_ShuttleSocket"), _detailedPlatformPrefab.transform, true) + .Rename("ShuttleSocket"); + GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Interactables_GravityCannon/CannonForceVolume"), _detailedPlatformPrefab.transform, true) + .Rename("ForceVolume"); + GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Volumes_GravityCannon/CannonPlatformTrigger"), _detailedPlatformPrefab.transform, true) + .Rename("PlatformTrigger"); + } + + if (_platformPrefab == null) + { + _platformPrefab = _detailedPlatformPrefab .InstantiateInactive() .Rename("Prefab_GravityCannonPlatform") .DontDestroyOnLoad(); - _platformPrefab.transform.position = original.transform.position; - _platformPrefab.transform.rotation = original.transform.rotation; - - GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Interactables_GravityCannon/Prefab_NOM_ShuttleSocket"), _platformPrefab.transform, true) - .Rename("ShuttleSocket"); - GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Interactables_GravityCannon/CannonForceVolume"), _platformPrefab.transform, true) - .Rename("ForceVolume"); - GameObject.Instantiate(SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_GravityCannon/Volumes_GravityCannon/CannonPlatformTrigger"), _platformPrefab.transform, true) - .Rename("PlatformTrigger"); + GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Collider").gameObject); + GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Crystals").gameObject); + GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Geo").gameObject); } if (_orbPrefab == null) @@ -57,7 +68,7 @@ namespace NewHorizons.Builder.Props { InitPrefab(); - if (_interfacePrefab == null || planetGO == null || sector == null || _platformPrefab == null || _orbPrefab == null) return null; + if (_interfacePrefab == null || planetGO == null || sector == null || _detailedPlatformPrefab == null || _platformPrefab == null || _orbPrefab == null) return null; var detailInfo = new DetailInfo(info.controls) { keepLoaded = true }; var gravityCannonObject = DetailBuilder.Make(planetGO, sector, _interfacePrefab, detailInfo); @@ -142,9 +153,9 @@ namespace NewHorizons.Builder.Props return computer; } - private static GameObject CreatePlatform(GameObject planetGO, Sector sector, GravityCannonController gravityCannonController, GeneralPropInfo platformInfo) + private static GameObject CreatePlatform(GameObject planetGO, Sector sector, GravityCannonController gravityCannonController, GravityCannonInfo platformInfo) { - var platform = DetailBuilder.Make(planetGO, sector, _platformPrefab, new DetailInfo(platformInfo) { keepLoaded = true }); + var platform = DetailBuilder.Make(planetGO, sector, platformInfo.detailed ? _detailedPlatformPrefab : _platformPrefab, new DetailInfo(platformInfo) { keepLoaded = true }); gravityCannonController._forceVolume = platform.FindChild("ForceVolume").GetComponent(); gravityCannonController._platformTrigger = platform.FindChild("PlatformTrigger").GetComponent(); diff --git a/NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs b/NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs index 1e296f60..ffdcb0de 100644 --- a/NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs +++ b/NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Runtime.Serialization; using System.Text; @@ -27,6 +28,11 @@ namespace NewHorizons.External.Modules.Props.Shuttle /// public string launchReveal; + /// + /// Hide the lattice cage around the platform. Defaults to true. + /// + [DefaultValue(true)] public bool detailed = true; + /// /// Will create a modern Nomai computer linked to this gravity cannon. ///