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
434cb6cbb5
@ -44,9 +44,9 @@ namespace NewHorizons.Builder.Body
|
||||
cloakSectorController.EnableCloak();
|
||||
|
||||
// To cloak from the start
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(hasCustomAudio ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(keepReferenceFrame ? cloakSectorController.EnableReferenceFrameVolume : cloakSectorController.DisableReferenceFrameVolume);
|
||||
Delay.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
||||
Delay.FireOnNextUpdate(hasCustomAudio ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
||||
Delay.FireOnNextUpdate(keepReferenceFrame ? cloakSectorController.EnableReferenceFrameVolume : cloakSectorController.DisableReferenceFrameVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ namespace NewHorizons.Builder.Body
|
||||
funnelSizeController.anchor = planetGO.transform;
|
||||
|
||||
// Finish up next tick
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PostMake(funnelGO, funnelSizeController, module));
|
||||
Delay.FireOnNextUpdate(() => PostMake(funnelGO, funnelSizeController, module));
|
||||
}
|
||||
|
||||
private static void PostMake(GameObject funnelGO, FunnelController funnelSizeController, FunnelModule module)
|
||||
|
||||
@ -55,7 +55,7 @@ namespace NewHorizons.Builder.Body
|
||||
OLC._ambientLight = GDOLC._ambientLight; // this needs to be set or else is black
|
||||
|
||||
// trigger sector enter
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
Delay.FireOnNextUpdate(() =>
|
||||
{
|
||||
OEC._active = true;
|
||||
OEC.enabled = true;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.Utility;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
namespace NewHorizons.Builder.General
|
||||
@ -51,7 +52,7 @@ namespace NewHorizons.Builder.General
|
||||
{
|
||||
Logger.Log($"Setting center of universe to {config.name}");
|
||||
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(
|
||||
Delay.RunWhen(
|
||||
() => Locator._centerOfTheUniverse != null,
|
||||
() => Locator._centerOfTheUniverse._staticReferenceFrame = astroObject.GetComponent<OWRigidbody>()
|
||||
);
|
||||
|
||||
@ -78,7 +78,7 @@ namespace NewHorizons.Builder.General
|
||||
if ((Main.Instance.IsWarpingFromVessel || (!Main.Instance.IsWarpingFromShip && module.startWithSuit)) && !suitUpQueued)
|
||||
{
|
||||
suitUpQueued = true;
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
||||
Delay.RunWhen(() => Main.IsSystemReady, () => SuitUp());
|
||||
}
|
||||
|
||||
Logger.Log($"Made spawnpoint on [{planetGO.name}]");
|
||||
|
||||
@ -78,7 +78,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
|
||||
orbitLine._numVerts = (int)Mathf.Clamp(config.Orbit.semiMajorAxis / 1000f, numVerts, 4096);
|
||||
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(orbitLine.InitializeLineRenderer);
|
||||
Delay.FireOnNextUpdate(orbitLine.InitializeLineRenderer);
|
||||
|
||||
return orbitLine;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ namespace NewHorizons.Builder.Props
|
||||
// Enable all children or something
|
||||
// BUG doesnt work because enabled is a property, not a field
|
||||
var enabledField = component?.GetType()?.GetField("enabled");
|
||||
if (enabledField != null && enabledField.FieldType == typeof(bool)) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => enabledField.SetValue(component, true));
|
||||
if (enabledField != null && enabledField.FieldType == typeof(bool)) Events.FireOnNextUpdate(() => enabledField.SetValue(component, true));
|
||||
*/
|
||||
|
||||
// Fix a bunch of sector stuff
|
||||
@ -167,7 +167,7 @@ namespace NewHorizons.Builder.Props
|
||||
var sectorField = component?.GetType()?.GetField("_sector");
|
||||
if (sectorField != null && sectorField.FieldType == typeof(Sector))
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => sectorField.SetValue(component, sector));
|
||||
Events.FireOnNextUpdate(() => sectorField.SetValue(component, sector));
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -227,7 +227,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
|
||||
// Fix a bunch of stuff when done loading
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () =>
|
||||
Delay.RunWhen(() => Main.IsSystemReady, () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@ -32,7 +32,7 @@ namespace NewHorizons.Builder.Props
|
||||
var geyserFluidVolume = geyserGO.GetComponentInChildren<GeyserFluidVolume>();
|
||||
|
||||
// Do this after awake
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => geyserFluidVolume._maxHeight = 1);
|
||||
Delay.FireOnNextUpdate(() => geyserFluidVolume._maxHeight = 1);
|
||||
|
||||
geyserFluidVolume.enabled = true;
|
||||
geyserGO.transform.Find("FluidVolume_Geyser").GetComponent<CapsuleShape>().enabled = true;
|
||||
|
||||
@ -165,7 +165,7 @@ namespace NewHorizons.Builder.Props
|
||||
customScroll.SetActive(true);
|
||||
|
||||
// Enable the collider and renderer
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(
|
||||
Delay.RunWhen(
|
||||
() => Main.IsSystemReady,
|
||||
() =>
|
||||
{
|
||||
|
||||
@ -83,7 +83,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
imageLoader.pathsToLoad.Add(mod.ModHelper.Manifest.ModFolderPath + slideInfo.imagePath);
|
||||
|
||||
AddModules(slideInfo, ref slide);
|
||||
AddModules(slideInfo, ref slide, mod);
|
||||
|
||||
slideCollection.slides[i] = slide;
|
||||
}
|
||||
@ -171,7 +171,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
imageLoader.pathsToLoad.Add(mod.ModHelper.Manifest.ModFolderPath + slideInfo.imagePath);
|
||||
|
||||
AddModules(slideInfo, ref slide);
|
||||
AddModules(slideInfo, ref slide, mod);
|
||||
|
||||
slideCollection.slides[i] = slide;
|
||||
}
|
||||
@ -218,7 +218,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
imageLoader.pathsToLoad.Add(mod.ModHelper.Manifest.ModFolderPath + slideInfo.imagePath);
|
||||
|
||||
AddModules(slideInfo, ref slide);
|
||||
AddModules(slideInfo, ref slide, mod);
|
||||
|
||||
slideCollection.slides[i] = slide;
|
||||
}
|
||||
@ -282,7 +282,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
imageLoader.pathsToLoad.Add(mod.ModHelper.Manifest.ModFolderPath + slideInfo.imagePath);
|
||||
|
||||
AddModules(slideInfo, ref slide);
|
||||
AddModules(slideInfo, ref slide, mod);
|
||||
|
||||
slideCollection.slides[i] = slide;
|
||||
}
|
||||
@ -322,20 +322,20 @@ namespace NewHorizons.Builder.Props
|
||||
return standingTorch;
|
||||
}
|
||||
|
||||
private static void AddModules(PropModule.SlideInfo slideInfo, ref Slide slide)
|
||||
private static void AddModules(PropModule.SlideInfo slideInfo, ref Slide slide, IModBehaviour mod)
|
||||
{
|
||||
var modules = new List<SlideFunctionModule>();
|
||||
if (!String.IsNullOrEmpty(slideInfo.beatAudio))
|
||||
{
|
||||
var audioBeat = new SlideBeatAudioModule();
|
||||
audioBeat._audioType = (AudioType)Enum.Parse(typeof(AudioType), slideInfo.beatAudio);
|
||||
audioBeat._audioType = AudioTypeHandler.GetAudioType(slideInfo.beatAudio, mod);
|
||||
audioBeat._delay = slideInfo.beatDelay;
|
||||
modules.Add(audioBeat);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(slideInfo.backdropAudio))
|
||||
{
|
||||
var audioBackdrop = new SlideBackdropAudioModule();
|
||||
audioBackdrop._audioType = (AudioType)Enum.Parse(typeof(AudioType), slideInfo.backdropAudio);
|
||||
audioBackdrop._audioType = AudioTypeHandler.GetAudioType(slideInfo.backdropAudio, mod);
|
||||
audioBackdrop._fadeTime = slideInfo.backdropFadeTime;
|
||||
modules.Add(audioBackdrop);
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
heightMapTexture = ImageUtilities.GetTexture(mod, heightMap.heightMap);
|
||||
// defer remove texture to next frame
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => Object.Destroy(heightMapTexture));
|
||||
Delay.FireOnNextUpdate(() => Object.Destroy(heightMapTexture));
|
||||
}
|
||||
catch (Exception) { }
|
||||
if (heightMapTexture == null)
|
||||
|
||||
@ -118,7 +118,7 @@ namespace NewHorizons.Builder.Props
|
||||
// Resize the distance it can be heard from to match roughly with the size
|
||||
var maxDistance = info.audioDistance;
|
||||
if (maxDistance <= 0) maxDistance = scale * 10f;
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
Delay.FireOnNextUpdate(() =>
|
||||
{
|
||||
audioSource.maxDistance = maxDistance;
|
||||
audioSource.minDistance = maxDistance / 10f;
|
||||
|
||||
@ -37,7 +37,7 @@ namespace NewHorizons.Builder.Props
|
||||
launcherGO.SetActive(true);
|
||||
|
||||
// Have to null check else it breaks on reload configs
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady && meteorLauncher._meteorPool != null, () =>
|
||||
Delay.RunWhen(() => Main.IsSystemReady && meteorLauncher._meteorPool != null, () =>
|
||||
{
|
||||
foreach (var meteor in meteorLauncher._meteorPool)
|
||||
{
|
||||
|
||||
@ -114,7 +114,7 @@ namespace NewHorizons.Components
|
||||
if (name.Length > 17) textComponent.fontSize = 10;
|
||||
// Do it next frame
|
||||
var fontPath = "Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot/TH_VILLAGE/EntryCardRoot/NameBackground/Name";
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => textComponent.font = SearchUtilities.Find(fontPath).GetComponent<Text>().font);
|
||||
Delay.FireOnNextUpdate(() => textComponent.font = SearchUtilities.Find(fontPath).GetComponent<Text>().font);
|
||||
|
||||
newCard.SetActive(true);
|
||||
newCard.transform.name = uniqueID;
|
||||
|
||||
@ -121,7 +121,7 @@ namespace NewHorizons.Components
|
||||
{
|
||||
if (_isWarpingIn && LateInitializerManager.isDoneInitializing)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => StartWarpInEffect(), 1);
|
||||
Delay.FireInNUpdates(() => StartWarpInEffect(), 1);
|
||||
_isWarpingIn = false;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ namespace NewHorizons.Components
|
||||
// Idk whats making this work but now it works and idc
|
||||
if (_waitingToBeSeated && PlayerState.IsInsideShip() && _eyesOpen)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => FinishWarpIn(), 1);
|
||||
Delay.FireInNUpdates(() => FinishWarpIn(), 1);
|
||||
_waitingToBeSeated = false;
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,7 @@ namespace NewHorizons.Components
|
||||
Logger.LogVerbose("Finishing warp");
|
||||
Locator.GetShipBody().GetComponentInChildren<ShipCockpitController>().OnPressInteract();
|
||||
_waitingToBeSeated = false;
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => _whitehole.Collapse(), 30);
|
||||
Delay.FireInNUpdates(() => _whitehole.Collapse(), 30);
|
||||
|
||||
var resources = Locator.GetPlayerTransform().GetComponent<PlayerResources>();
|
||||
|
||||
|
||||
2
NewHorizons/External/Configs/PlanetConfig.cs
vendored
2
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -346,7 +346,7 @@ namespace NewHorizons.External.Configs
|
||||
if (Props.signals == null) Props.signals = new SignalModule.SignalInfo[0];
|
||||
Props.signals = Props.signals.Concat(Signal.signals).ToArray();
|
||||
}
|
||||
// Signals no longer use two differen variables for audio
|
||||
// Signals no longer use two different variables for audio
|
||||
if (Props?.signals != null)
|
||||
{
|
||||
foreach (var signal in Props.signals)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
@ -50,10 +51,10 @@ namespace NewHorizons.External.Configs
|
||||
/// </summary>
|
||||
public bool startHere;
|
||||
|
||||
[System.Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
||||
[Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
||||
public string travelAudioClip;
|
||||
|
||||
[System.Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
||||
[Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
||||
public string travelAudioFilePath;
|
||||
|
||||
/// <summary>
|
||||
|
||||
91
NewHorizons/Handlers/AudioTypeHandler.cs
Normal file
91
NewHorizons/Handlers/AudioTypeHandler.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Handlers
|
||||
{
|
||||
public static class AudioTypeHandler
|
||||
{
|
||||
private static Dictionary<string, AudioType> _customAudioTypes;
|
||||
private static List<AudioLibrary.AudioEntry> _audioEntries;
|
||||
private static int _startingInt = 4000;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_customAudioTypes = new Dictionary<string, AudioType>();
|
||||
_audioEntries = new List<AudioLibrary.AudioEntry>();
|
||||
|
||||
Delay.RunWhen(
|
||||
() => Locator.GetAudioManager()?._libraryAsset != null,
|
||||
PostInit
|
||||
);
|
||||
}
|
||||
|
||||
private static void PostInit()
|
||||
{
|
||||
Logger.LogVerbose($"Adding all custom AudioTypes to the library");
|
||||
|
||||
var library = Locator.GetAudioManager()._libraryAsset;
|
||||
library.audioEntries = library.audioEntries.Concat(_audioEntries).ToArray();
|
||||
|
||||
Locator.GetAudioManager()._audioLibraryDict = library.BuildAudioEntryDictionary();
|
||||
}
|
||||
|
||||
// Will return an existing audio type or create a new one for the given audio string
|
||||
public static AudioType GetAudioType(string audio, IModBehaviour mod)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (audio.Contains(".wav") || audio.Contains(".mp3") || audio.Contains(".ogg"))
|
||||
{
|
||||
return AddCustomAudioType(audio, mod);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (AudioType)Enum.Parse(typeof(AudioType), audio);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load AudioType {e.Message}, {e.StackTrace}");
|
||||
return AudioType.None;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a custom audio type from relative file path and the mod
|
||||
public static AudioType AddCustomAudioType(string audioPath, IModBehaviour mod)
|
||||
{
|
||||
AudioType audioType;
|
||||
|
||||
var id = mod.ModHelper.Manifest.UniqueName + "_" + audioPath;
|
||||
if (_customAudioTypes.TryGetValue(id, out audioType)) return audioType;
|
||||
|
||||
var audioClip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + audioPath);
|
||||
|
||||
if (audioClip == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't create audioType for {audioPath}");
|
||||
return AudioType.None;
|
||||
}
|
||||
|
||||
return AddCustomAudioType(id, new AudioClip[] { audioClip });
|
||||
}
|
||||
|
||||
// Create a custom audio type from a set of audio clips. Needs a unique ID
|
||||
public static AudioType AddCustomAudioType(string id, AudioClip[] audioClips)
|
||||
{
|
||||
var audioType = (AudioType)_startingInt + _customAudioTypes.Count();
|
||||
|
||||
Logger.LogVerbose($"Registering custom audio type {id} as {audioType}");
|
||||
|
||||
_audioEntries.Add(new AudioLibrary.AudioEntry(audioType, audioClips));
|
||||
_customAudioTypes.Add(id, audioType);
|
||||
|
||||
return audioType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
Logger.Log("Done loading bodies");
|
||||
|
||||
// Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies);
|
||||
// Events.FireOnNextUpdate(PlanetDestroyer.RemoveAllProxies);
|
||||
|
||||
if (Main.SystemDict[Main.Instance.CurrentStarSystem].Config.destroyStockPlanets) PlanetDestructionHandler.RemoveSolarSystem();
|
||||
}
|
||||
@ -164,8 +164,8 @@ namespace NewHorizons.Handlers
|
||||
if (body.Config.destroy)
|
||||
{
|
||||
var ao = existingPlanet.GetComponent<AstroObject>();
|
||||
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => PlanetDestructionHandler.RemoveBody(ao), 2);
|
||||
else Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
||||
if (ao != null) Delay.FireInNUpdates(() => PlanetDestructionHandler.RemoveBody(ao), 2);
|
||||
else Delay.FireInNUpdates(() => existingPlanet.SetActive(false), 2);
|
||||
}
|
||||
else if (body.Config.isQuantumState)
|
||||
{
|
||||
@ -279,7 +279,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
// We purposefully use GameObject.Find here because we don't want to find inactive things.
|
||||
// If you were to try and disable two children with the same name, if we were finding inactive then we'd disable the first one twice
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2);
|
||||
Delay.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (body.Config.Orbit.showOrbitLine && !body.Config.Orbit.isStatic)
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => OrbitlineBuilder.Make(body.Object, ao as NHAstroObject, body.Config.Orbit.isMoon, body.Config));
|
||||
Delay.FireOnNextUpdate(() => OrbitlineBuilder.Make(body.Object, ao as NHAstroObject, body.Config.Orbit.isMoon, body.Config));
|
||||
}
|
||||
|
||||
if (!body.Config.Orbit.isStatic)
|
||||
@ -429,7 +429,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (!(body.Config.Cloak != null && body.Config.Cloak.radius != 0f))
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
Delay.FireOnNextUpdate(() =>
|
||||
{
|
||||
ProxyBuilder.Make(go, body);
|
||||
});
|
||||
|
||||
@ -54,12 +54,12 @@ namespace NewHorizons.Handlers
|
||||
foreach (var name in _solarSystemBodies)
|
||||
{
|
||||
var ao = AstroObjectLocator.GetAstroObject(name);
|
||||
if (ao != null) Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => RemoveBody(ao, false), 2);
|
||||
if (ao != null) Delay.FireInNUpdates(() => RemoveBody(ao, false), 2);
|
||||
else Logger.LogError($"Couldn't find [{name}]");
|
||||
}
|
||||
|
||||
// Bring the sun back because why not
|
||||
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3);
|
||||
Delay.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3);
|
||||
}
|
||||
|
||||
public static void RemoveBody(AstroObject ao, bool delete = false, List<AstroObject> toDestroy = null)
|
||||
@ -198,7 +198,7 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
RemoveProxy(ao.name.Replace("_Body", ""));
|
||||
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () => DisableBody(ao.gameObject, delete));
|
||||
Delay.RunWhen(() => Main.IsSystemReady, () => DisableBody(ao.gameObject, delete));
|
||||
|
||||
foreach (ProxyBody proxy in GameObject.FindObjectsOfType<ProxyBody>())
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ namespace NewHorizons.Handlers
|
||||
|
||||
if (!string.IsNullOrEmpty(system.Config.travelAudio))
|
||||
{
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AudioUtilities.SetAudioClip(Locator.GetGlobalMusicController()._travelSource, system.Config.travelAudio, system.Mod));
|
||||
Delay.FireOnNextUpdate(() => AudioUtilities.SetAudioClip(Locator.GetGlobalMusicController()._travelSource, system.Config.travelAudio, system.Mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,7 +273,10 @@ namespace NewHorizons
|
||||
BrambleNodeBuilder.Init();
|
||||
AstroObjectLocator.Init();
|
||||
StreamingHandler.Init();
|
||||
AudioTypeHandler.Init();
|
||||
|
||||
PlanetCreationHandler.Init(BodyDict[CurrentStarSystem]);
|
||||
|
||||
VesselWarpHandler.LoadVessel();
|
||||
SystemCreationHandler.LoadSystem(SystemDict[CurrentStarSystem]);
|
||||
LoadTranslations(ModHelper.Manifest.ModFolderPath + "Assets/", this);
|
||||
|
||||
11
NewHorizons/Utility/Delay.cs
Normal file
11
NewHorizons/Utility/Delay.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace NewHorizons.Utility
|
||||
{
|
||||
public static class Delay
|
||||
{
|
||||
public static void RunWhen(Func<bool> predicate, Action action) => Main.Instance.ModHelper.Events.Unity.RunWhen(predicate, action);
|
||||
public static void FireInNUpdates(Action action, int n) => Main.Instance.ModHelper.Events.Unity.FireInNUpdates(action, n);
|
||||
public static void FireOnNextUpdate(Action action) => Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(action);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user