diff --git a/NewHorizons/Builder/Props/PropBuildManager.cs b/NewHorizons/Builder/Props/PropBuildManager.cs index cb889884..ada91088 100644 --- a/NewHorizons/Builder/Props/PropBuildManager.cs +++ b/NewHorizons/Builder/Props/PropBuildManager.cs @@ -14,6 +14,7 @@ using OWML.Common; using System; using System.Collections.Generic; using System.Linq; +using NewHorizons.External.Modules.Props; using UnityEngine; namespace NewHorizons.Builder.Props diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index b1144fe0..461b06d5 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -8,6 +8,7 @@ using NewHorizons.Utility.OWML; using System; using System.Collections.Generic; using System.Linq; +using NewHorizons.External.Modules.Props; using UnityEngine; namespace NewHorizons.Builder.Props @@ -110,7 +111,6 @@ namespace NewHorizons.Builder.Props lightning.SetActive(true); } - // TODO: Socket groups that have an equal number of props and sockets // Nice to have: socket groups that specify a filledSocketObject and an emptySocketObject (eg the archway in the giant's deep tower) public static void MakeSocketGroup(GameObject planetGO, Sector sector, SocketQuantumGroupInfo quantumGroup, GameObject[] propsInGroup) { @@ -144,12 +144,14 @@ namespace NewHorizons.Builder.Props foreach (var prop in propsInGroup) { prop.SetActive(false); - var quantumObject = prop.AddComponent(); quantumObject._socketRoot = groupRoot; quantumObject._socketList = sockets.ToList(); quantumObject._sockets = sockets; quantumObject._prebuilt = true; + quantumObject._alignWithSocket = !prop.detail.quantumAlignWithGravity; + quantumObject._randomYRotation = prop.detail.quantumRandomizeYRotation; + quantumObject._alignWithGravity = prop.detail.quantumAlignWithGravity; quantumObject._childSockets = new List(); // TODO: support _alignWithGravity? if (prop.GetComponentInChildren() == null) diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 9cc8feb0..e273ac88 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -53,6 +53,16 @@ namespace NewHorizons.External.Modules.Props /// public string quantumGroupID; + /// + /// If this prop is quantum, and the quantum group is socketed, this field determines whether the prop will randomly choose a Y rotation when moving to a socket. + /// + [DefaultValue(true)] public bool quantumRandomizeYRotation = true; + + /// + /// If this prop is quantum, and the quantum group is socketed, this field determines whether the prop will align with the GravityVolume (true) or align with the current socket (false). + /// + [DefaultValue(true)] public bool quantumAlignWithGravity = true; + /// /// Should this detail stay loaded (visible and collideable) even if you're outside the sector (good for very large props)? /// Also makes this detail visible on the map. diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 3f308209..009404ee 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1472,6 +1472,16 @@ "type": "string", "description": "If this value is not null, this prop will be quantum. Assign this field to the id of the quantum group it should be a part of. The group it is assigned to determines what kind of quantum object it is" }, + "quantumRandomizeYRotation": { + "type": "boolean", + "description": "If this prop is quantum, and the quantum group is socketed, this field determines whether the prop will randomly choose a Y rotation when moving to a socket.", + "default": true + }, + "quantumAlignWithGravity": { + "type": "boolean", + "description": "If this prop is quantum, and the quantum group is socketed, this field determines whether the prop will align with the GravityVolume (true) or align with the current socket (false).", + "default": true + }, "keepLoaded": { "type": "boolean", "description": "Should this detail stay loaded (visible and collideable) even if you're outside the sector (good for very large props)?\nAlso makes this detail visible on the map.\nKeeping many props loaded is bad for performance so use this only when it's actually relevant\nMost logic/behavior scripts will still only work inside the sector, as most of those scripts break if a sector is not provided."