Add colliders to custom item sockets

This commit is contained in:
xen-42 2024-10-20 02:18:51 -04:00
parent a5e0f98e75
commit 65dbc6816b
3 changed files with 11 additions and 9 deletions

View File

@ -143,6 +143,11 @@ namespace NewHorizons.Builder.Props
if (socket._socketTransform == null)
{
var socketGO = GeneralPropBuilder.MakeNew("Socket", planetGO, sector, info, defaultParent: go.transform);
if (info.colliderRadius > 0f)
{
go.AddComponent<SphereCollider>().radius = info.colliderRadius;
go.GetAddComponent<OWCollider>();
}
socketGO.SetActive(true);
socket._socketTransform = socketGO.transform;
}

View File

@ -1,13 +1,5 @@
using NewHorizons.External.SerializableData;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Modules.Props.Item
{
@ -54,5 +46,10 @@ namespace NewHorizons.External.Modules.Props.Item
/// A ship log fact to reveal when removing an item from this socket, or when the socket is empty.
/// </summary>
public string removalFact;
/// <summary>
/// Default collider radius when interacting with the socket
/// </summary>
[DefaultValue(0f)]
public float colliderRadius = 0f;
}
}

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, Trifid, and friends",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.24.0",
"version": "1.24.1",
"owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ],