diff --git a/NewHorizons/Builder/Props/PropBuildManager.cs b/NewHorizons/Builder/Props/PropBuildManager.cs index 94c95afc..8336d842 100644 --- a/NewHorizons/Builder/Props/PropBuildManager.cs +++ b/NewHorizons/Builder/Props/PropBuildManager.cs @@ -12,6 +12,7 @@ using OWML.Common; using System; using System.Collections.Generic; using System.Linq; +using NewHorizons.External.Modules.Props; using UnityEngine; namespace NewHorizons.Builder.Props @@ -164,13 +165,13 @@ namespace NewHorizons.Builder.Props if (config.Props.quantumGroups != null) { - var propsByGroup = new Dictionary>(); + var propsByGroup = new Dictionary>(); foreach (var detail in config.Props.details) { if (detail.quantumGroupID != null) { - if (!propsByGroup.ContainsKey(detail.quantumGroupID)) propsByGroup[detail.quantumGroupID] = new List<(GameObject go, bool randomizeYRotation)>(); - propsByGroup[detail.quantumGroupID].Add((DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail), detail.quantumRandomizeYRotation)); + if (!propsByGroup.ContainsKey(detail.quantumGroupID)) propsByGroup[detail.quantumGroupID] = new List<(GameObject go, DetailInfo detail)>(); + propsByGroup[detail.quantumGroupID].Add((DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail), detail)); } } diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 39b49a59..862007ff 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -6,6 +6,7 @@ using NewHorizons.Utility.OWML; using OWML.Common; using System.Collections.Generic; using System.Linq; +using NewHorizons.External.Modules.Props; using UnityEngine; namespace NewHorizons.Builder.Props @@ -13,7 +14,7 @@ namespace NewHorizons.Builder.Props public static class QuantumBuilder { - public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, (GameObject go, bool randomizeY)[] propsInGroup) + public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, (GameObject go, DetailInfo detail)[] propsInGroup) { switch (quantumGroup.type) { @@ -25,15 +26,13 @@ namespace NewHorizons.Builder.Props // 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 go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, (GameObject go, bool randomizeY)[] propsInGroup) + public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, (GameObject go, DetailInfo detail)[] propsInGroup) { var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id); groupRoot.transform.parent = sector?.transform ?? go.transform; groupRoot.transform.localPosition = Vector3.zero; groupRoot.transform.localEulerAngles = Vector3.zero; - var useSocketRotation = quantumGroup.sockets.All(x => x.rotation != null); - var sockets = new QuantumSocket[quantumGroup.sockets.Length]; for (int i = 0; i < quantumGroup.sockets.Length; i++) { @@ -54,9 +53,9 @@ namespace NewHorizons.Builder.Props quantumObject._socketList = sockets.ToList(); quantumObject._sockets = sockets; quantumObject._prebuilt = true; - quantumObject._alignWithSocket = useSocketRotation; - quantumObject._randomYRotation = prop.randomizeY; - quantumObject._alignWithGravity = !useSocketRotation; + quantumObject._alignWithSocket = !prop.detail.quantumAlignWithGravity; + quantumObject._randomYRotation = prop.detail.quantumRandomizeYRotation; + quantumObject._alignWithGravity = prop.detail.quantumAlignWithGravity; quantumObject._childSockets = new List(); if (prop.go.GetComponentInChildren() == null) AddBoundsVisibility(prop.go); prop.go.SetActive(true); diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 18193267..e273ac88 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -58,6 +58,11 @@ namespace NewHorizons.External.Modules.Props /// [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.