Make this branch actually build again

This commit is contained in:
xen-42 2025-01-06 17:21:32 -05:00
parent 06eea16188
commit 3b19c81b42
6 changed files with 51 additions and 37 deletions

View File

@ -13,7 +13,7 @@ using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.InputSystem;
using static NewHorizons.Main;
using static NewHorizons.Utility.Files.AssetBundleUtilities;
namespace NewHorizons.Builder.Props
{
@ -543,12 +543,12 @@ namespace NewHorizons.Builder.Props
if (useInvertedCache && cacheExists)
{
// Load the inverted images used when displaying slide reels to a screen
invertedImageLoader.PathsToLoad.Add((i, Path.Combine(Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/inverted_blank_slide_reel.png")));
invertedImageLoader.PathsToLoad.Add((i, Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/inverted_blank_slide_reel.png")));
}
else
{
// Used to then make cached stuff
imageLoader.PathsToLoad.Add((i, Path.Combine(Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/blank_slide_reel.png")));
imageLoader.PathsToLoad.Add((i, Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/blank_slide_reel.png")));
}
}
else

View File

@ -6,6 +6,7 @@ using NewHorizons.Builder.ShipLog;
using NewHorizons.External;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.External.Modules.Props.Quantum;
using NewHorizons.Utility;
using NewHorizons.Utility.OWML;
using OWML.Common;
@ -162,25 +163,25 @@ namespace NewHorizons.Builder.Props
}
}
if (config.Props.quantumGroups != null)
{
var propsByGroup = new Dictionary<string, List<GameObject>>();
foreach (var detail in config.Props.details)
var quantumPropsByGroup = new Dictionary<string, List<GameObject>>();
foreach (var detail in config.Props?.details)
{
if (detail.quantumGroupID != null)
{
if (!propsByGroup.ContainsKey(detail.quantumGroupID))
if (!quantumPropsByGroup.ContainsKey(detail.quantumGroupID))
{
propsByGroup[detail.quantumGroupID] = new List<GameObject>();
quantumPropsByGroup[detail.quantumGroupID] = new List<GameObject>();
}
propsByGroup[detail.quantumGroupID].Add(DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail));
quantumPropsByGroup[detail.quantumGroupID].Add(DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail));
}
}
foreach (var quantumGroup in config.Props.quantumGroups)
void MakeQuantumGroup(BaseQuantumGroupInfo[] group)
{
if (!propsByGroup.ContainsKey(quantumGroup.id)) continue;
var propsInGroup = propsByGroup[quantumGroup.id];
foreach (var quantumGroup in group)
{
if (!quantumPropsByGroup.ContainsKey(quantumGroup.id)) continue;
var propsInGroup = quantumPropsByGroup[quantumGroup.id];
try
{
@ -192,6 +193,16 @@ namespace NewHorizons.Builder.Props
}
}
}
if (config.Props.socketQuantumGroups != null)
{
MakeQuantumGroup(config.Props.socketQuantumGroups);
}
if (config.Props.stateQuantumGroups != null)
{
MakeQuantumGroup(config.Props.stateQuantumGroups);
}
}
private static bool _ignoreParent;

View File

@ -1,6 +1,9 @@
using NewHorizons.Components.Quantum;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules.Props.Quantum;
using NewHorizons.Utility.Geometry;
using NewHorizons.Utility.OWML;
using OWML.Common;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
@ -9,21 +12,15 @@ namespace NewHorizons.Builder.Props
{
public static class QuantumBuilder
{
public static void Make(GameObject planetGO, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void Make(GameObject planetGO, Sector sector, BaseQuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
switch (quantumGroup.type)
if (quantumGroup is SocketQuantumGroupInfo socketGroup)
{
case QuantumGroupType.Sockets:
MakeSocketGroup(planetGO, sector, quantumGroup, propsInGroup);
return;
case QuantumGroupType.States:
MakeStateGroup(planetGO, sector, quantumGroup, propsInGroup);
return;
/*
case PropModule.QuantumGroupType.Shuffle:
MakeShuffleGroup(go, sector, quantumGroup, propsInGroup);
return;
*/
MakeSocketGroup(planetGO, sector, socketGroup, propsInGroup);
}
else if (quantumGroup is StateQuantumGroupInfo stateGroup)
{
MakeStateGroup(planetGO, sector, stateGroup, propsInGroup);
}
}
@ -46,7 +43,7 @@ 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[] propsInGroup)
public static void MakeSocketGroup(GameObject planetGO, Sector sector, SocketQuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
groupRoot.transform.parent = sector?.transform ?? planetGO.transform;
@ -58,7 +55,7 @@ namespace NewHorizons.Builder.Props
{
var socketInfo = quantumGroup.sockets[i];
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, defaultParent: groupRoot.transform);
var socket = GeneralPropBuilder.MakeNew("Socket " + i, planetGO, sector, socketInfo, defaultParent: groupRoot.transform);
sockets[i] = socket.AddComponent<QuantumSocket>();
sockets[i]._lightSources = new Light[0]; // TODO: make this customizable?
@ -87,7 +84,7 @@ namespace NewHorizons.Builder.Props
}
public static void MakeStateGroup(GameObject go, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void MakeStateGroup(GameObject go, Sector sector, StateQuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
// NOTE: States groups need special consideration that socket groups don't
// this is because the base class QuantumObject (and this is important) IGNORES PICTURES TAKEN FROM OVER 100 METERS AWAY

View File

@ -5,5 +5,5 @@ namespace NewHorizons.External.Modules.Props.Quantum;
[JsonObject]
public class SocketQuantumGroupInfo : BaseQuantumGroupInfo
{
QuantumSocketInfo[] sockets;
public QuantumSocketInfo[] sockets;
}

View File

@ -15,4 +15,9 @@ public class StateQuantumGroupInfo : BaseQuantumGroupInfo
/// Optional. Only used if `sequential` is true. If this is false, then after the last state has appeared, the object will no longer change state
/// </summary>
[DefaultValue(true)] public bool loop = true;
/// <summary>
/// Optional. Only used if type is `states`. If this is true, then the first prop made part of this group will be used to construct a visibility box for an empty game object, which will be considered one of the states.
/// </summary>
public bool hasEmptyState;
}

View File

@ -7,6 +7,7 @@ using NewHorizons.Utility.OuterWilds;
using NewHorizons.Utility.OWML;
using UnityEngine;
using static NewHorizons.Main;
using static NewHorizons.Utility.Files.AssetBundleUtilities;
namespace NewHorizons.Handlers
{