STEALING!!!!

This commit is contained in:
Nick 2023-08-26 19:40:00 -04:00
parent d8f9d68281
commit 3b9d3dce46
20 changed files with 223 additions and 75 deletions

Binary file not shown.

View File

@ -0,0 +1,54 @@
ManifestFileVersion: 0
CRC: 1100413555
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: 82cd5bf53e9f9ec8aaa9d096c6b6ed49
TypeTreeHash:
serializedVersion: 2
Hash: 6b0fdc2a003f312c70b7f9f23295d4ec
HashAppended: 0
ClassTypes:
- Class: 1
Script: {instanceID: 0}
- Class: 4
Script: {instanceID: 0}
- Class: 21
Script: {instanceID: 0}
- Class: 28
Script: {instanceID: 0}
- Class: 48
Script: {instanceID: 0}
- Class: 82
Script: {instanceID: 0}
- Class: 83
Script: {instanceID: 0}
- Class: 108
Script: {instanceID: 0}
- Class: 114
Script: {fileID: 11500000, guid: 75a120c57fd3a8b72f7ffaf3cc1e1bab, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: 2145ed3a866d4bd5a94d98ee05d0fa4f, type: 3}
- Class: 115
Script: {instanceID: 0}
- Class: 198
Script: {instanceID: 0}
- Class: 199
Script: {instanceID: 0}
- Class: 213
Script: {instanceID: 0}
SerializeReferenceClassIdentifiers: []
Assets:
- Assets/UncertainFutures/quantum lightning/LOD_Effects_EYE_LightningBolt_d.png
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 05.ogg
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 01.ogg
- Assets/UncertainFutures/quantum lightning/prefab_eye_quantumlightningobject.prefab
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 06.ogg
- Assets/UncertainFutures/quantum lightning/LOD_Effects_EYE_LightningBolt_d.asset
- Assets/UncertainFutures/quantum lightning/Effects_EYE_LightSpeed_mat.mat
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 03.ogg
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 04.ogg
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 07.ogg
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 02.ogg
- Assets/UncertainFutures/quantum lightning/OW Quantum Lightning 091118 AP 08.ogg
Dependencies: []

View File

@ -66,7 +66,7 @@ namespace NewHorizons.Builder.Atmosphere
}
_qmBottomMeshGroup.variants = variants.ToArray();
}
if (_transparentCloud == null) _transparentCloud = Main.NHAssetBundle.LoadAsset<Material>("Assets/Resources/TransparentCloud.mat");
if (_transparentCloud == null) _transparentCloud = AssetBundleUtilities.NHAssetBundle.LoadAsset<Material>("Assets/Resources/TransparentCloud.mat");
}
public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo, bool cloaked, IModBehaviour mod)

View File

@ -5,6 +5,7 @@ using NewHorizons.External;
using NewHorizons.External.Modules;
using NewHorizons.External.Modules.Props;
using NewHorizons.Utility;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.OWML;
using System.Collections.Generic;
using System.Linq;
@ -77,7 +78,7 @@ namespace NewHorizons.Builder.Body
if (_exitWarps == null) _exitWarps = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Interactables_HubDimension/OuterWarp_Hub").InstantiateInactive().Rename("Prefab_Bramble_OuterWarp").DontDestroyOnLoad();
if (_repelVolume == null) _repelVolume = SearchUtilities.Find("DB_HubDimension_Body/BrambleRepelVolume").InstantiateInactive().Rename("Prefab_Bramble_RepelVolume").DontDestroyOnLoad();
if (_material == null) _material = new Material(GameObject.Find("DB_PioneerDimension_Body/Sector_PioneerDimension").GetComponent<EffectRuleset>()._material).DontDestroyOnLoad();
if (_wallCollision == null) _wallCollision = Main.NHPrivateAssetBundle.LoadAsset<GameObject>("BrambleCollision");
if (_wallCollision == null) _wallCollision = AssetBundleUtilities.NHPrivateAssetBundle.LoadAsset<GameObject>("BrambleCollision");
}
public static GameObject Make(NewHorizonsBody body, GameObject go, NHAstroObject ao, Sector sector, OWRigidbody owRigidBody)

View File

@ -62,7 +62,7 @@ namespace NewHorizons.Builder.Body
cubeSphere.SetActive(false);
cubeSphere.transform.SetParent(sector?.transform ?? planetGO.transform, false);
if (PlanetShader == null) PlanetShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");
if (PlanetShader == null) PlanetShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");
var stretch = module.stretch != null ? (Vector3)module.stretch : Vector3.one;

