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
This commit is contained in:
parent
53d20525bd
commit
0b65c852d2
@ -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 (gameOver.audio != string.Empty) // 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
|
||||
}
|
||||
|
||||
musicSource.loop = gameOver.audioLooping;
|
||||
musicSource._maxSourceVolume = gameOver.audioVolume;
|
||||
|
||||
13
NewHorizons/External/Modules/GameOverModule.cs
vendored
13
NewHorizons/External/Modules/GameOverModule.cs
vendored
@ -22,34 +22,31 @@ namespace NewHorizons.External.Modules
|
||||
/// Condition that must be true for this game over to trigger. If this is on a LoadCreditsVolume, leave empty to always trigger this game over.
|
||||
/// Note this is a regular dialogue condition, not a persistent condition.
|
||||
/// </summary>
|
||||
public string condition;
|
||||
public string condition;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the audio file to use as custom music for the credits.
|
||||
/// Note: only applies when creditsType is set to "custom".
|
||||
/// </summary>
|
||||
public string audio;
|
||||
public string audio = string.Empty; // Explicitly declaring this for condition in NHGameOverManager
|
||||
|
||||
/// <summary>
|
||||
/// 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