Do non detailed

This commit is contained in:
Nick 2023-08-04 21:15:28 -04:00
parent fba6b1ea36
commit 59980f8635
2 changed files with 32 additions and 15 deletions

View File

@ -13,7 +13,7 @@ namespace NewHorizons.Builder.Props
public static class GravityCannonBuilder public static class GravityCannonBuilder
{ {
private static GameObject _interfacePrefab; private static GameObject _interfacePrefab;
private static GameObject _platformPrefab; private static GameObject _detailedPlatformPrefab, _platformPrefab;
private static GameObject _orbPrefab; private static GameObject _orbPrefab;
internal static void InitPrefab() internal static void InitPrefab()
@ -25,23 +25,34 @@ namespace NewHorizons.Builder.Props
.Rename("Prefab_GravityCannon") .Rename("Prefab_GravityCannon")
.DontDestroyOnLoad(); .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 // 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"); 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() .InstantiateInactive()
.Rename("Prefab_GravityCannonPlatform") .Rename("Prefab_GravityCannonPlatform")
.DontDestroyOnLoad(); .DontDestroyOnLoad();
_platformPrefab.transform.position = original.transform.position; GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Collider").gameObject);
_platformPrefab.transform.rotation = original.transform.rotation; GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Crystals").gameObject);
GameObject.Destroy(_platformPrefab.transform.Find("Structure_NOM_GravityCannon_Geo").gameObject);
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");
} }
if (_orbPrefab == null) if (_orbPrefab == null)
@ -57,7 +68,7 @@ namespace NewHorizons.Builder.Props
{ {
InitPrefab(); 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 detailInfo = new DetailInfo(info.controls) { keepLoaded = true };
var gravityCannonObject = DetailBuilder.Make(planetGO, sector, _interfacePrefab, detailInfo); var gravityCannonObject = DetailBuilder.Make(planetGO, sector, _interfacePrefab, detailInfo);
@ -142,9 +153,9 @@ namespace NewHorizons.Builder.Props
return computer; 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<DirectionalForceVolume>(); gravityCannonController._forceVolume = platform.FindChild("ForceVolume").GetComponent<DirectionalForceVolume>();
gravityCannonController._platformTrigger = platform.FindChild("PlatformTrigger").GetComponent<OWTriggerVolume>(); gravityCannonController._platformTrigger = platform.FindChild("PlatformTrigger").GetComponent<OWTriggerVolume>();

View File

@ -2,6 +2,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text; using System.Text;
@ -27,6 +28,11 @@ namespace NewHorizons.External.Modules.Props.Shuttle
/// </summary> /// </summary>
public string launchReveal; public string launchReveal;
/// <summary>
/// Hide the lattice cage around the platform. Defaults to true.
/// </summary>
[DefaultValue(true)] public bool detailed = true;
/// <summary> /// <summary>
/// Will create a modern Nomai computer linked to this gravity cannon. /// Will create a modern Nomai computer linked to this gravity cannon.
/// </summary> /// </summary>