mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make VanishVolumes never use shapes (#1090)
## Bug fixes - Fixed a bug where Vanish/DestructionVolumes no longer worked (they were trying to use sphere shapes when they can only use sphere colliders)
This commit is contained in:
commit
824f7e6d64
@ -13,7 +13,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static NewHorizons.External.Modules.BrambleModule;
|
using static NewHorizons.External.Modules.BrambleModule;
|
||||||
using static NewHorizons.External.Modules.SignalModule;
|
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Props
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External.Modules.Volumes.VolumeInfos;
|
using NewHorizons.External.Modules.Volumes.VolumeInfos;
|
||||||
|
using NewHorizons.Utility.OWML;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Volumes
|
namespace NewHorizons.Builder.Volumes
|
||||||
@ -7,9 +8,19 @@ namespace NewHorizons.Builder.Volumes
|
|||||||
{
|
{
|
||||||
public static TVolume Make<TVolume>(GameObject planetGO, Sector sector, VanishVolumeInfo info) where TVolume : VanishVolume
|
public static TVolume Make<TVolume>(GameObject planetGO, Sector sector, VanishVolumeInfo info) where TVolume : VanishVolume
|
||||||
{
|
{
|
||||||
|
if (info.shape != null && info.shape?.useShape == false)
|
||||||
|
{
|
||||||
|
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 a sphere with info.radius, just make sure it does so with a collider
|
||||||
|
info.shape ??= new();
|
||||||
|
info.shape.useShape = false;
|
||||||
|
|
||||||
var volume = VolumeBuilder.Make<TVolume>(planetGO, sector, info);
|
var volume = VolumeBuilder.Make<TVolume>(planetGO, sector, info);
|
||||||
|
|
||||||
var collider = volume.gameObject.GetComponent<SphereCollider>();
|
var collider = volume.gameObject.GetComponent<Collider>();
|
||||||
volume._collider = collider;
|
volume._collider = collider;
|
||||||
volume._shrinkBodies = info.shrinkBodies;
|
volume._shrinkBodies = info.shrinkBodies;
|
||||||
volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerRelatedBodies;
|
volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerRelatedBodies;
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace NewHorizons.Builder.Volumes
|
|||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TVolume Make<TVolume>(GameObject planetGO, Sector sector, VolumeInfo info) where TVolume : MonoBehaviour //Could be BaseVolume but I need to create vanilla volumes too.
|
public static TVolume Make<TVolume>(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);
|
var go = GeneralPropBuilder.MakeNew(typeof(TVolume).Name, planetGO, sector, info);
|
||||||
return MakeExisting<TVolume>(go, planetGO, sector, info);
|
return MakeExisting<TVolume>(go, planetGO, sector, info);
|
||||||
|
|||||||
@ -4,6 +4,9 @@ using System.ComponentModel;
|
|||||||
|
|
||||||
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Note: Only colliders work on vanish volumes!
|
||||||
|
/// </summary>
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class VanishVolumeInfo : VolumeInfo
|
public class VanishVolumeInfo : VolumeInfo
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
|
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, and friends",
|
||||||
"name": "New Horizons",
|
"name": "New Horizons",
|
||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "1.28.1",
|
"version": "1.28.2",
|
||||||
"owmlVersion": "2.12.1",
|
"owmlVersion": "2.12.1",
|
||||||
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||||
"conflicts": [ "PacificEngine.OW_CommonResources" ],
|
"conflicts": [ "PacificEngine.OW_CommonResources" ],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user