From 8b49f94bd46b0392b520536f9f5778fabf6dbbeb Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sun, 16 Feb 2025 23:25:46 -0600 Subject: [PATCH] Fix null item audio types breaking custom items --- NewHorizons/Builder/Props/ItemBuilder.cs | 8 ++++++++ NewHorizons/Components/Props/NHItem.cs | 1 + NewHorizons/External/Modules/Props/Item/ItemInfo.cs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/NewHorizons/Builder/Props/ItemBuilder.cs b/NewHorizons/Builder/Props/ItemBuilder.cs index 5d4dc7ba..f4992e8a 100644 --- a/NewHorizons/Builder/Props/ItemBuilder.cs +++ b/NewHorizons/Builder/Props/ItemBuilder.cs @@ -59,10 +59,18 @@ namespace NewHorizons.Builder.Props { item.PickupAudio = AudioTypeHandler.GetAudioType(info.pickupAudio, mod); } + else + { + item.PickupAudio = AudioType.ToolItemWarpCorePickUp; + } if (!string.IsNullOrEmpty(info.dropAudio)) { item.DropAudio = AudioTypeHandler.GetAudioType(info.dropAudio, mod); } + else + { + item.DropAudio = AudioType.ToolItemWarpCoreDrop; + } if (!string.IsNullOrEmpty(info.socketAudio)) { item.SocketAudio = AudioTypeHandler.GetAudioType(info.socketAudio, mod); diff --git a/NewHorizons/Components/Props/NHItem.cs b/NewHorizons/Components/Props/NHItem.cs index cdc783b5..98aed5d2 100644 --- a/NewHorizons/Components/Props/NHItem.cs +++ b/NewHorizons/Components/Props/NHItem.cs @@ -90,6 +90,7 @@ namespace NewHorizons.Components.Props void PlayCustomSound(AudioType audioType) { + if (audioType == AudioType.None) return; if (ItemBuilder.IsCustomItemType(ItemType)) { Locator.GetPlayerAudioController()._oneShotExternalSource.PlayOneShot(audioType); diff --git a/NewHorizons/External/Modules/Props/Item/ItemInfo.cs b/NewHorizons/External/Modules/Props/Item/ItemInfo.cs index 23253119..f837443a 100644 --- a/NewHorizons/External/Modules/Props/Item/ItemInfo.cs +++ b/NewHorizons/External/Modules/Props/Item/ItemInfo.cs @@ -62,21 +62,25 @@ namespace NewHorizons.External.Modules.Props.Item /// /// The audio to play when this item is picked up. Only applies to custom/non-vanilla item types. /// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// Defaults to "ToolItemWarpCorePickUp". Set to "None" to disable the sound entirely. /// public string pickupAudio; /// /// The audio to play when this item is dropped. Only applies to custom/non-vanilla item types. /// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// Defaults to "ToolItemWarpCoreDrop". Set to "None" to disable the sound entirely. /// public string dropAudio; /// /// The audio to play when this item is inserted into a socket. Only applies to custom/non-vanilla item types. /// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// Defaults to the pickup audio. Set to "None" to disable the sound entirely. /// public string socketAudio; /// /// The audio to play when this item is removed from a socket. Only applies to custom/non-vanilla item types. /// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// Defaults to the drop audio. Set to "None" to disable the sound entirely. /// public string unsocketAudio; ///