mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Customizable Travel Audio (#31)
This commit is contained in:
parent
3634a58bdf
commit
f66829e240
10
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
10
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
@ -51,6 +51,16 @@ namespace NewHorizons.External.Configs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool startHere;
|
public bool startHere;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of an existing AudioClip in the game that will play when travelling in space.
|
||||||
|
/// </summary>
|
||||||
|
public string travelAudioClip;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with travelAudioClip.
|
||||||
|
/// </summary>
|
||||||
|
public string travelAudioFilePath;
|
||||||
|
|
||||||
public class NomaiCoordinates
|
public class NomaiCoordinates
|
||||||
{
|
{
|
||||||
public int[] x;
|
public int[] x;
|
||||||
|
|||||||
@ -26,6 +26,30 @@ namespace NewHorizons.Handlers
|
|||||||
var timeLoopController = new GameObject("TimeLoopController");
|
var timeLoopController = new GameObject("TimeLoopController");
|
||||||
timeLoopController.AddComponent<TimeLoopController>();
|
timeLoopController.AddComponent<TimeLoopController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioClip clip = null;
|
||||||
|
if (system.Config.travelAudioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(system.Config.travelAudioClip);
|
||||||
|
else if (system.Config.travelAudioFilePath != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
clip = AudioUtilities.LoadAudio(system.Mod.ModHelper.Manifest.ModFolderPath + "/" + system.Config.travelAudioFilePath);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Utility.Logger.LogError($"Couldn't load audio file {system.Config.travelAudioFilePath} : {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clip != null)
|
||||||
|
{
|
||||||
|
var travelSource = Locator.GetGlobalMusicController()._travelSource;
|
||||||
|
travelSource._audioLibraryClip = AudioType.None;
|
||||||
|
travelSource._clipArrayIndex = 0;
|
||||||
|
travelSource._clipArrayLength = 0;
|
||||||
|
travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||||
|
travelSource.clip = clip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,14 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star\nsystem."
|
"description": "Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star\nsystem."
|
||||||
},
|
},
|
||||||
|
"travelAudioClip": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Name of an existing AudioClip in the game that will play when travelling in space."
|
||||||
|
},
|
||||||
|
"travelAudioFilePath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Relative filepath to the .wav file to use as the audio. Mutually exclusive with travelAudioClip."
|
||||||
|
},
|
||||||
"$schema": {
|
"$schema": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The schema to validate with"
|
"description": "The schema to validate with"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user