Forgot these can use any collider shape, just needs to be a collider

This commit is contained in:
xen-42 2025-04-25 11:55:30 -04:00
parent b20cda59e9
commit 38d1605fc0

View File

@ -8,20 +8,19 @@ namespace NewHorizons.Builder.Volumes
{
public static TVolume Make<TVolume>(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<TVolume>(planetGO, sector, info);
var collider = volume.gameObject.GetComponent<SphereCollider>();
var collider = volume.gameObject.GetComponent<Collider>();
volume._collider = collider;
volume._shrinkBodies = info.shrinkBodies;
volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerRelatedBodies;