fixed some searches for children that were looking in the wrong gameobject

This commit is contained in:
FreezeDriedMangoes 2022-06-30 09:42:06 -04:00
parent dbc36bbfc7
commit 411020378e
3 changed files with 19 additions and 11 deletions

View File

@ -50,11 +50,11 @@ namespace NewHorizons.Builder.Body
// fix children's names and remove base game props (mostly just bramble nodes that are children to Interactibles) and set up the OuterWarp child
var dimensionSector = SearchUtilities.FindChild(dimension, "Sector_HubDimension");
dimensionSector.name = "Sector";
var atmo = SearchUtilities.FindChild(dimension, "Atmosphere_HubDimension");
var geom = SearchUtilities.FindChild(dimension, "Geometry_HubDimension");
var vols = SearchUtilities.FindChild(dimension, "Volumes_HubDimension");
var efxs = SearchUtilities.FindChild(dimension, "Effects_HubDimension");
var intr = SearchUtilities.FindChild(dimension, "Interactables_HubDimension");
var atmo = SearchUtilities.FindChild(dimensionSector, "Atmosphere_HubDimension");
var geom = SearchUtilities.FindChild(dimensionSector, "Geometry_HubDimension");
var vols = SearchUtilities.FindChild(dimensionSector, "Volumes_HubDimension");
var efxs = SearchUtilities.FindChild(dimensionSector, "Effects_HubDimension");
var intr = SearchUtilities.FindChild(dimensionSector, "Interactables_HubDimension");
var exitWarps = SearchUtilities.FindChild(intr, "OuterWarp_Hub");
exitWarps.name = "OuterWarp";
@ -66,8 +66,9 @@ namespace NewHorizons.Builder.Body
intr.name = "Interactibles";
GameObject.Destroy(intr);
exitWarps.GetComponent<OuterFogWarpVolume>()._senderWarps.Clear();
exitWarps.GetComponent<OuterFogWarpVolume>()._linkedInnerWarpVolume = null;
var outerFogWarpVolume = exitWarps.GetComponent<OuterFogWarpVolume>();
outerFogWarpVolume._senderWarps.Clear();
outerFogWarpVolume._linkedInnerWarpVolume = null;
// TODO MAYBE: set "exitWarps/ExitPoint", "exitWarp/ExitPoint (1)", ... "exitWarp/ExitPoint (5)"

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using static NewHorizons.External.Modules.BrambleModule;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props
{
@ -20,6 +21,9 @@ namespace NewHorizons.Builder.Props
public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null, BrambleDimensionInfo dimensionInfo = null)
{
Logger.Log("Pairing for " + dimensionName);
// TODO: I might need to call this on Make: InnerFogWarpVolume.OnOccupantEnterSector
// pair node->dimension (entrances)
if (unpairedNodes.ContainsKey(dimensionName))
{
@ -92,7 +96,8 @@ namespace NewHorizons.Builder.Props
var brambleNodePrefabPath = "DB_HubDimension_Body/Sector_HubDimension/Interactables_HubDimension/InnerWarp_ToCluster";
var brambleNode = DetailBuilder.MakeDetail(go, sector, brambleNodePrefabPath, config.position, config.rotation, config.scale, false);
brambleNode.name = "Bramble Node to " + config.linksTo;
// this node comes with Feldspar's signal, we don't want that though
GameObject.Destroy(SearchUtilities.FindChild(brambleNode, "Signal_Harmonica"));
@ -137,7 +142,6 @@ namespace NewHorizons.Builder.Props
//
// TODO: support adding signals to these nodes
//
// Done!
return brambleNode;

View File

@ -221,8 +221,9 @@ namespace NewHorizons.Handlers
{
GameObject planetObject = GenerateBody(body, defaultPrimaryToSun);
if (planetObject == null) return false;
planetObject.SetActive(true);
_dict.Add(planetObject.GetComponent<NHAstroObject>(), body);
planetObject.SetActive(true);
var nhAO = planetObject.GetComponent<NHAstroObject>();
if (nhAO != null) _dict.Add(nhAO, body);
}
catch (Exception e)
{
@ -289,6 +290,8 @@ namespace NewHorizons.Handlers
AstroObjectLocator.RegisterCustomAstroObject(ao);
}
Logger.Log($"returning GO named {go.name}");
return go;
}