mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0e451127e6
@ -11,30 +11,6 @@ namespace NewHorizons.Builder.Body
|
||||
{
|
||||
var radius = module.radius;
|
||||
|
||||
AudioClip clip = null;
|
||||
if (!string.IsNullOrEmpty(module.audioClip))
|
||||
{
|
||||
clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(module.audioClip);
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Utility.Logger.LogError($"Couldn't get audio from clip [{module.audioClip}]");
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(module.audioFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + module.audioFilePath);
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Utility.Logger.LogError($"Couldn't get audio from file [{module.audioFilePath}]");
|
||||
}
|
||||
}
|
||||
|
||||
var cloak = SearchUtilities.Find("RingWorld_Body/CloakingField_IP");
|
||||
|
||||
var newCloak = GameObject.Instantiate(cloak, sector?.transform ?? planetGO.transform);
|
||||
@ -59,12 +35,9 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var cloakAudioSource = newCloak.GetComponentInChildren<OWAudioSource>();
|
||||
cloakAudioSource._audioSource = cloakAudioSource.GetComponent<AudioSource>();
|
||||
cloakAudioSource._audioLibraryClip = AudioType.None;
|
||||
cloakAudioSource._clipArrayIndex = 0;
|
||||
cloakAudioSource._clipArrayLength = 0;
|
||||
cloakAudioSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||
cloakAudioSource.clip = clip;
|
||||
|
||||
bool hasCustomAudio = !string.IsNullOrEmpty(module.audio);
|
||||
if (hasCustomAudio) AudioUtilities.SetAudioClip(cloakAudioSource, module.audio, mod);
|
||||
|
||||
newCloak.SetActive(true);
|
||||
cloakFieldController.enabled = true;
|
||||
|
||||
@ -72,7 +45,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
// To cloak from the start
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(clip != null ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(hasCustomAudio ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(keepReferenceFrame ? cloakSectorController.EnableReferenceFrameVolume : cloakSectorController.DisableReferenceFrameVolume);
|
||||
}
|
||||
}
|
||||
|
||||
7
NewHorizons/External/Configs/PlanetConfig.cs
vendored
7
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -351,6 +351,13 @@ namespace NewHorizons.External.Configs
|
||||
if (!string.IsNullOrEmpty(signal.audioFilePath)) signal.audio = signal.audioFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
// Cloak
|
||||
if (Cloak != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Cloak.audioClip)) Cloak.audio = Cloak.audioClip;
|
||||
if (!string.IsNullOrEmpty(Cloak.audioFilePath)) Cloak.audio = Cloak.audioFilePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
25
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
@ -50,16 +50,17 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public bool startHere;
|
||||
|
||||
/// <summary>
|
||||
/// Name of an existing AudioClip in the game that will play when travelling in space.
|
||||
/// </summary>
|
||||
[System.Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
||||
public string travelAudioClip;
|
||||
|
||||
/// <summary>
|
||||
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with travelAudioClip.
|
||||
/// </summary>
|
||||
[System.Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
||||
public string travelAudioFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// The audio that will play when travelling in space. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
||||
/// </summary>
|
||||
public string travelAudio;
|
||||
|
||||
/// <summary>
|
||||
/// Coordinates that the vessel can use to warp to your solar system.
|
||||
/// </summary>
|
||||
@ -161,8 +162,7 @@ namespace NewHorizons.External.Configs
|
||||
// If current one is null take the other
|
||||
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
|
||||
skybox = skybox == null ? otherConfig.skybox : skybox;
|
||||
travelAudioClip = string.IsNullOrEmpty(travelAudioClip) ? otherConfig.travelAudioClip : travelAudioClip;
|
||||
travelAudioFilePath = string.IsNullOrEmpty(travelAudioFilePath) ? otherConfig.travelAudioFilePath : travelAudioFilePath;
|
||||
travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio;
|
||||
|
||||
// False by default so if one is true go true
|
||||
mapRestricted = mapRestricted || otherConfig.mapRestricted;
|
||||
@ -178,5 +178,14 @@ namespace NewHorizons.External.Configs
|
||||
{
|
||||
return (array1 ?? new T[0]).Concat(array2 ?? new T[0]).ToArray();
|
||||
}
|
||||
|
||||
public void Migrate()
|
||||
{
|
||||
// Backwards compatability
|
||||
// Should be the only place that obsolete things are referenced
|
||||
#pragma warning disable 612, 618
|
||||
if (!string.IsNullOrEmpty(travelAudioClip)) travelAudio = travelAudioClip;
|
||||
if (!string.IsNullOrEmpty(travelAudioFilePath)) travelAudio = travelAudioFilePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
NewHorizons/External/Modules/CloakModule.cs
vendored
13
NewHorizons/External/Modules/CloakModule.cs
vendored
@ -16,14 +16,15 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public float radius;
|
||||
|
||||
/// <summary>
|
||||
/// Name of an existing AudioClip in the game that will play when entering the cloaking field.
|
||||
/// </summary>
|
||||
[Obsolete("audioClip is deprecated, please use audio 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 audio instead")]
|
||||
public string audioFilePath;
|
||||
|
||||
/// <summary>
|
||||
/// The audio that will play when entering the cloaking field. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
||||
/// </summary>
|
||||
public string audio;
|
||||
}
|
||||
}
|
||||
@ -28,41 +28,9 @@ namespace NewHorizons.Handlers
|
||||
timeLoopController.AddComponent<TimeLoopController>();
|
||||
}
|
||||
|
||||
AudioClip clip = null;
|
||||
if (!string.IsNullOrEmpty(system.Config.travelAudioClip))
|
||||
if (!string.IsNullOrEmpty(system.Config.travelAudio))
|
||||
{
|
||||
clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(system.Config.travelAudioClip);
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}]");
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(system.Config.travelAudioFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
clip = AudioUtilities.LoadAudio(system.Mod.ModHelper.Manifest.ModFolderPath + "/" + system.Config.travelAudioFilePath);
|
||||
}
|
||||
catch { }
|
||||
|
||||
if (clip == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't get audio from file [{system.Config.travelAudioFilePath}]");
|
||||
}
|
||||
}
|
||||
|
||||
if (clip != null)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
{
|
||||
var travelSource = Locator.GetGlobalMusicController()._travelSource;
|
||||
travelSource._audioLibraryClip = AudioType.None;
|
||||
travelSource._clipArrayIndex = 0;
|
||||
travelSource._clipArrayLength = 0;
|
||||
travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||
travelSource.clip = clip;
|
||||
});
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AudioUtilities.SetAudioClip(Locator.GetGlobalMusicController()._travelSource, system.Config.travelAudio, system.Mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,6 +370,7 @@ namespace NewHorizons
|
||||
|
||||
var relativePath = file.Replace(folder, "");
|
||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath);
|
||||
starSystemConfig.Migrate();
|
||||
starSystemConfig.FixCoordinates();
|
||||
|
||||
if (starSystemConfig.startHere)
|
||||
@ -478,6 +479,7 @@ namespace NewHorizons
|
||||
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
|
||||
else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");
|
||||
|
||||
starSystemConfig.Migrate();
|
||||
starSystemConfig.FixCoordinates();
|
||||
|
||||
var system = new NewHorizonsSystem(config.starSystem, starSystemConfig, mod);
|
||||
|
||||
@ -18,7 +18,12 @@ namespace NewHorizons.Utility
|
||||
try
|
||||
{
|
||||
var clip = LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + audio);
|
||||
source._audioLibraryClip = AudioType.None;
|
||||
source._clipArrayIndex = 0;
|
||||
source._clipArrayLength = 0;
|
||||
source._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
||||
source.clip = clip;
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user