View File

@ -84,10 +84,10 @@ namespace NewHorizons.Builder.Body
var ringMesh = ringMF.mesh;
var ringMR = ringGO.AddComponent<MeshRenderer>();
if (RingShader == null) RingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
if (UnlitRingShader == null) UnlitRingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
if (RingShader1Pixel == null) RingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
if (RingShader == null) RingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
if (UnlitRingShader == null) UnlitRingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
if (RingShader1Pixel == null) RingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
var mat = new Material(ring.unlit ? UnlitRingShader : RingShader);
if (ringTexture.width == 1)

View File

@ -41,7 +41,7 @@ namespace NewHorizons.Builder.General
}
else
{
var baseCubemap = Main.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
var baseCubemap = AssetBundleUtilities.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
cubemap.name = key;
cubemap.wrapMode = baseCubemap.wrapMode;

View File

@ -210,12 +210,15 @@ namespace NewHorizons.Builder.Props
}
if (config.Props.quantumGroups != null)
{
Dictionary<string, List<GameObject>> propsByGroup = new Dictionary<string, List<GameObject>>();
var propsByGroup = new Dictionary<string, List<GameObject>>();
foreach (var detail in config.Props.details)
{
if (detail.quantumGroupID != null)
{
if (!propsByGroup.ContainsKey(detail.quantumGroupID)) propsByGroup[detail.quantumGroupID] = new List<GameObject>();
if (!propsByGroup.ContainsKey(detail.quantumGroupID))
{
propsByGroup[detail.quantumGroupID] = new List<GameObject>();
}
propsByGroup[detail.quantumGroupID].Add(DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail));
}
}
@ -227,11 +230,11 @@ namespace NewHorizons.Builder.Props
try
{
QuantumBuilder.Make(go, sector, config, mod, quantumGroup, propsInGroup.ToArray());
QuantumBuilder.Make(go, sector, quantumGroup, propsInGroup.ToArray());
}
catch (Exception ex)
{
NHLogger.LogError($"Couldn't make quantum group \"{quantumGroup.id}\" for [{go.name}]:\n{ex}");
NHLogger.LogError($"Couldn't make quantum group [{quantumGroup.id}] for [{go.name}]:\n{ex}");
}
}
}

View File

