From 6d1bbfb84eaede37034105e7ad36705fb3c172ca Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Mon, 30 Oct 2023 23:29:10 -0500 Subject: [PATCH] Info data structures for item and item socket --- .../External/Modules/Props/DetailInfo.cs | 11 ++++ .../External/Modules/Props/Item/ItemInfo.cs | 54 +++++++++++++++++++ .../Modules/Props/Item/ItemSocketInfo.cs | 50 +++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 NewHorizons/External/Modules/Props/Item/ItemInfo.cs create mode 100644 NewHorizons/External/Modules/Props/Item/ItemSocketInfo.cs diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 48b3b125..d9654562 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -1,3 +1,4 @@ +using NewHorizons.External.Modules.Props.Item; using NewHorizons.External.SerializableData; using Newtonsoft.Json; using System; @@ -101,6 +102,16 @@ namespace NewHorizons.External.Modules.Props /// [DefaultValue(true)] public bool blinkWhenActiveChanged = true; + /// + /// Should this detail be treated as an interactible item + /// + public ItemInfo item; + + /// + /// Should this detail be treated as a socket for an interactible item + /// + public ItemSocketInfo itemSocket; + [Obsolete("alignToNormal is deprecated. Use alignRadial instead")] public bool alignToNormal; } diff --git a/NewHorizons/External/Modules/Props/Item/ItemInfo.cs b/NewHorizons/External/Modules/Props/Item/ItemInfo.cs new file mode 100644 index 00000000..5728e2a5 --- /dev/null +++ b/NewHorizons/External/Modules/Props/Item/ItemInfo.cs @@ -0,0 +1,54 @@ +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 +{ + [JsonObject] + public class ItemInfo + { + /// + /// The name of the item to be displayed in the UI. Defaults to the name of the detail object. + /// + public string name; + /// + /// The type of the item, which determines its orientation when held and what sockets it fits into. This can be a custom string, or a vanilla ItemType (Scroll, WarpCode, SharedStone, ConversationStone, Lantern, SlideReel, DreamLantern, or VisionTorch). Defaults to the item name. + /// + public string itemType; + /// + /// The furthest distance where the player can interact with this item. Defaults to two meters, same as most vanilla items. Set this to zero to disable all interaction by default. + /// + [DefaultValue(2f)] public float interactRange = 2f; + /// + /// Whether the item can be dropped. Defaults to true. + /// + [DefaultValue(true)] public bool droppable = true; + /// + /// A relative offset to apply to the item's position when dropping it on the ground. + /// + public MVector3 dropOffset; + /// + /// The direction the item will be oriented when dropping it on the ground. Defaults to up (0, 1, 0). + /// + public MVector3 dropNormal; + /// + /// A dialogue condition to set when picking up this item. + /// + public string pickupCondition; + /// + /// Whether the pickup condition should be cleared when dropping the item. Defaults to true. + /// + [DefaultValue(true)] public bool clearPickupConditionOnDrop = true; + /// + /// A relative path from the planet to a socket that this item will be automatically inserted into. + /// + public string pathToInitialSocket; + } +} diff --git a/NewHorizons/External/Modules/Props/Item/ItemSocketInfo.cs b/NewHorizons/External/Modules/Props/Item/ItemSocketInfo.cs new file mode 100644 index 00000000..c7a2b3b2 --- /dev/null +++ b/NewHorizons/External/Modules/Props/Item/ItemSocketInfo.cs @@ -0,0 +1,50 @@ +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 +{ + [JsonObject] + public class ItemSocketInfo : GeneralPropInfo + { + /// + /// The relative path to a child game object of this detail that will act as the socket point for the item. Will be used instead of this socket's positioning info if set. + /// + public string socketPath; + /// + /// The type of item allowed in this socket. This can be a custom string, or a vanilla ItemType (Scroll, WarpCode, SharedStone, ConversationStone, Lantern, SlideReel, DreamLantern, or VisionTorch). + /// + public string itemType; + /// + /// The furthest distance where the player can interact with this item socket. Defaults to two meters, same as most vanilla item sockets. Set this to zero to disable all interaction by default. + /// + [DefaultValue(2f)] public float interactRange = 2f; + /// + /// Whether to use "Give Item" / "Take Item" prompts instead of "Insert Item" / "Remove Item". + /// + public bool useGiveTakePrompts; + /// + /// A dialogue condition to set when inserting an item into this socket. + /// + public string insertCondition; + /// + /// Whether the insert condition should be cleared when removing the socketed item. Defaults to true. + /// + [DefaultValue(true)] public bool clearInsertConditionOnRemoval = true; + /// + /// A dialogue condition to set when removing an item from this socket, or when the socket is empty. + /// + public string removalCondition; + /// + /// Whether the removal condition should be cleared when inserting a socketed item. Defaults to true. + /// + [DefaultValue(true)] public bool clearRemovalConditionOnInsert = true; + } +}