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(); _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) 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;
using NewHorizons.External.Modules.Props; using NewHorizons.External.Modules.Props;
using NewHorizons.Utility; using NewHorizons.Utility;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; 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 (_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 (_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 (_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) 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.SetActive(false);
cubeSphere.transform.SetParent(sector?.transform ?? planetGO.transform, 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; 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 ringMesh = ringMF.mesh;
var ringMR = ringGO.AddComponent<MeshRenderer>(); var ringMR = ringGO.AddComponent<MeshRenderer>();
if (RingShader == null) RingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader"); if (RingShader == null) RingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
if (UnlitRingShader == null) UnlitRingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader"); if (UnlitRingShader == null) UnlitRingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
if (RingShader1Pixel == null) RingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader"); if (RingShader1Pixel == null) RingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader"); if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
var mat = new Material(ring.unlit ? UnlitRingShader : RingShader); var mat = new Material(ring.unlit ? UnlitRingShader : RingShader);
if (ringTexture.width == 1) if (ringTexture.width == 1)

View File

@ -41,7 +41,7 @@ namespace NewHorizons.Builder.General
} }
else 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); var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
cubemap.name = key; cubemap.name = key;
cubemap.wrapMode = baseCubemap.wrapMode; cubemap.wrapMode = baseCubemap.wrapMode;

View File

