mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
MAYBE fix eye softlock (and use owml methods instead of copied qsb ones)
This commit is contained in:
parent
fb9e10fee7
commit
7489ecb7f8
@ -388,7 +388,9 @@ namespace NewHorizons
|
||||
{
|
||||
IsWarpingBackToEye = false;
|
||||
OWTime.Pause(OWTime.PauseType.Loading);
|
||||
LoadManager.LoadScene(OWScene.EyeOfTheUniverse); // LoadScene loads one frame later in Update. will this break since we unpause before that in the next line?
|
||||
// fire OnStartSceneLoad so qsb and other mods are happy
|
||||
((Delegate)AccessTools.Field(typeof(LoadManager), nameof(LoadManager.OnStartSceneLoad)).GetValue(null)).DynamicInvoke();
|
||||
LoadManager.LoadSceneImmediate(OWScene.EyeOfTheUniverse);
|
||||
OWTime.Unpause(OWTime.PauseType.Loading);
|
||||
return;
|
||||
}
|
||||
@ -936,11 +938,13 @@ namespace NewHorizons
|
||||
OWInput.ChangeInputMode(InputMode.None);
|
||||
|
||||
// Hide unloading
|
||||
// fire OnStartSceneLoad so qsb and other mods are happy
|
||||
((Delegate)AccessTools.Field(typeof(LoadManager), nameof(LoadManager.OnStartSceneLoad)).GetValue(null)).DynamicInvoke();
|
||||
FadeHandler.FadeThen(1f, () =>
|
||||
{
|
||||
// Slide reel unloading is tied to being removed from the sector, so we do that here to prevent a softlock
|
||||
Locator.GetPlayerSectorDetector().RemoveFromAllSectors();
|
||||
LoadManager.LoadScene(sceneToLoad); // this used to be LoadSceneImmediate, but that breaks with qsb. hopefully it doesnt break nh
|
||||
LoadManager.LoadSceneImmediate(sceneToLoad);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Utils;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@ -372,40 +372,6 @@ namespace NewHorizons.Utility
|
||||
return curve;
|
||||
}
|
||||
|
||||
// From QSB
|
||||
public static void RaiseEvent<T>(this T instance, string eventName, params object[] args)
|
||||
{
|
||||
const BindingFlags flags = BindingFlags.Instance
|
||||
| BindingFlags.Static
|
||||
| BindingFlags.Public
|
||||
| BindingFlags.NonPublic
|
||||
| BindingFlags.DeclaredOnly;
|
||||
if (typeof(T)
|
||||
.GetField(eventName, flags)?
|
||||
.GetValue(instance) is not MulticastDelegate multiDelegate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
multiDelegate.SafeInvoke(args);
|
||||
}
|
||||
|
||||
// From QSB
|
||||
public static void SafeInvoke(this MulticastDelegate multicast, params object[] args)
|
||||
{
|
||||
foreach (var del in multicast.GetInvocationList())
|
||||
{
|
||||
try
|
||||
{
|
||||
del.DynamicInvoke(args);
|
||||
}
|
||||
catch (TargetInvocationException ex)
|
||||
{
|
||||
NHLogger.LogError($"Error invoking delegate! {ex.InnerException}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<XmlNode> GetChildNodes(this XmlNode parentNode, string tagName)
|
||||
{
|
||||
return parentNode.ChildNodes.Cast<XmlNode>().Where(node => node.LocalName == tagName).ToList();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user