diff --git a/NewHorizons/Assets/newhorizons_private b/NewHorizons/Assets/newhorizons_private index 8d714bf1..dffd8877 100644 Binary files a/NewHorizons/Assets/newhorizons_private and b/NewHorizons/Assets/newhorizons_private differ diff --git a/NewHorizons/Assets/newhorizons_private.manifest b/NewHorizons/Assets/newhorizons_private.manifest index 3d4254c5..5eae841e 100644 --- a/NewHorizons/Assets/newhorizons_private.manifest +++ b/NewHorizons/Assets/newhorizons_private.manifest @@ -1,9 +1,9 @@ ManifestFileVersion: 0 -CRC: 1932961951 +CRC: 2314570133 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 79142e7d68648a06c0ed2fc15ebbac48 + Hash: 73793e57d83c10dbd917c9f721a4e60e TypeTreeHash: serializedVersion: 2 Hash: fae511e2df3c6c74353879b4753cf2eb @@ -169,5 +169,6 @@ ClassTypes: Script: {instanceID: 0} SerializeReferenceClassIdentifiers: [] Assets: +- Assets/BrambleCollision.prefab - Assets/Vessel_Body.prefab Dependencies: [] diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 22f0c2ef..85010cfe 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; using Logger = NewHorizons.Utility.Logger; +using static NewHorizons.Main; namespace NewHorizons.Builder.Body { @@ -54,6 +55,7 @@ namespace NewHorizons.Builder.Body private static GameObject _exitWarps; private static GameObject _repelVolume; private static Material _material; + private static GameObject _wallCollision; private static bool _isInit; @@ -70,6 +72,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()._material).DontDestroyOnLoad(); + if (_wallCollision == null) _wallCollision = Main.NHPrivateAssetBundle.LoadAsset("BrambleCollision"); } public static GameObject Make(NewHorizonsBody body, GameObject go, NHAstroObject ao, Sector sector, OWRigidbody owRigidBody) @@ -115,18 +118,22 @@ namespace NewHorizons.Builder.Body repelVolume.transform.parent = sector.transform; repelVolume.transform.localPosition = Vector3.zero; - // TODO: Remove default vines (once we create an asset bundle version of the outer sphere that has collisions - /* - var geoBatchedGroup = geometry.FindChild("BatchedGroup"); - var collider = geoBatchedGroup.FindChild("BatchedMeshColliders_0"); - collider.transform.parent = geometry.transform; - GameObject.Destroy(geoBatchedGroup); + // Replace batched collision with our own if removing vines + if (!config.hasVines) + { + GameObject.Destroy(geometry.FindChild("BatchedGroup")); + var geoOtherComponentsGroup = geometry.FindChild("OtherComponentsGroup"); + var dimensionWalls = geoOtherComponentsGroup.FindChild("Terrain_DB_BrambleSphere_Outer_v2"); + dimensionWalls.transform.parent = geometry.transform; + GameObject.Destroy(geoOtherComponentsGroup); - var geoOtherComponentsGroup = geometry.FindChild("OtherComponentsGroup"); - var dimensionWalls = geoOtherComponentsGroup.FindChild("Terrain_DB_BrambleSphere_Outer_v2"); - dimensionWalls.transform.parent = geometry.transform; - GameObject.Destroy(geoOtherComponentsGroup); - */ + var newCollider = _wallCollision.InstantiateInactive(); + newCollider.transform.parent = dimensionWalls.transform; + newCollider.transform.localPosition = Vector3.zero; + newCollider.transform.localRotation = Quaternion.identity; + newCollider.transform.localScale = Vector3.one; + newCollider.SetActive(true); + } // fix some cull groups volumes.GetComponent()._sector = sector; diff --git a/NewHorizons/External/Modules/BrambleModule.cs b/NewHorizons/External/Modules/BrambleModule.cs index 207e69e9..407ad7bc 100644 --- a/NewHorizons/External/Modules/BrambleModule.cs +++ b/NewHorizons/External/Modules/BrambleModule.cs @@ -49,6 +49,12 @@ namespace NewHorizons.External.Modules /// [DefaultValue(750f)] public float radius = 750f; + /// + /// Whether this dimensions has vines. + /// Set to false if you want to create your own vines. + /// + [DefaultValue(true)] public bool hasVines = true; + /// /// An array of integers from 0-5. By default, all entrances are allowed. To force this dimension to warp players in from only one point (like the anglerfish nest dimension in the base game) set this value to [3], [5], or similar. Values of 0-5 only. /// diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index ecd9cce2..1d245d2c 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -12,7 +12,6 @@ namespace NewHorizons.Handlers { public static class VesselWarpHandler { - public static AssetBundle VesselBundle { get; private set; } public static GameObject VesselPrefab { get; private set; } public static GameObject VesselObject { get; private set; } public static VesselWarpController WarpController { get; private set; } @@ -22,8 +21,7 @@ namespace NewHorizons.Handlers public static void Initialize() { - VesselBundle = Instance.ModHelper.Assets.LoadBundle("Assets/newhorizons_private"); - VesselPrefab = VesselBundle.LoadAsset("Vessel_Body"); + VesselPrefab = Main.NHPrivateAssetBundle.LoadAsset("Vessel_Body"); } public static void LoadVessel() diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index b7e65415..d60478d1 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -37,6 +37,7 @@ 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 @@ -196,6 +197,7 @@ namespace NewHorizons GlobalMessenger.AddListener("WakeUp", OnWakeUp); NHAssetBundle = ModHelper.Assets.LoadBundle("Assets/newhorizons_public"); + NHPrivateAssetBundle = ModHelper.Assets.LoadBundle("Assets/newhorizons_private"); VesselWarpHandler.Initialize(); ResetConfigs(resetTranslation: false); diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index f84505df..a5c81d70 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -575,6 +575,11 @@ "format": "float", "default": 750.0 }, + "hasVines": { + "type": "boolean", + "description": "Whether this dimensions has vines.\nSet to false if you want to create your own vines.", + "default": true + }, "allowedEntrances": { "type": "array", "description": "An array of integers from 0-5. By default, all entrances are allowed. To force this dimension to warp players in from only one point (like the anglerfish nest dimension in the base game) set this value to [3], [5], or similar. Values of 0-5 only.",