Merge branch 'fix-751' into prometheus

This commit is contained in:
xen-42 2025-01-06 21:37:45 -05:00
commit e701e21881
4 changed files with 25 additions and 2 deletions

View File

@ -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

View File

@ -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<SocketedQuantumObject>();
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<QuantumSocket>();
// TODO: support _alignWithGravity?
if (prop.GetComponentInChildren<VisibilityTracker>() == null)

View File

@ -53,6 +53,16 @@ namespace NewHorizons.External.Modules.Props
/// </summary>
public string quantumGroupID;
/// <summary>
/// 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.
/// </summary>
[DefaultValue(true)] public bool quantumRandomizeYRotation = true;
/// <summary>
/// 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).
/// </summary>
[DefaultValue(true)] public bool quantumAlignWithGravity = true;
/// <summary>
/// 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.

View File

@ -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."