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 // 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"); var dimensionSector = SearchUtilities.FindChild(dimension, "Sector_HubDimension");
dimensionSector.name = "Sector"; dimensionSector.name = "Sector";
var atmo = SearchUtilities.FindChild(dimension, "Atmosphere_HubDimension"); var atmo = SearchUtilities.FindChild(dimensionSector, "Atmosphere_HubDimension");
var geom = SearchUtilities.FindChild(dimension, "Geometry_HubDimension"); var geom = SearchUtilities.FindChild(dimensionSector, "Geometry_HubDimension");
var vols = SearchUtilities.FindChild(dimension, "Volumes_HubDimension"); var vols = SearchUtilities.FindChild(dimensionSector, "Volumes_HubDimension");
var efxs = SearchUtilities.FindChild(dimension, "Effects_HubDimension"); var efxs = SearchUtilities.FindChild(dimensionSector, "Effects_HubDimension");
var intr = SearchUtilities.FindChild(dimension, "Interactables_HubDimension"); var intr = SearchUtilities.FindChild(dimensionSector, "Interactables_HubDimension");
var exitWarps = SearchUtilities.FindChild(intr, "OuterWarp_Hub"); var exitWarps = SearchUtilities.FindChild(intr, "OuterWarp_Hub");
exitWarps.name = "OuterWarp"; exitWarps.name = "OuterWarp";
@ -66,8 +66,9 @@ namespace NewHorizons.Builder.Body
intr.name = "Interactibles"; intr.name = "Interactibles";
GameObject.Destroy(intr); GameObject.Destroy(intr);
exitWarps.GetComponent<OuterFogWarpVolume>()._senderWarps.Clear(); var outerFogWarpVolume = exitWarps.GetComponent<OuterFogWarpVolume>();
exitWarps.GetComponent<OuterFogWarpVolume>()._linkedInnerWarpVolume = null; outerFogWarpVolume._senderWarps.Clear();
outerFogWarpVolume._linkedInnerWarpVolume = null;
// TODO MAYBE: set "exitWarps/ExitPoint", "exitWarp/ExitPoint (1)", ... "exitWarp/ExitPoint (5)" // 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 System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using static NewHorizons.External.Modules.BrambleModule; using static NewHorizons.External.Modules.BrambleModule;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
@ -20,6 +21,9 @@ namespace NewHorizons.Builder.Props
public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null, BrambleDimensionInfo dimensionInfo = null) 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) // pair node->dimension (entrances)
if (unpairedNodes.ContainsKey(dimensionName)) if (unpairedNodes.ContainsKey(dimensionName))
{ {
@ -92,6 +96,7 @@ namespace NewHorizons.Builder.Props
var brambleNodePrefabPath = "DB_HubDimension_Body/Sector_HubDimension/Interactables_HubDimension/InnerWarp_ToCluster"; 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); 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 // this node comes with Feldspar's signal, we don't want that though
GameObject.Destroy(SearchUtilities.FindChild(brambleNode, "Signal_Harmonica")); GameObject.Destroy(SearchUtilities.FindChild(brambleNode, "Signal_Harmonica"));
@ -138,7 +143,6 @@ namespace NewHorizons.Builder.Props
// TODO: support adding signals to these nodes // TODO: support adding signals to these nodes
// //
// Done! // Done!
return brambleNode; return brambleNode;
} }

View File

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