mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixed undefined behaviour when custom credits attributes aren't specified (#1078)
## Bug fixes - Fixed undefined behaviour when custom credits attributes aren't specified
This commit is contained in:
commit
4c031f9df5
@ -165,7 +165,14 @@ namespace NewHorizons.Components
|
||||
|
||||
// Patch new music clip
|
||||
var musicSource = Locator.FindObjectsOfType<OWAudioSource>().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;
|
||||
|
||||
10
NewHorizons/External/Modules/GameOverModule.cs
vendored
10
NewHorizons/External/Modules/GameOverModule.cs
vendored
@ -26,6 +26,7 @@ namespace NewHorizons.External.Modules
|
||||
|
||||
/// <summary>
|
||||
/// 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".
|
||||
/// </summary>
|
||||
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".
|
||||
/// </summary>
|
||||
[DefaultValue(1f)]
|
||||
public float audioVolume;
|
||||
[DefaultValue(1f)] public float audioVolume = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the credits music should loop.
|
||||
/// Note: only applies when creditsType is set to "custom".
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
public bool audioLooping;
|
||||
[DefaultValue(false)] public bool audioLooping = false;
|
||||
|
||||
/// <summary>
|
||||
/// Duration of the credits scroll in seconds.
|
||||
/// Note: only applies when creditsType is set to "custom".
|
||||
/// </summary>
|
||||
[DefaultValue(120f)]
|
||||
public float length;
|
||||
[DefaultValue(120f)] public float length = 120f;
|
||||
|
||||
/// <summary>
|
||||
/// The type of credits that will run after the game over message is shown
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user