diff --git a/NewHorizons/Assets/newhorizons_private b/NewHorizons/Assets/newhorizons_private new file mode 100644 index 00000000..8d714bf1 Binary files /dev/null and b/NewHorizons/Assets/newhorizons_private differ diff --git a/NewHorizons/Assets/newhorizons_private.manifest b/NewHorizons/Assets/newhorizons_private.manifest new file mode 100644 index 00000000..3d4254c5 --- /dev/null +++ b/NewHorizons/Assets/newhorizons_private.manifest @@ -0,0 +1,173 @@ +ManifestFileVersion: 0 +CRC: 1932961951 +Hashes: + AssetFileHash: + serializedVersion: 2 + Hash: 79142e7d68648a06c0ed2fc15ebbac48 + TypeTreeHash: + serializedVersion: 2 + Hash: fae511e2df3c6c74353879b4753cf2eb +HashAppended: 0 +ClassTypes: +- Class: 1 + Script: {instanceID: 0} +- Class: 4 + Script: {instanceID: 0} +- Class: 21 + Script: {instanceID: 0} +- Class: 23 + Script: {instanceID: 0} +- Class: 33 + Script: {instanceID: 0} +- Class: 43 + Script: {instanceID: 0} +- Class: 48 + Script: {instanceID: 0} +- Class: 49 + Script: {instanceID: 0} +- Class: 54 + Script: {instanceID: 0} +- Class: 64 + Script: {instanceID: 0} +- Class: 65 + Script: {instanceID: 0} +- Class: 82 + Script: {instanceID: 0} +- Class: 108 + Script: {instanceID: 0} +- Class: 114 + Script: {fileID: 11500000, guid: 70edf1000ebf31e4eb3ab4e289a345c0, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 77b727c07614b4041a5fe1fba0cfacff, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 0560061199aba2046ac30f3d5c75cb90, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 1534762172989ac42bab0e536bf9b239, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 44a8b83109565ae4ba91616a9a618102, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: c3beec511cdafc449b96f44449663f95, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 1f602412fb56d5844acb7434ec52276d, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 4eca0612bbafa0b439c7abec581127ae, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: bbb58a424fe28ac4c9fb85e59c3fca71, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 50addbe26c258f44089af8685f9b1ab3, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 73839c63852a8ff44b2cebff3c519831, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 420cbc835ec74c74c996ba2af6d3448e, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 93e967c37db35d747ad827cb8296cc38, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 99b9c6f383f445e408c41f4d3f9a6ec4, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 3d7fee243786b7a43aeb607db88d4b36, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 6852cf345d89f5f4583e26776c10f794, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 44e6c85460fc91746b86ccb3c4135daf, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 040dd594681f07a4a975890a61d44be5, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 327eb94566c9e284dae5d7b1cfe11ccd, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: c317f6a5634f15f4c80f89e306616924, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 13ab18a571ddf1b4f8dc92e3fa31b22e, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 3d5c87c5a00ca19449219c7c54f41ee7, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 840ab63696e59254eb425242136805dd, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 147fd1465383e9d418a3c3e6172c99a2, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 4b177e6642f98d24b81e2c14ebdae8d0, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: c85ca0b6e117fee4b9db36f9084be253, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: f52be5075bc40e149a632b40370bdec4, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 754ec047e26243f44aeffca1f60bd21d, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: b4b79e57677045045a95bfe4fe447ce5, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 64247dd7b0c5ac640a6d9ae5360a0f5a, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 8ef66a28deb09ab4aaba30bb60b9f19a, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 0863077874402f14dba0ca4ae81752dd, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: a9da74c8b134add4ba1d884336a5e075, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 45f850698d4258540989244f02e2f009, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 759f3989413398f46a8d259bb9c750f3, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 608730b91f3a723488fe994a9902e157, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 72d51cb9cb0325847851869e5351c34e, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 7f5f781ad5c7cb3479ad11f01f455d95, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 02ca5d8a60b7e434ea9d5340e551297e, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 5785e4da66387204da6dd578cad96d60, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: b21148dab2fe4ab468de03459edf483b, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 2357c7ea4be9dc840867927064ff876e, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 33ae932be5951624da3ad093a903f219, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: e2adaadbb49e1b44dae3e96d7685d5f8, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 98bf20eb1317b5a4896485a347b3822f, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 0903042c4b275f547930e4ab91d088d8, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 9fc2294cf3b0d3346b0a42bed190f7a4, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: e514175ccf2c4344ea6fd67ee496b027, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: c0a81f0d934639e49b74d8697b722070, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 0697417d0b4243b48a036bfb10342726, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 5c2d328d259791744bb8539650a9c619, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 034b758dcb27c9746a7640cdb345b333, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 068d4b8d94b9e2843be29eba43ef06e0, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 910a3fad063ead543bc990492531ae37, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 02110bcd18fcca043a8407ab3d14c538, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 2219577e0c87aa447a69bce0c854e47a, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 61b00a8e76a237e429174e8bc253901f, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 8f65f49e555084e4ebbdbe48e9084290, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 0646b46f882dc6048b32435d59203118, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: ce30d9efa5d4d6248af53b7d3a66d241, type: 3} +- Class: 115 + Script: {instanceID: 0} +- Class: 134 + Script: {instanceID: 0} +- Class: 135 + Script: {instanceID: 0} +- Class: 136 + Script: {instanceID: 0} +- Class: 198 + Script: {instanceID: 0} +- Class: 199 + Script: {instanceID: 0} +SerializeReferenceClassIdentifiers: [] +Assets: +- Assets/Vessel_Body.prefab +Dependencies: [] diff --git a/NewHorizons/Assets/newhorizons_public b/NewHorizons/Assets/newhorizons_public new file mode 100644 index 00000000..d72059b0 Binary files /dev/null and b/NewHorizons/Assets/newhorizons_public differ diff --git a/NewHorizons/Assets/xen.newhorizons.manifest b/NewHorizons/Assets/newhorizons_public.manifest similarity index 91% rename from NewHorizons/Assets/xen.newhorizons.manifest rename to NewHorizons/Assets/newhorizons_public.manifest index 8902bd7f..b8e4d8e3 100644 --- a/NewHorizons/Assets/xen.newhorizons.manifest +++ b/NewHorizons/Assets/newhorizons_public.manifest @@ -1,9 +1,9 @@ ManifestFileVersion: 0 -CRC: 2022446871 +CRC: 1013046168 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 083882699617744b8fc49234bb8cb795 + Hash: 0123e044c220152b98ceaf0975b8cadd TypeTreeHash: serializedVersion: 2 Hash: 10a6a558690295dadb3dd990eda0821a diff --git a/NewHorizons/Assets/vessel.newhorizons b/NewHorizons/Assets/vessel.newhorizons deleted file mode 100644 index dcc92757..00000000 Binary files a/NewHorizons/Assets/vessel.newhorizons and /dev/null differ diff --git a/NewHorizons/Assets/xen.newhorizons b/NewHorizons/Assets/xen.newhorizons deleted file mode 100644 index de0815e9..00000000 Binary files a/NewHorizons/Assets/xen.newhorizons and /dev/null differ diff --git a/NewHorizons/Builder/Body/LavaBuilder.cs b/NewHorizons/Builder/Body/LavaBuilder.cs index 7eaab62f..dd21b635 100644 --- a/NewHorizons/Builder/Body/LavaBuilder.cs +++ b/NewHorizons/Builder/Body/LavaBuilder.cs @@ -4,14 +4,15 @@ using NewHorizons.Utility; using NewHorizons.External.Modules.VariableSize; using System.Linq; using UnityEngine.Assertions.Must; +using NewHorizons.Components.SizeControllers; namespace NewHorizons.Builder.Body { public static class LavaBuilder { - private static readonly int HeightScale = Shader.PropertyToID("_HeightScale"); - private static readonly int EdgeFade = Shader.PropertyToID("_EdgeFade"); - private static readonly int TexHeight = Shader.PropertyToID("_TexHeight"); + public static readonly int HeightScale = Shader.PropertyToID("_HeightScale"); + public static readonly int EdgeFade = Shader.PropertyToID("_EdgeFade"); + public static readonly int TexHeight = Shader.PropertyToID("_TexHeight"); private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor"); private static GameObject _lavaSphere; @@ -36,11 +37,6 @@ namespace NewHorizons.Builder.Body InitPrefabs(); var multiplier = module.size / 100f; - if (module.curve != null) - { - var modifier = module.curve.Max(pair => pair.value); - multiplier *= modifier; - } var moltenCore = new GameObject("MoltenCore"); moltenCore.SetActive(false); @@ -83,13 +79,11 @@ namespace NewHorizons.Builder.Body if (module.curve != null) { - var levelController = moltenCore.AddComponent(); - var curve = new AnimationCurve(); - foreach (var pair in module.curve) - { - curve.AddKey(new Keyframe(pair.time, module.size * pair.value)); - } - levelController._scaleCurve = curve; + var sizeController = moltenCore.AddComponent(); + sizeController.SetScaleCurve(module.curve); + sizeController.size = module.size; + sizeController.material = lavaSphere.GetComponent().material; + sizeController.proxyMaterial = proxyLavaSphere.GetComponent().material; } moltenCore.SetActive(true); diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 38b944f3..0c4d12f1 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -300,7 +300,7 @@ namespace NewHorizons.Builder.Body sizeController = singularityRenderer.gameObject.AddComponent(); sizeController.SetScaleCurve(curve); sizeController.size = distort; - sizeController.innerScale = horizon; + sizeController.innerScale = horizon / distort; sizeController.material = singularityRenderer.material; } diff --git a/NewHorizons/Components/MaterialReplacer.cs b/NewHorizons/Components/MaterialReplacer.cs index adf73001..64b383c1 100644 --- a/NewHorizons/Components/MaterialReplacer.cs +++ b/NewHorizons/Components/MaterialReplacer.cs @@ -7,6 +7,7 @@ namespace NewHorizons.Components /// /// Used by vessel asset bundle to change materials to the in-game ones. /// + [UsedInUnityProject] public class MaterialReplacer : MonoBehaviour { public string[] materialNames; diff --git a/NewHorizons/Components/SizeControllers/LavaSizeController.cs b/NewHorizons/Components/SizeControllers/LavaSizeController.cs new file mode 100644 index 00000000..50cca879 --- /dev/null +++ b/NewHorizons/Components/SizeControllers/LavaSizeController.cs @@ -0,0 +1,29 @@ +using NewHorizons.Builder.Body; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace NewHorizons.Components.SizeControllers +{ + public class LavaSizeController : SizeController + { + public Material material; + public Material proxyMaterial; + + protected new void FixedUpdate() + { + base.FixedUpdate(); + + material.SetFloat(LavaBuilder.HeightScale, 150f * CurrentScale / 100f); + material.SetFloat(LavaBuilder.EdgeFade, 15f * CurrentScale / 100f); + material.SetFloat(LavaBuilder.TexHeight, 15f * CurrentScale / 100f); + + proxyMaterial.SetFloat(LavaBuilder.HeightScale, 150f * CurrentScale / 100f); + proxyMaterial.SetFloat(LavaBuilder.EdgeFade, 15f * CurrentScale / 100f); + proxyMaterial.SetFloat(LavaBuilder.TexHeight, 15f * CurrentScale / 100f); + } + } +} diff --git a/NewHorizons/Components/VesselOrbLocker.cs b/NewHorizons/Components/VesselOrbLocker.cs index 34db1367..a7343659 100644 --- a/NewHorizons/Components/VesselOrbLocker.cs +++ b/NewHorizons/Components/VesselOrbLocker.cs @@ -2,6 +2,7 @@ using UnityEngine; namespace NewHorizons.Components { + [UsedInUnityProject] public class VesselOrbLocker : MonoBehaviour { public GameObject _coordinateInterfaceOrbObject; @@ -13,6 +14,8 @@ namespace NewHorizons.Components public GameObject _powerOrbObject; private NomaiInterfaceOrb _powerOrb; + private void Awake() => InitializeOrbs(); + public void InitializeOrbs() { _coordinateInterfaceOrb = _coordinateInterfaceOrbObject.GetComponent(); diff --git a/NewHorizons/Components/VesselSingularityRoot.cs b/NewHorizons/Components/VesselSingularityRoot.cs index 2cca4481..fcfc3fab 100644 --- a/NewHorizons/Components/VesselSingularityRoot.cs +++ b/NewHorizons/Components/VesselSingularityRoot.cs @@ -2,6 +2,7 @@ using UnityEngine; namespace NewHorizons.Components { + [UsedInUnityProject] public class VesselSingularityRoot : MonoBehaviour { } diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 011db3cc..ecd9cce2 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -22,7 +22,7 @@ namespace NewHorizons.Handlers public static void Initialize() { - VesselBundle = Instance.ModHelper.Assets.LoadBundle("Assets/vessel.newhorizons"); + VesselBundle = Instance.ModHelper.Assets.LoadBundle("Assets/newhorizons_private"); VesselPrefab = VesselBundle.LoadAsset("Vessel_Body"); } @@ -86,7 +86,7 @@ namespace NewHorizons.Handlers if (VesselPrefab == null) return null; Logger.LogVerbose("Creating Vessel"); - var vesselObject = GameObject.Instantiate(VesselPrefab); + var vesselObject = VesselPrefab.InstantiateInactive(); VesselObject = vesselObject; vesselObject.name = VesselPrefab.name; vesselObject.transform.parent = null; @@ -100,19 +100,12 @@ namespace NewHorizons.Handlers vesselAO.Register(); vesselObject.GetComponentInChildren(true)._referenceFrame._attachedAstroObject = vesselAO; - VesselOrbLocker vesselOrbLocker = vesselObject.GetComponent(); - vesselOrbLocker.InitializeOrbs(); - vesselOrbLocker.AddLocks(); - if (system.Config.Vessel?.vesselPosition != null) vesselObject.transform.position = system.Config.Vessel.vesselPosition; if (system.Config.Vessel?.vesselRotation != null) vesselObject.transform.eulerAngles = system.Config.Vessel.vesselRotation; - vesselOrbLocker.RemoveLocks(); - vesselOrbLocker.AddLockToWarpOrb(); - VesselSingularityRoot singularityRoot = vesselObject.GetComponentInChildren(true); VesselWarpController vesselWarpController = vesselObject.GetComponentInChildren(true); @@ -154,8 +147,6 @@ namespace NewHorizons.Handlers vesselWarpController._whiteHole = newWhiteHole.GetComponentInChildren(); vesselWarpController._whiteHoleOneShot = vesselWarpController._whiteHole.transform.parent.Find("WhiteHoleAudio_OneShot").GetComponent(); - vesselObject.SetActive(true); - vesselWarpController._targetWarpPlatform.OnReceiveWarpedBody += OnReceiveWarpedBody; if (system.Config.Vessel?.warpExitPosition != null) @@ -169,6 +160,8 @@ namespace NewHorizons.Handlers EyeSpawnPoint eyeSpawnPoint = vesselObject.GetComponentInChildren(true); system.SpawnPoint = eyeSpawnPoint; + vesselObject.SetActive(true); + Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => SetupWarpController(vesselWarpController)); return eyeSpawnPoint; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index fcac259d..95891261 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -195,7 +195,7 @@ namespace NewHorizons GlobalMessenger.AddListener("PlayerDeath", OnDeath); GlobalMessenger.AddListener("WakeUp", OnWakeUp); - NHAssetBundle = ModHelper.Assets.LoadBundle("Assets/xen.newhorizons"); + NHAssetBundle = ModHelper.Assets.LoadBundle("Assets/newhorizons_public"); VesselWarpHandler.Initialize(); ResetConfigs(resetTranslation: false); diff --git a/NewHorizons/UsedInUnityProjectAttribute.cs b/NewHorizons/UsedInUnityProjectAttribute.cs new file mode 100644 index 00000000..057b3388 --- /dev/null +++ b/NewHorizons/UsedInUnityProjectAttribute.cs @@ -0,0 +1,7 @@ +using System; + +/// +/// denotes that the given type is used in the unity project +/// and therefore caution should be used when moving/renaming/deleting +/// +public class UsedInUnityProjectAttribute : Attribute { } \ No newline at end of file