@ -210,12 +210,15 @@ namespace NewHorizons.Builder.Props
} }
if (config.Props.quantumGroups != null) 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) foreach (var detail in config.Props.details)
{ {
if (detail.quantumGroupID != null) 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)); propsByGroup[detail.quantumGroupID].Add(DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail));
} }
} }
@ -227,11 +230,11 @@ namespace NewHorizons.Builder.Props
try try
{ {
QuantumBuilder.Make(go, sector, config, mod, quantumGroup, propsInGroup.ToArray()); QuantumBuilder.Make(go, sector, quantumGroup, propsInGroup.ToArray());
} }
catch (Exception ex) 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.Components.Quantum;
using NewHorizons.External.Configs; using NewHorizons.External.Configs;
using NewHorizons.External.Modules.Props;
using NewHorizons.External.Modules.Props.Quantum; using NewHorizons.External.Modules.Props.Quantum;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.Geometry; using NewHorizons.Utility.Geometry;
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using OWML.Common; using OWML.Common;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Sockets;
using UnityEngine; using UnityEngine;
@ -23,39 +27,75 @@ namespace NewHorizons.Builder.Props
{ {
public static class QuantumBuilder public static class QuantumBuilder
{ {
public static void Make(GameObject planetGO, Sector sector, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{ {
switch(quantumGroup.type) switch (quantumGroup.type)
{ {
case QuantumGroupType.Sockets: MakeSocketGroup (go, sector, config, mod, quantumGroup, propsInGroup); return; case QuantumGroupType.Sockets:
case QuantumGroupType.States: MakeStateGroup (go, sector, config, mod, quantumGroup, propsInGroup); return; MakeSocketGroup(planetGO, sector, quantumGroup, propsInGroup);
// case PropModule.QuantumGroupType.Shuffle: MakeShuffleGroup(go, sector, config, mod, quantumGroup, propsInGroup); return; 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); 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.localPosition = Vector3.zero;
groupRoot.transform.localEulerAngles = 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++) for (int i = 0; i < quantumGroup.sockets.Length; i++)
{ {
var socketInfo = quantumGroup.sockets[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>(); socketGO.SetActive(true);
sockets[i]._lightSources = new Light[0];
socket.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); prop.SetActive(false);
var quantumObject = prop.AddComponent<SocketedQuantumObject>(); var quantumObject = prop.AddComponent<SocketedQuantumObject>();
quantumObject._socketRoot = groupRoot; quantumObject._socketRoot = groupRoot;
quantumObject._socketList = sockets.ToList(); quantumObject._socketList = sockets.ToList();
@ -63,19 +103,31 @@ namespace NewHorizons.Builder.Props
quantumObject._prebuilt = true; quantumObject._prebuilt = true;
quantumObject._childSockets = new List<QuantumSocket>(); quantumObject._childSockets = new List<QuantumSocket>();
// TODO: support _alignWithGravity? // TODO: support _alignWithGravity?
if (prop.GetComponentInChildren<VisibilityTracker>() == null) AddBoundsVisibility(prop);
if (prop.GetComponentInChildren<VisibilityTracker>() == null)
{
AddBoundsVisibility(prop);
}
if (quantumGroup.lightning)
{
MakeQuantumLightning(planetGO, sector, prop);
}
prop.SetActive(true); 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); var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
groupRoot.transform.parent = sector?.transform ?? go.transform; groupRoot.transform.parent = sector?.transform ?? go.transform;
groupRoot.transform.localPosition = Vector3.zero; groupRoot.transform.localPosition = Vector3.zero;
var states = new List<QuantumState>(); var states = new List<QuantumState>();
foreach(var prop in propsInGroup) foreach (var prop in propsInGroup)
{ {
prop.transform.parent = groupRoot.transform; prop.transform.parent = groupRoot.transform;
var state = prop.AddComponent<QuantumState>(); var state = prop.AddComponent<QuantumState>();
@ -115,7 +167,7 @@ namespace NewHorizons.Builder.Props
groupRoot.SetActive(true); 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(); //var averagePosition = propsInGroup.Aggregate(Vector3.zero, (avg, prop) => avg + prop.transform.position) / propsInGroup.Count();
GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id); GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id);
@ -146,13 +198,13 @@ namespace NewHorizons.Builder.Props
var skinnedMeshRenderers = g.GetComponentsInChildren<SkinnedMeshRenderer>(); var skinnedMeshRenderers = g.GetComponentsInChildren<SkinnedMeshRenderer>();
var boxShapeRecievers = meshFilters var boxShapeRecievers = meshFilters
.Select(f => new BoxShapeReciever() { f=f, g=f.gameObject }) .Select(f => new BoxShapeReciever() { f = f, g = f.gameObject })
.Concat ( .Concat(
skinnedMeshRenderers.Select(s => new BoxShapeReciever() { s=s, g=s.gameObject }) skinnedMeshRenderers.Select(s => new BoxShapeReciever() { s = s, g = s.gameObject })
) )
.ToList(); .ToList();
foreach(var boxshapeReciever in boxShapeRecievers) foreach (var boxshapeReciever in boxShapeRecievers)
{ {
var box = boxshapeReciever.g.AddComponent<BoxShape>(); var box = boxshapeReciever.g.AddComponent<BoxShape>();
boxshapeReciever.g.AddComponent<ShapeVisibilityTracker>(); boxshapeReciever.g.AddComponent<ShapeVisibilityTracker>();

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> /// </summary>
public QuantumGroupInfo[] quantumGroups; public QuantumGroupInfo[] quantumGroups;
/// <summary>
/// Puts quantum lightning
/// </summary>
public DetailInfo[] quantumLightning;
/// <summary> /// <summary>
/// Add tornadoes to this planet /// Add tornadoes to this planet
/// </summary> /// </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 /// 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> /// </summary>
[DefaultValue(true)] public bool loop = true; [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 = @"states")] States = 1,
[EnumMember(Value = @"lightning")] Lightning = 2,
FailedValidation = 10 FailedValidation = 10
} }
} }

View File

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

View File

@ -39,8 +39,6 @@ namespace NewHorizons
public class Main : ModBehaviour 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; } public static Main Instance { get; private set; }
// Settings // Settings
@ -223,18 +221,6 @@ namespace NewHorizons
GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath); GlobalMessenger<DeathType>.AddListener("PlayerDeath", OnDeath);
GlobalMessenger.AddListener("WakeUp", OnWakeUp); 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(); VesselWarpHandler.Initialize();
ResetConfigs(resetTranslation: false); ResetConfigs(resetTranslation: false);

View File

@ -1,5 +1,6 @@
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using OWML.Common; using OWML.Common;
using OWML.ModHelper;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -11,6 +12,27 @@ namespace NewHorizons.Utility.Files
{ {
public static Dictionary<string, AssetBundle> AssetBundles = new Dictionary<string, AssetBundle>(); 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() public static void ClearCache()
{ {
foreach (var pair in AssetBundles) foreach (var pair in AssetBundles)