From b20cda59e9534e529d372989d74bf53b156f240f Mon Sep 17 00:00:00 2001 From: xen-42 Date: Fri, 25 Apr 2025 11:48:48 -0400 Subject: [PATCH 1/4] Make VanishVolumes never use shapes --- NewHorizons/Builder/Props/BrambleNodeBuilder.cs | 1 - NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs | 12 ++++++++++++ NewHorizons/Builder/Volumes/VolumeBuilder.cs | 2 +- .../Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs | 3 +++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index 45724ab4..5633ff06 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -13,7 +13,6 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; using static NewHorizons.External.Modules.BrambleModule; -using static NewHorizons.External.Modules.SignalModule; namespace NewHorizons.Builder.Props { diff --git a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs index 4b312a60..041bf942 100644 --- a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs @@ -1,4 +1,5 @@ using NewHorizons.External.Modules.Volumes.VolumeInfos; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Builder.Volumes @@ -7,6 +8,17 @@ namespace NewHorizons.Builder.Volumes { public static TVolume Make(GameObject planetGO, Sector sector, VanishVolumeInfo info) where TVolume : VanishVolume { + if (info.shape != null && (info.shape?.type != External.Modules.Props.ShapeType.Sphere || info.shape?.useShape == false)) + { + NHLogger.LogError($"Destruction/VanishVolumes only support sphere colliders. Affects planet [{planetGO.name}]"); + } + + // VanishVolume is only compatible with sphere colliders + // If info.shape was null, it will still default to using info.radius, just make sure it does so with a collider + info.shape ??= new(); + info.shape.useShape = false; + info.shape.type = External.Modules.Props.ShapeType.Sphere; + var volume = VolumeBuilder.Make(planetGO, sector, info); var collider = volume.gameObject.GetComponent(); diff --git a/NewHorizons/Builder/Volumes/VolumeBuilder.cs b/NewHorizons/Builder/Volumes/VolumeBuilder.cs index b9e61394..d9d28607 100644 --- a/NewHorizons/Builder/Volumes/VolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VolumeBuilder.cs @@ -45,7 +45,7 @@ namespace NewHorizons.Builder.Volumes return volume; } - public static TVolume Make(GameObject planetGO, Sector sector, VolumeInfo info) where TVolume : MonoBehaviour //Could be BaseVolume but I need to create vanilla volumes too. + public static TVolume Make(GameObject planetGO, Sector sector, VolumeInfo info) where TVolume : MonoBehaviour // Could be BaseVolume but I need to create vanilla volumes too. { var go = GeneralPropBuilder.MakeNew(typeof(TVolume).Name, planetGO, sector, info); return MakeExisting(go, planetGO, sector, info); diff --git a/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs b/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs index bb66b0a8..9287a87f 100644 --- a/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs +++ b/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs @@ -4,6 +4,9 @@ using System.ComponentModel; namespace NewHorizons.External.Modules.Volumes.VolumeInfos { + /// + /// Note: Only sphere colliders work on vanish volumes! + /// [JsonObject] public class VanishVolumeInfo : VolumeInfo { From 38d1605fc0a4ec0bb5bdf2825f93da8072584cfc Mon Sep 17 00:00:00 2001 From: xen-42 Date: Fri, 25 Apr 2025 11:55:30 -0400 Subject: [PATCH 2/4] Forgot these can use any collider shape, just needs to be a collider --- NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs index 041bf942..cca70c4a 100644 --- a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs @@ -8,20 +8,19 @@ namespace NewHorizons.Builder.Volumes { public static TVolume Make(GameObject planetGO, Sector sector, VanishVolumeInfo info) where TVolume : VanishVolume { - if (info.shape != null && (info.shape?.type != External.Modules.Props.ShapeType.Sphere || info.shape?.useShape == false)) + if (info.shape != null && info.shape?.useShape == false) { - NHLogger.LogError($"Destruction/VanishVolumes only support sphere colliders. Affects planet [{planetGO.name}]"); + NHLogger.LogError($"Destruction/VanishVolumes only support colliders. Affects planet [{planetGO.name}]. Set useShape to false."); } // VanishVolume is only compatible with sphere colliders - // If info.shape was null, it will still default to using info.radius, just make sure it does so with a collider + // If info.shape was null, it will still default to using a sphere with info.radius, just make sure it does so with a collider info.shape ??= new(); info.shape.useShape = false; - info.shape.type = External.Modules.Props.ShapeType.Sphere; var volume = VolumeBuilder.Make(planetGO, sector, info); - var collider = volume.gameObject.GetComponent(); + var collider = volume.gameObject.GetComponent(); volume._collider = collider; volume._shrinkBodies = info.shrinkBodies; volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerRelatedBodies; From 2ffca2b71000b7b563157a32e6647983aa5d5eb5 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Fri, 25 Apr 2025 11:56:34 -0400 Subject: [PATCH 3/4] Update VanishVolumeInfo.cs --- .../External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs b/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs index 9287a87f..95c85078 100644 --- a/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs +++ b/NewHorizons/External/Modules/Volumes/VolumeInfos/VanishVolumeInfo.cs @@ -5,7 +5,7 @@ using System.ComponentModel; namespace NewHorizons.External.Modules.Volumes.VolumeInfos { /// - /// Note: Only sphere colliders work on vanish volumes! + /// Note: Only colliders work on vanish volumes! /// [JsonObject] public class VanishVolumeInfo : VolumeInfo From a5c3a822c14cf67a6f7f5accdc4916b8b50d288d Mon Sep 17 00:00:00 2001 From: xen-42 Date: Fri, 25 Apr 2025 11:56:57 -0400 Subject: [PATCH 4/4] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index c60497a8..39a8fea3 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.28.1", + "version": "1.28.2", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],