added scale for both nodes and dimensions, added default values to config

This commit is contained in:
FreezeDriedMangoes 2022-06-30 18:56:11 -04:00
parent 28c4ba1591
commit 738208e584
3 changed files with 21 additions and 28 deletions

View File

@ -13,6 +13,8 @@ namespace NewHorizons.Builder.Body
{ {
public static class BrambleDimensionBuilder public static class BrambleDimensionBuilder
{ {
public static readonly float BASE_DIMENSION_RADIUS = 1705f;
// put node here // put node here
// "position": {"x": 65.2428, "y": -137.305, "z": 198.1078}, "normal": {"x": 0.303696, "y": -0.5609235, "z": 0.7701519} // "position": {"x": 65.2428, "y": -137.305, "z": 198.1078}, "normal": {"x": 0.303696, "y": -0.5609235, "z": 0.7701519}
@ -53,7 +55,9 @@ namespace NewHorizons.Builder.Body
ao.transform.position = new Vector3(6904.48f, 17048.44f, 5574.479f) + new Vector3(0, 3000, 0)*DIMENSION_COUNTER; ao.transform.position = new Vector3(6904.48f, 17048.44f, 5574.479f) + new Vector3(0, 3000, 0)*DIMENSION_COUNTER;
DIMENSION_COUNTER++; DIMENSION_COUNTER++;
// TODO: radius (need to determine what the base radius is first) // radius
//if (body.Config.Bramble.dimension.radius != null)
ao.transform.localScale = Vector3.one * (body.Config.Bramble.dimension.radius/BASE_DIMENSION_RADIUS);
// 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");

View File

@ -154,6 +154,10 @@ namespace NewHorizons.Builder.Props
var destinationAO = dimensionAO ?? AstroObjectLocator.GetAstroObject(destinationName); // find child "Sector/OuterWarp" var destinationAO = dimensionAO ?? AstroObjectLocator.GetAstroObject(destinationName); // find child "Sector/OuterWarp"
if (destinationAO == null) return false; if (destinationAO == null) return false;
//
// TODO: support adding destinationAO's signals to these nodes
//
var destination = GetOuterFogWarpVolumeFromAstroObject(destinationAO.gameObject); var destination = GetOuterFogWarpVolumeFromAstroObject(destinationAO.gameObject);
if (destination == null) return false; if (destination == null) return false;
@ -191,15 +195,20 @@ namespace NewHorizons.Builder.Props
GameObject.Destroy(SearchUtilities.FindChild(brambleNode, "Signal_Harmonica")); GameObject.Destroy(SearchUtilities.FindChild(brambleNode, "Signal_Harmonica"));
// //
// TODO: change the colors // set scale
//
brambleNode.transform.localScale = Vector3.one * config.scale;
//
// change the colors
// //
var effects = SearchUtilities.FindChild(brambleNode, "Effects"); var effects = SearchUtilities.FindChild(brambleNode, "Effects");
var fogRenderer = SearchUtilities.FindChild(effects, "InnerWarpFogSphere").GetComponent<OWRenderer>(); var fogRenderer = SearchUtilities.FindChild(effects, "InnerWarpFogSphere").GetComponent<OWRenderer>();
var lightShafts = SearchUtilities.FindChild(effects, "DB_BrambleLightShafts"); var lightShafts = SearchUtilities.FindChild(effects, "DB_BrambleLightShafts");
if (config.fogTint != null) fogRenderer.SetColor(config.fogTint.ToColor()); // TODO: this doesn't seem to work, but it does work in inspector
if (config.fogTint != null) fogRenderer.SetColor(config.fogTint.ToColor());
if (config.lightTint != null) if (config.lightTint != null)
{ {
var lightShaft1 = SearchUtilities.FindChild(lightShafts, "BrambleLightShaft1"); var lightShaft1 = SearchUtilities.FindChild(lightShafts, "BrambleLightShaft1");
@ -226,27 +235,6 @@ namespace NewHorizons.Builder.Props
warpController.Awake(); // I can't spawn this game object disabled, but Awake needs to run after _sector is set. That means I need to call Awake myself warpController.Awake(); // I can't spawn this game object disabled, but Awake needs to run after _sector is set. That means I need to call Awake myself
//var exitPointsParent = SearchUtilities.FindChild(brambleNode, "FogWarpExitPoints"); // "ExitPoint", "ExitPoint (1)" ... "ExitPoint (5)"
//var exitPointsNames = new string[]
//{
// "ExitPoint",
// "ExitPoint (1)",
// "ExitPoint (2)",
// "ExitPoint (3)",
// "ExitPoint (4)",
// "ExitPoint (5)",
//};
//for (int i = 0; i < 6; i++)
//{
// var exitPoint = SearchUtilities.FindChild(exitPointsParent, exitPointsNames[i]);
// var sphericalFogWarpExit = exitPoint.GetComponent<SphericalFogWarpExit>();
// // I don't think anything actually needs to be done here
//}
//
// TODO: support adding signals to these nodes
//
// //
// Cleanup for dimension exits // Cleanup for dimension exits
// //

View File

@ -2,6 +2,7 @@ using NewHorizons.Utility;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -29,7 +30,7 @@ namespace NewHorizons.External.Modules
/// <summary> /// <summary>
/// Defines the inner radius of this dimension. Leave blank for the default of /// Defines the inner radius of this dimension. Leave blank for the default of
/// </summary> /// </summary>
public float radius; [DefaultValue(1705f)] public float radius = 1705f;
/// <summary> /// <summary>
/// The color of the fog inside this dimension. Leave blank for the default yellowish color /// The color of the fog inside this dimension. Leave blank for the default yellowish color
@ -59,7 +60,7 @@ namespace NewHorizons.External.Modules
/// <summary> /// <summary>
/// The physical scale of the node /// The physical scale of the node
/// </summary> /// </summary>
public float scale; [DefaultValue(1f)] public float scale = 1f;
/// <summary> /// <summary>
/// The name of the planet that hosts the dimension this node links to /// The name of the planet that hosts the dimension this node links to
@ -74,7 +75,7 @@ namespace NewHorizons.External.Modules
/// <summary> /// <summary>
/// Set this to true to make this node a seed instead of a node the player can enter /// Set this to true to make this node a seed instead of a node the player can enter
/// </summary> /// </summary>
public bool isSeed; [DefaultValue(false)] public bool isSeed = false;
/// <summary> /// <summary>
/// The color of the fog inside the node. Leave blank for the default yellowish color /// The color of the fog inside the node. Leave blank for the default yellowish color