mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Maybe fix RemoteDialogueTrigger softlock
This commit is contained in:
parent
a4bb3896c8
commit
362204dcbb
32
NewHorizons/Patches/RemoteDialogueTriggerPatches.cs
Normal file
32
NewHorizons/Patches/RemoteDialogueTriggerPatches.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
/// <summary>
|
||||
/// Should fix a bug where disabled a CharacterDialogueTree makes its related RemoteDialogueTriggers softlock your game
|
||||
/// </summary>
|
||||
[HarmonyPatch]
|
||||
public static class RemoteDialogueTriggerPatches
|
||||
{
|
||||
private static bool _wasLastDialogueInactive = false;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))]
|
||||
public static void OnTriggerEnter(RemoteDialogueTrigger __instance)
|
||||
{
|
||||
_wasLastDialogueInactive = __instance._activeRemoteDialogue.gameObject.activeInHierarchy;
|
||||
__instance._activeRemoteDialogue.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(HUDMarker), nameof(HUDMarker.Awake))]
|
||||
public static void OnEndConversation(RemoteDialogueTrigger __instance)
|
||||
{
|
||||
if (_wasLastDialogueInactive)
|
||||
{
|
||||
__instance._activeRemoteDialogue.gameObject.SetActive(false);
|
||||
}
|
||||
_wasLastDialogueInactive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user