diff --git a/NewHorizons/Components/NHGameOverManager.cs b/NewHorizons/Components/NHGameOverManager.cs index 0fe3dc08..37661562 100644 --- a/NewHorizons/Components/NHGameOverManager.cs +++ b/NewHorizons/Components/NHGameOverManager.cs @@ -165,7 +165,14 @@ namespace NewHorizons.Components // Patch new music clip var musicSource = Locator.FindObjectsOfType().Where(x => x.name == "AudioSource").Single(); // AudioSource that plays the credits music is literally called "AudioSource", luckily it's the only one called that. Lazy OW devs do be lazy. - AudioUtilities.SetAudioClip(musicSource, gameOver.audio, mod); + if (!string.IsNullOrEmpty(gameOver.audio)) // string.Empty is default value for "audio" in GameOverModule, means no audio is specified. + { + AudioUtilities.SetAudioClip(musicSource, gameOver.audio, mod); // Load audio if specified + } + else + { + musicSource.AssignAudioLibraryClip(AudioType.PLACEHOLDER); // Otherwise default custom credits are silent - AudioType.PLACEHOLDER is silence (apparently) + } musicSource.loop = gameOver.audioLooping; musicSource._maxSourceVolume = gameOver.audioVolume; diff --git a/NewHorizons/External/Modules/GameOverModule.cs b/NewHorizons/External/Modules/GameOverModule.cs index a844a190..5d73f4a3 100644 --- a/NewHorizons/External/Modules/GameOverModule.cs +++ b/NewHorizons/External/Modules/GameOverModule.cs @@ -26,6 +26,7 @@ namespace NewHorizons.External.Modules /// /// The audio to use for the credits music. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. + /// Credits will be silent unless this attribute is specified. /// Note: only applies when creditsType is set to "custom". /// public string audio; @@ -34,22 +35,19 @@ namespace NewHorizons.External.Modules /// The length of the fade in and out for the credits music. /// Note: only applies when creditsType is set to "custom". /// - [DefaultValue(1f)] - public float audioVolume; + [DefaultValue(1f)] public float audioVolume = 1f; /// /// Determines if the credits music should loop. /// Note: only applies when creditsType is set to "custom". /// - [DefaultValue(false)] - public bool audioLooping; + [DefaultValue(false)] public bool audioLooping = false; /// /// Duration of the credits scroll in seconds. /// Note: only applies when creditsType is set to "custom". /// - [DefaultValue(120f)] - public float length; + [DefaultValue(120f)] public float length = 120f; /// /// The type of credits that will run after the game over message is shown