From c726b089e879fa83ff5406c0f7b5822ad2135d16 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 25 Jan 2025 06:36:19 -0500 Subject: [PATCH] do ambience too because might as well --- NewHorizons/External/Configs/TitleScreenConfig.cs | 7 ++++++- NewHorizons/Handlers/TitleSceneHandler.cs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NewHorizons/External/Configs/TitleScreenConfig.cs b/NewHorizons/External/Configs/TitleScreenConfig.cs index 3ae2f0ee..92ef0bbb 100644 --- a/NewHorizons/External/Configs/TitleScreenConfig.cs +++ b/NewHorizons/External/Configs/TitleScreenConfig.cs @@ -40,10 +40,15 @@ namespace NewHorizons.External.Configs public SkyboxModule Skybox; /// - /// Relative path to music to replace the title screen music with. + /// The music audio that will play on the title screen. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. /// public string music; + /// + /// The ambience audio that will play on the title screen. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// + public string ambience; + /// /// Changes the speed the main menu planet and the skybox rotates. /// diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 8d04e7fa..9f72f6b9 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -60,6 +60,13 @@ namespace NewHorizons.Handlers Delay.FireOnNextUpdate(() => musicSource.AssignAudioLibraryClip(audioType)); } + if (!string.IsNullOrEmpty(config.ambience)) + { + var ambienceSource = SearchUtilities.Find("Scene/AudioSource_Ambience").GetComponent(); + var audioType = AudioTypeHandler.GetAudioType(config.ambience, mod); + Delay.FireOnNextUpdate(() => ambienceSource.AssignAudioLibraryClip(audioType)); + } + if (config.MenuPlanet != null) { if (config.MenuPlanet.destroyMenuPlanet)