mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add vinePrefab option
This commit is contained in:
parent
041e915fa5
commit
60dee93792
@ -51,7 +51,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
private static GameObject _atmosphere;
|
private static GameObject _atmosphere;
|
||||||
private static GameObject _volumes;
|
private static GameObject _volumes;
|
||||||
private static GameObject _effects;
|
private static GameObject _effects;
|
||||||
private static GameObject _geometry;
|
private static GameObject _hubGeometry;
|
||||||
|
private static GameObject _clusterGeometry;
|
||||||
|
private static GameObject _smallNestGeometry;
|
||||||
|
private static GameObject _exitOnlyGeometry;
|
||||||
private static GameObject _exitWarps;
|
private static GameObject _exitWarps;
|
||||||
private static GameObject _repelVolume;
|
private static GameObject _repelVolume;
|
||||||
private static Material _material;
|
private static Material _material;
|
||||||
@ -68,7 +71,10 @@ namespace NewHorizons.Builder.Body
|
|||||||
if (_atmosphere == null) _atmosphere = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Atmosphere_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Atmosphere").DontDestroyOnLoad();
|
if (_atmosphere == null) _atmosphere = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Atmosphere_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Atmosphere").DontDestroyOnLoad();
|
||||||
if (_volumes == null) _volumes = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Volumes_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Volumes").DontDestroyOnLoad();
|
if (_volumes == null) _volumes = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Volumes_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Volumes").DontDestroyOnLoad();
|
||||||
if (_effects == null) _effects = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Effects_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Effects").DontDestroyOnLoad();
|
if (_effects == null) _effects = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Effects_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Effects").DontDestroyOnLoad();
|
||||||
if (_geometry == null) _geometry = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Geometry_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_Geometry").DontDestroyOnLoad();
|
if (_hubGeometry == null) _hubGeometry = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Geometry_HubDimension").InstantiateInactive().Rename("Prefab_Bramble_HubGeometry").DontDestroyOnLoad();
|
||||||
|
if (_clusterGeometry == null) _clusterGeometry = SearchUtilities.Find("DB_ClusterDimension_Body/Sector_ClusterDimension/Geometry_ClusterDimension").InstantiateInactive().Rename("Prefab_Bramble_ClusterGeometry").DontDestroyOnLoad();
|
||||||
|
if (_smallNestGeometry == null) _smallNestGeometry = SearchUtilities.Find("DB_SmallNest_Body/Sector_SmallNestDimension/Geometry_SmallNestDimension").InstantiateInactive().Rename("Prefab_Bramble_SmallNestGeometry").DontDestroyOnLoad();
|
||||||
|
if (_exitOnlyGeometry == null) _exitOnlyGeometry = SearchUtilities.Find("DB_ExitOnlyDimension_Body/Sector_ExitOnlyDimension/Geometry_ExitOnlyDimension").InstantiateInactive().Rename("Prefab_Bramble_ExitOnlyGeometry").DontDestroyOnLoad();
|
||||||
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();
|
||||||
@ -88,8 +94,17 @@ namespace NewHorizons.Builder.Body
|
|||||||
var volumes = _volumes.InstantiateInactive();
|
var volumes = _volumes.InstantiateInactive();
|
||||||
var effects = _effects.InstantiateInactive();
|
var effects = _effects.InstantiateInactive();
|
||||||
|
|
||||||
|
GameObject geometryPrefab;
|
||||||
|
switch (config.vinePrefab)
|
||||||
|
{
|
||||||
|
case VinePrefabType.Cluster: geometryPrefab = _clusterGeometry; break;
|
||||||
|
case VinePrefabType.SmallNest: geometryPrefab = _smallNestGeometry; break;
|
||||||
|
case VinePrefabType.ExitOnly: geometryPrefab = _exitOnlyGeometry; break;
|
||||||
|
default: geometryPrefab = _hubGeometry; break;
|
||||||
|
}
|
||||||
|
|
||||||
var detailInfo = new PropModule.DetailInfo();
|
var detailInfo = new PropModule.DetailInfo();
|
||||||
var geometry = DetailBuilder.Make(go, sector, _geometry, detailInfo);
|
var geometry = DetailBuilder.Make(go, sector, geometryPrefab, detailInfo);
|
||||||
|
|
||||||
var exitWarps = _exitWarps.InstantiateInactive();
|
var exitWarps = _exitWarps.InstantiateInactive();
|
||||||
var repelVolume = _repelVolume.InstantiateInactive();
|
var repelVolume = _repelVolume.InstantiateInactive();
|
||||||
@ -118,9 +133,9 @@ namespace NewHorizons.Builder.Body
|
|||||||
repelVolume.transform.parent = sector.transform;
|
repelVolume.transform.parent = sector.transform;
|
||||||
repelVolume.transform.localPosition = Vector3.zero;
|
repelVolume.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
// Replace batched collision with our own if removing vines
|
if (config.vinePrefab == VinePrefabType.None)
|
||||||
if (!config.hasVines)
|
|
||||||
{
|
{
|
||||||
|
// Replace batched collision with our own if removing vines
|
||||||
GameObject.Destroy(geometry.FindChild("BatchedGroup"));
|
GameObject.Destroy(geometry.FindChild("BatchedGroup"));
|
||||||
var geoOtherComponentsGroup = geometry.FindChild("OtherComponentsGroup");
|
var geoOtherComponentsGroup = geometry.FindChild("OtherComponentsGroup");
|
||||||
var dimensionWalls = geoOtherComponentsGroup.FindChild("Terrain_DB_BrambleSphere_Outer_v2");
|
var dimensionWalls = geoOtherComponentsGroup.FindChild("Terrain_DB_BrambleSphere_Outer_v2");
|
||||||
@ -134,6 +149,11 @@ namespace NewHorizons.Builder.Body
|
|||||||
newCollider.transform.localScale = Vector3.one;
|
newCollider.transform.localScale = Vector3.one;
|
||||||
newCollider.SetActive(true);
|
newCollider.SetActive(true);
|
||||||
}
|
}
|
||||||
|
else if (config.vinePrefab != VinePrefabType.Hub)
|
||||||
|
{
|
||||||
|
// Other stuff depends on Hub having this rotation
|
||||||
|
geometry.transform.rotation = Quaternion.Euler(new Vector3(43.5599f, 358.1138f, 24.2412f));
|
||||||
|
}
|
||||||
|
|
||||||
// fix some cull groups
|
// fix some cull groups
|
||||||
volumes.GetComponent<SectorCollisionGroup>()._sector = sector;
|
volumes.GetComponent<SectorCollisionGroup>()._sector = sector;
|
||||||
@ -191,6 +211,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
// Set the scale
|
// Set the scale
|
||||||
var scale = config.radius / BASE_DIMENSION_RADIUS;
|
var scale = config.radius / BASE_DIMENSION_RADIUS;
|
||||||
geometry.transform.localScale = Vector3.one * scale;
|
geometry.transform.localScale = Vector3.one * scale;
|
||||||
|
if (config.vinePrefab is not VinePrefabType.None and not VinePrefabType.Hub) geometry.transform.localScale *= 1.5f; // other dimensions are 500 instead of 750
|
||||||
sector.gameObject.GetComponent<SphereShape>().radius *= scale;
|
sector.gameObject.GetComponent<SphereShape>().radius *= scale;
|
||||||
outerFogWarpVolume._warpRadius *= scale;
|
outerFogWarpVolume._warpRadius *= scale;
|
||||||
outerFogWarpVolume._exitRadius *= scale;
|
outerFogWarpVolume._exitRadius *= scale;
|
||||||
|
|||||||
23
NewHorizons/External/Modules/BrambleModule.cs
vendored
23
NewHorizons/External/Modules/BrambleModule.cs
vendored
@ -1,15 +1,30 @@
|
|||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace NewHorizons.External.Modules
|
namespace NewHorizons.External.Modules
|
||||||
{
|
{
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum VinePrefabType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = @"none")] None = 0,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"hub")] Hub = 1,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"cluster")] Cluster = 2,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"smallNest")] SmallNest = 3,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"exitOnly")] ExitOnly = 4
|
||||||
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class BrambleModule
|
public class BrambleModule
|
||||||
{
|
{
|
||||||
@ -50,10 +65,10 @@ namespace NewHorizons.External.Modules
|
|||||||
[DefaultValue(750f)] public float radius = 750f;
|
[DefaultValue(750f)] public float radius = 750f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this dimensions has vines.
|
/// The dimension the vines will be copied from.
|
||||||
/// Set to false if you want to create your own vines.
|
/// Only a handful are available due to batched colliders.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)] public bool hasVines = true;
|
[DefaultValue("hub")] public VinePrefabType vinePrefab = VinePrefabType.Hub;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
/// 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.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user