@ -1,11 +1,15 @@
using Epic.OnlineServices.P2P;
using NewHorizons.Components.Quantum;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules.Props;
using NewHorizons.External.Modules.Props.Quantum;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.Geometry;
using NewHorizons.Utility.OWML;
using OWML.Common;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using UnityEngine;
@ -23,39 +27,75 @@ namespace NewHorizons.Builder.Props
{
public static class QuantumBuilder
{
public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void Make(GameObject planetGO, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
switch(quantumGroup.type)
switch (quantumGroup.type)
{
case QuantumGroupType.Sockets: MakeSocketGroup (go, sector, config, mod, quantumGroup, propsInGroup); return;
case QuantumGroupType.States: MakeStateGroup (go, sector, config, mod, quantumGroup, propsInGroup); return;
// case PropModule.QuantumGroupType.Shuffle: MakeShuffleGroup(go, sector, config, mod, quantumGroup, propsInGroup); return;
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;
*/
}
}
public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void MakeQuantumLightning(GameObject planetGO, Sector sector, GameObject[] propsInGroup)
{
var lightning = DetailBuilder.Make(planetGO, sector, AssetBundleUtilities.EyeLightning.LoadAsset<GameObject>("Prefab_EYE_QuantumLightningObject"), new DetailInfo());
lightning.transform.position = prop.transform.position;
lightning.transform.rotation = prop.transform.rotation;
lightning.transform.parent = prop.transform.parent;
var lightningStatesParent = lightning.transform.Find("Models");
prop.transform.parent = lightningStatesParent;
var lightningController = lightning.GetComponent<QuantumLightningObject>();
lightningController._models = new GameObject[] { prop };
lightningController.enabled = true;
}
public static void MakeSocketGroup(GameObject planetGO, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
groupRoot.transform.parent = sector?.transform ?? go.transform;
groupRoot.transform.parent = sector?.transform ?? planetGO.transform;
groupRoot.transform.localPosition = Vector3.zero;
groupRoot.transform.localEulerAngles = Vector3.zero;
var sockets = new QuantumSocket[quantumGroup.sockets.Length];
var sockets = new GameObject[quantumGroup.sockets.Length];
for (int i = 0; i < quantumGroup.sockets.Length; i++)
{
var socketInfo = quantumGroup.sockets[i];
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, parentOverride: groupRoot.transform);
var socketGO = GeneralPropBuilder.MakeNew("Socket " + i, planetGO, sector, socketInfo, parentOverride: groupRoot.transform);
sockets[i] = socketGO;
sockets[i] = socket.AddComponent<QuantumSocket>();
sockets[i]._lightSources = new Light[0];
socket.SetActive(true);
socketGO.SetActive(true);
}
foreach(var prop in propsInGroup)
if (quantumGroup.lightning)
{
}
else
{
foreach (var socketGO in sockets)
{
var socket = socketGO.AddComponent<QuantumSocket>();
socket._lightSources = new Light[0];
}
}
foreach (var prop in propsInGroup)
{
prop.SetActive(false);
var quantumObject = prop.AddComponent<SocketedQuantumObject>();
quantumObject._socketRoot = groupRoot;
quantumObject._socketList = sockets.ToList();
@ -63,19 +103,31 @@ namespace NewHorizons.Builder.Props
quantumObject._prebuilt = true;
quantumObject._childSockets = new List<QuantumSocket>();
// TODO: support _alignWithGravity?
if (prop.GetComponentInChildren<VisibilityTracker>() == null) AddBoundsVisibility(prop);
prop.SetActive(true);
if (prop.GetComponentInChildren<VisibilityTracker>() == null)
{
AddBoundsVisibility(prop);
}
if (quantumGroup.lightning)
{
MakeQuantumLightning(planetGO, sector, prop);
}
prop.SetActive(true);
}
}
public static void MakeStateGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void MakeStateGroup(GameObject go, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
groupRoot.transform.parent = sector?.transform ?? go.transform;
groupRoot.transform.localPosition = Vector3.zero;
var states = new List<QuantumState>();
foreach(var prop in propsInGroup)
foreach (var prop in propsInGroup)
{
prop.transform.parent = groupRoot.transform;
var state = prop.AddComponent<QuantumState>();
@ -90,7 +142,7 @@ namespace NewHorizons.Builder.Props
if (quantumGroup.hasEmptyState)
{
var template = propsInGroup[0];
var empty = new GameObject("Empty State");
empty.transform.parent = groupRoot.transform;
var state = empty.AddComponent<QuantumState>();
@ -101,7 +153,7 @@ namespace NewHorizons.Builder.Props
boxShape.center = boxBounds.center;
boxShape.extents = boxBounds.size;
if (Main.Debug) empty.AddComponent<BoxShapeVisualizer>();
empty.AddComponent<ShapeVisibilityTracker>();
}
@ -115,24 +167,24 @@ namespace NewHorizons.Builder.Props
groupRoot.SetActive(true);
}
public static void MakeShuffleGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void MakeShuffleGroup(GameObject go, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
//var averagePosition = propsInGroup.Aggregate(Vector3.zero, (avg, prop) => avg + prop.transform.position) / propsInGroup.Count();
GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id);
shuffleParent.SetActive(false);
shuffleParent.transform.parent = sector?.transform ?? go.transform;
shuffleParent.transform.localPosition = Vector3.zero;
propsInGroup.ToList().ForEach(p => p.transform.parent = shuffleParent.transform);
propsInGroup.ToList().ForEach(p => p.transform.parent = shuffleParent.transform);
var shuffle = shuffleParent.AddComponent<QuantumShuffleObject>();
shuffle._shuffledObjects = propsInGroup.Select(p => p.transform).ToArray();
shuffle.Awake(); // this doesn't get called on its own for some reason
AddBoundsVisibility(shuffleParent);
shuffleParent.SetActive(true);
}
struct BoxShapeReciever
{
public MeshFilter f;
@ -144,15 +196,15 @@ namespace NewHorizons.Builder.Props
{
var meshFilters = g.GetComponentsInChildren<MeshFilter>();
var skinnedMeshRenderers = g.GetComponentsInChildren<SkinnedMeshRenderer>();
var boxShapeRecievers = meshFilters
.Select(f => new BoxShapeReciever() { f=f, g=f.gameObject })
.Concat (
skinnedMeshRenderers.Select(s => new BoxShapeReciever() { s=s, g=s.gameObject })
.Select(f => new BoxShapeReciever() { f = f, g = f.gameObject })
.Concat(
skinnedMeshRenderers.Select(s => new BoxShapeReciever() { s = s, g = s.gameObject })
)
.ToList();
foreach(var boxshapeReciever in boxShapeRecievers)
foreach (var boxshapeReciever in boxShapeRecievers)
{
var box = boxshapeReciever.g.AddComponent<BoxShape>();
boxshapeReciever.g.AddComponent<ShapeVisibilityTracker>();
@ -169,7 +221,7 @@ namespace NewHorizons.Builder.Props
{
var meshFilters = g.GetComponentsInChildren<MeshFilter>();
var corners = meshFilters.SelectMany(m => GetMeshCorners(m, g)).ToList();
Bounds b = new Bounds(corners[0], Vector3.zero);
corners.ForEach(corner => b.Encapsulate(corner));
@ -191,9 +243,9 @@ namespace NewHorizons.Builder.Props
new Vector3(bounds.max.x, bounds.min.y, bounds.max.z),
new Vector3(bounds.max.x, bounds.max.y, bounds.min.z),
};
var globalCorners = localCorners.Select(localCorner => m.transform.TransformPoint(localCorner)).ToArray();
if (relativeTo == null) return globalCorners;
return globalCorners.Select(globalCorner => relativeTo.transform.InverseTransformPoint(globalCorner)).ToArray();
@ -216,7 +268,7 @@ namespace NewHorizons.Builder.Props
if (sharedMesh == null) return;
if (sharedMesh.bounds.size == Vector3.zero) return;
shape.size = sharedMesh.bounds.size;
shape.center = sharedMesh.bounds.center;

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Builder.Props;
public static class QuantumLightningBuilder
{
public static void Make()
{
}
}

View File

@ -73,6 +73,11 @@ namespace NewHorizons.External.Modules
/// </summary>
public QuantumGroupInfo[] quantumGroups;
/// <summary>
/// Puts quantum lightning
/// </summary>
public DetailInfo[] quantumLightning;
/// <summary>
/// Add tornadoes to this planet
/// </summary>

View File

@ -35,5 +35,10 @@ namespace NewHorizons.External.Modules.Props.Quantum
/// Optional. Only used if type is `states` and `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>
/// Flash of lightning and changes state
/// </summary>
public bool lightning;
}
}

View File

@ -11,6 +11,8 @@ namespace NewHorizons.External.Modules.Props.Quantum
[EnumMember(Value = @"states")] States = 1,
[EnumMember(Value = @"lightning")] Lightning = 2,
FailedValidation = 10
}
}

View File

@ -2,10 +2,10 @@ using NewHorizons.Builder.Props;
using NewHorizons.Components;
using NewHorizons.Components.EyeOfTheUniverse;
using NewHorizons.Utility;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.OuterWilds;
using NewHorizons.Utility.OWML;
using UnityEngine;
using static NewHorizons.Main;
namespace NewHorizons.Handlers
{
@ -20,43 +20,46 @@ namespace NewHorizons.Handlers
public static void Initialize()
{
VesselPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Vessel_Body");
VesselPrefab = AssetBundleUtilities.NHPrivateAssetBundle.LoadAsset<GameObject>("Vessel_Body");
}
public static bool IsVesselPresentAndActive()
{
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
var vesselConfig = Main.SystemDict[Main.Instance.CurrentStarSystem].Config?.Vessel;
var vesselIsPresent = vesselConfig?.alwaysPresent ?? false;
return Instance.IsWarpingFromVessel || vesselIsPresent;
return Main.Instance.IsWarpingFromVessel || vesselIsPresent;
}
public static bool IsVesselPresent()
{
var isDefaultSolarSystem = Instance.CurrentStarSystem == "SolarSystem";
var isEyeOfTheUniverse = Instance.CurrentStarSystem == "EyeOfTheUniverse";
var isDefaultSolarSystem = Main.Instance.CurrentStarSystem == "SolarSystem";
var isEyeOfTheUniverse = Main.Instance.CurrentStarSystem == "EyeOfTheUniverse";
return IsVesselPresentAndActive() || isDefaultSolarSystem || isEyeOfTheUniverse;
}
public static bool ShouldSpawnAtVessel()
{
var vesselConfig = SystemDict[Instance.CurrentStarSystem].Config?.Vessel;
var vesselConfig = Main.SystemDict[Main.Instance.CurrentStarSystem].Config?.Vessel;
var shouldSpawnOnVessel = IsVesselPresent() && (vesselConfig?.spawnOnVessel ?? false);
return !Instance.IsWarpingFromShip && (Instance.IsWarpingFromVessel || shouldSpawnOnVessel);
return !Main.Instance.IsWarpingFromShip && (Main.Instance.IsWarpingFromVessel || shouldSpawnOnVessel);
}
public static void LoadVessel()
{
var system = SystemDict[Instance.CurrentStarSystem];
if (Instance.CurrentStarSystem == "EyeOfTheUniverse")
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse")
{
_vesselSpawnPoint = SearchUtilities.Find("Vessel_Body/SPAWN_Vessel").GetComponent<EyeSpawnPoint>();
return;
}
if (IsVesselPresentAndActive())
_vesselSpawnPoint = Instance.CurrentStarSystem == "SolarSystem" ? UpdateVessel() : CreateVessel();
{
_vesselSpawnPoint = Main.Instance.CurrentStarSystem == "SolarSystem" ? UpdateVessel() : CreateVessel();
}
else
{
_vesselSpawnPoint = SearchUtilities.Find("DB_VesselDimension_Body/Sector_VesselDimension").GetComponentInChildren<SpawnPoint>();
}
}
public static void TeleportToVessel()
@ -66,7 +69,7 @@ namespace NewHorizons.Handlers
playerSpawner.DebugWarp(_vesselSpawnPoint);
Builder.General.SpawnPointBuilder.SuitUp();
if (Instance.CurrentStarSystem == "SolarSystem")
if (Main.Instance.CurrentStarSystem == "SolarSystem")
{
// Deactivate village music because for some reason it still plays.
SearchUtilities.Find("TimberHearth_Body/Sector_TH/Sector_Village/Volumes_Village/MusicVolume_Village").GetComponent<VillageMusicVolume>().Deactivate();
@ -83,7 +86,7 @@ namespace NewHorizons.Handlers
public static EyeSpawnPoint CreateVessel()
{
var system = SystemDict[Instance.CurrentStarSystem];
var system = Main.SystemDict[Main.Instance.CurrentStarSystem];
NHLogger.LogVerbose("Checking for Vessel Prefab");
if (VesselPrefab == null) return null;
@ -201,7 +204,7 @@ namespace NewHorizons.Handlers
public static SpawnPoint UpdateVessel()
{
var system = SystemDict[Instance.CurrentStarSystem];
var system = Main.SystemDict[Main.Instance.CurrentStarSystem];
NHLogger.LogVerbose("Updating DB Vessel");
var vectorSector = SearchUtilities.Find("DB_VesselDimension_Body/Sector_VesselDimension");

View File

@ -39,8 +39,6 @@ namespace NewHorizons
public class Main : ModBehaviour
{
public static AssetBundle NHAssetBundle { get; private set; }
public static AssetBundle NHPrivateAssetBundle { get; private set; }
public static Main Instance { get; private set; }
// Settings
@ -223,18 +221,6 @@ namespace NewHorizons
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
GlobalMessenger.AddListener("WakeUp", OnWakeUp);
NHAssetBundle = ModHelper.Assets.LoadBundle("Assets/newhorizons_public");
if (NHAssetBundle == null)
{
NHLogger.LogError("Couldn't find NHAssetBundle: The mod will likely not work.");
}
NHPrivateAssetBundle = ModHelper.Assets.LoadBundle("Assets/newhorizons_private");
if (NHPrivateAssetBundle == null)
{
NHLogger.LogError("Couldn't find NHPrivateAssetBundle: The mod will likely not work.");
}
VesselWarpHandler.Initialize();
ResetConfigs(resetTranslation: false);

View File

@ -1,5 +1,6 @@
using NewHorizons.Utility.OWML;
using OWML.Common;
using OWML.ModHelper;
using System;
using System.Collections.Generic;
using System.IO;
@ -11,6 +12,27 @@ namespace NewHorizons.Utility.Files
{
public static Dictionary<string, AssetBundle> AssetBundles = new Dictionary<string, AssetBundle>();
public static AssetBundle NHAssetBundle { get; private set; }
public static AssetBundle NHPrivateAssetBundle { get; private set; }
public static AssetBundle EyeLightning { get; private set; }
static AssetBundleUtilities()
{
NHAssetBundle = LoadRequiredBundle("Assets/bundles/newhorizons_public");
NHPrivateAssetBundle = LoadRequiredBundle("Assets/bundles/newhorizons_private");
EyeLightning = LoadRequiredBundle("Assets/bundles/eyelightning");
}
private static AssetBundle LoadRequiredBundle(string path)
{
var bundle = Main.Instance.ModHelper.Assets.LoadBundle(path);
if (bundle == null)
{
NHLogger.LogError($"Couldn't find [{Path.GetFileName(path)}]: Some features of NH will not work.");
}
return bundle;
}
public static void ClearCache()
{
foreach (var pair in AssetBundles)