diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 4f0ed2ed..60414c00 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -25,9 +25,7 @@ namespace NewHorizons.Builder.Body //-11096.95 -22786.44 4657.534 //-8716.807 -22786.44 4496.394 - private static int DIMENSION_COUNTER = 0; - // keys are all node names that have been referenced as an exit by at least one dimension but do not (yet) exist // values are all dimensions' warp controllers that link to a given dimension // unpairedNodes[name of node that doesn't exist yet] => List{warp controller for dimension that exits to that node, ...} @@ -49,8 +47,7 @@ namespace NewHorizons.Builder.Body dimension.name = name.Replace(" ", "").Replace("'", "") + "_Body"; // set position - ao.transform.position = new Vector3(6904.48f, 17048.44f, 5574.479f) + new Vector3(0, 3000, 0)*DIMENSION_COUNTER; - DIMENSION_COUNTER++; + ao.transform.position = body.Config.Orbit.staticPosition; // 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"); diff --git a/NewHorizons/External/Modules/OrbitModule.cs b/NewHorizons/External/Modules/OrbitModule.cs index 7438b841..c56ed87c 100644 --- a/NewHorizons/External/Modules/OrbitModule.cs +++ b/NewHorizons/External/Modules/OrbitModule.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using NewHorizons.Components.Orbital; using NewHorizons.Utility; @@ -8,7 +8,12 @@ namespace NewHorizons.External.Modules { [JsonObject] public class OrbitModule : IOrbitalParameters - { + { + /// + /// Specify this if you want the body to remain stationary at a given location (ie not orbit its parent). Required for Bramble dimensions + /// + public MVector3 staticPosition; + /// /// The name of the body this one will orbit around /// diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 32b5cfe9..7b6f4fb8 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -268,6 +268,12 @@ namespace NewHorizons.Handlers { if (body.Config?.Bramble?.dimension != null) { + if (body.Config?.Orbit?.staticPosition == null) + { + Logger.LogError($"Unable to build bramble dimension {body.Config?.name} because it does not have Orbit.staticPosition defined."); + return null; + } + return GenerateBrambleDimensionBody(body); } else @@ -378,6 +384,10 @@ namespace NewHorizons.Handlers if (!body.Config.Orbit.isStatic) { DetectorBuilder.Make(go, owRigidBody, primaryBody, ao, body.Config); + } + else if (body.Config.Orbit.staticPosition != null) + { + ao.transform.position = body.Config.Orbit.staticPosition; } if (ao.GetAstroObjectName() == AstroObject.Name.CustomString)