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;
|
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 cloak = SearchUtilities.Find("RingWorld_Body/CloakingField_IP");
|
||||||
|
|
||||||
var newCloak = GameObject.Instantiate(cloak, sector?.transform ?? planetGO.transform);
|
var newCloak = GameObject.Instantiate(cloak, sector?.transform ?? planetGO.transform);
|
||||||
@ -59,11 +35,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var cloakAudioSource = newCloak.GetComponentInChildren<OWAudioSource>();
|
var cloakAudioSource = newCloak.GetComponentInChildren<OWAudioSource>();
|
||||||
cloakAudioSource._audioSource = cloakAudioSource.GetComponent<AudioSource>();
|
cloakAudioSource._audioSource = cloakAudioSource.GetComponent<AudioSource>();
|
||||||
cloakAudioSource._audioLibraryClip = AudioType.None;
|
bool hasCustomAudio = !string.IsNullOrEmpty(module.audio);
|
||||||
cloakAudioSource._clipArrayIndex = 0;
|
if (hasCustomAudio) AudioUtilities.SetAudioClip(cloakAudioSource, module.audio, mod);
|
||||||
cloakAudioSource._clipArrayLength = 0;
|
|
||||||
cloakAudioSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL;
|
|
||||||
cloakAudioSource.clip = clip;
|
|
||||||
|
|
||||||
newCloak.SetActive(true);
|
newCloak.SetActive(true);
|
||||||
cloakFieldController.enabled = true;
|
cloakFieldController.enabled = true;
|
||||||
@ -72,7 +45,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
// To cloak from the start
|
// To cloak from the start
|
||||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
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);
|
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;
|
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>
|
/// </summary>
|
||||||
public bool startHere;
|
public bool startHere;
|
||||||
|
|
||||||
/// <summary>
|
[System.Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
||||||
/// Name of an existing AudioClip in the game that will play when travelling in space.
|
|
||||||
/// </summary>
|
|
||||||
public string travelAudioClip;
|
public string travelAudioClip;
|
||||||
|
|
||||||
/// <summary>
|
[System.Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
||||||
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with travelAudioClip.
|
|
||||||
/// </summary>
|
|
||||||
public string travelAudioFilePath;
|
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>
|
/// <summary>
|
||||||
/// Coordinates that the vessel can use to warp to your solar system.
|
/// Coordinates that the vessel can use to warp to your solar system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -161,8 +162,7 @@ namespace NewHorizons.External.Configs
|
|||||||
// If current one is null take the other
|
// If current one is null take the other
|
||||||
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
|
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
|
||||||
skybox = skybox == null ? otherConfig.skybox : skybox;
|
skybox = skybox == null ? otherConfig.skybox : skybox;
|
||||||
travelAudioClip = string.IsNullOrEmpty(travelAudioClip) ? otherConfig.travelAudioClip : travelAudioClip;
|
travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio;
|
||||||
travelAudioFilePath = string.IsNullOrEmpty(travelAudioFilePath) ? otherConfig.travelAudioFilePath : travelAudioFilePath;
|
|
||||||
|
|
||||||
// False by default so if one is true go true
|
// False by default so if one is true go true
|
||||||
mapRestricted = mapRestricted || otherConfig.mapRestricted;
|
mapRestricted = mapRestricted || otherConfig.mapRestricted;
|
||||||
@ -178,5 +178,14 @@ namespace NewHorizons.External.Configs
|
|||||||
{
|
{
|
||||||
return (array1 ?? new T[0]).Concat(array2 ?? new T[0]).ToArray();
|
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>
|
/// </summary>
|
||||||
public float radius;
|
public float radius;
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("audioClip is deprecated, please use audio instead")]
|
||||||
/// Name of an existing AudioClip in the game that will play when entering the cloaking field.
|
|
||||||
/// </summary>
|
|
||||||
public string audioClip;
|
public string audioClip;
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("audioFilePath is deprecated, please use audio instead")]
|
||||||
/// Relative filepath to the .wav file to use as the audio. Mutually exclusive with audioClip.
|
|
||||||
/// </summary>
|
|
||||||
public string audioFilePath;
|
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>();
|
timeLoopController.AddComponent<TimeLoopController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioClip clip = null;
|
if (!string.IsNullOrEmpty(system.Config.travelAudio))
|
||||||
if (!string.IsNullOrEmpty(system.Config.travelAudioClip))
|
|
||||||
{
|
{
|
||||||
clip = SearchUtilities.FindResourceOfTypeAndName<AudioClip>(system.Config.travelAudioClip);
|
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AudioUtilities.SetAudioClip(Locator.GetGlobalMusicController()._travelSource, system.Config.travelAudio, system.Mod));
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -370,6 +370,7 @@ namespace NewHorizons
|
|||||||
|
|
||||||
var relativePath = file.Replace(folder, "");
|
var relativePath = file.Replace(folder, "");
|
||||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath);
|
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath);
|
||||||
|
starSystemConfig.Migrate();
|
||||||
starSystemConfig.FixCoordinates();
|
starSystemConfig.FixCoordinates();
|
||||||
|
|
||||||
if (starSystemConfig.startHere)
|
if (starSystemConfig.startHere)
|
||||||
@ -478,6 +479,7 @@ namespace NewHorizons
|
|||||||
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
|
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
|
||||||
else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");
|
else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");
|
||||||
|
|
||||||
|
starSystemConfig.Migrate();
|
||||||
starSystemConfig.FixCoordinates();
|
starSystemConfig.FixCoordinates();
|
||||||
|
|
||||||
var system = new NewHorizonsSystem(config.starSystem, starSystemConfig, mod);
|
var system = new NewHorizonsSystem(config.starSystem, starSystemConfig, mod);
|
||||||
|
|||||||
@ -18,7 +18,12 @@ namespace NewHorizons.Utility
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var clip = LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + audio);
|
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;
|
source.clip = clip;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user