mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Use new audio setting method for signals, unify audioClip and audioFilePath
This commit is contained in:
parent
2a3ffcc268
commit
5a4f5ac207
@ -153,23 +153,6 @@ namespace NewHorizons.Builder.Props
|
||||
var frequency = StringToFrequency(info.frequency);
|
||||
var name = StringToSignalName(info.name);
|
||||
|
||||
AudioClip clip = null;
|
||||
if (!string.IsNullOrEmpty(info.audioClip)) clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(info.audioClip);
|
||||
else if (!string.IsNullOrEmpty(info.audioFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.audioFilePath);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't find AudioClip {info.audioClip} or AudioFile {info.audioFilePath}");
|
||||
return null;
|
||||
}
|
||||
|
||||
audioSignal.SetSector(sector);
|
||||
|
||||
if (name == SignalName.Default) audioSignal._preventIdentification = true;
|
||||
@ -183,7 +166,6 @@ namespace NewHorizons.Builder.Props
|
||||
audioSignal._canBePickedUpByScope = true;
|
||||
audioSignal._outerFogWarpVolume = planetGO.GetComponentInChildren<OuterFogWarpVolume>(); // shouldn't break non-bramble signals
|
||||
|
||||
source.clip = clip;
|
||||
source.loop = true;
|
||||
source.minDistance = 0;
|
||||
source.maxDistance = 30;
|
||||
@ -201,6 +183,7 @@ namespace NewHorizons.Builder.Props
|
||||
source.dopplerLevel = 0;
|
||||
|
||||
owAudioSource.SetTrack(OWAudioMixer.TrackName.Signal);
|
||||
AudioUtilities.SetAudioClip(owAudioSource, info.audio, mod);
|
||||
|
||||
// Frequency detection trigger volume
|
||||
|
||||
|
||||
16
NewHorizons/External/Modules/SignalModule.cs
vendored
16
NewHorizons/External/Modules/SignalModule.cs
vendored
@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json;
|
||||
@ -16,16 +17,17 @@ namespace NewHorizons.External.Modules
|
||||
[JsonObject]
|
||||
public class SignalInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Name of an existing AudioClip in the game that will player over the signal.
|
||||
/// </summary>
|
||||
[Obsolete("audioClip is deprecated, please use RemoveChildren instead")]
|
||||
public string audioClip;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with audioClip.
|
||||
/// </summary>
|
||||
[Obsolete("audioFilePath is deprecated, please use RemoveChildren instead")]
|
||||
public string audioFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// The audio to use. Can be a path to a .wav or .ogg file, or taken from the AudioClip list.
|
||||
/// </summary>
|
||||
public string audio;
|
||||
|
||||
/// <summary>
|
||||
/// How close the player must get to the signal to detect it. This is when you get the "Unknown Signal Detected"
|
||||
/// notification.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user