diff --git a/NewHorizons/Patches/DialoguePatches/RemoteDialogueTriggerPatches.cs b/NewHorizons/Patches/DialoguePatches/RemoteDialogueTriggerPatches.cs index 330e578e..c01240f2 100644 --- a/NewHorizons/Patches/DialoguePatches/RemoteDialogueTriggerPatches.cs +++ b/NewHorizons/Patches/DialoguePatches/RemoteDialogueTriggerPatches.cs @@ -1,4 +1,6 @@ using HarmonyLib; +using System.Collections; +using UnityEngine.InputSystem; namespace NewHorizons.Patches.DialoguePatches { @@ -7,6 +9,29 @@ namespace NewHorizons.Patches.DialoguePatches { private static bool _wasLastDialogueInactive = false; + [HarmonyPostfix] + [HarmonyPatch(nameof(RemoteDialogueTrigger.Awake))] + public static void RemoteDialogueTrigger_Awake(RemoteDialogueTrigger __instance) + { + // Wait for player to be up and moving before allowing them to trigger remote dialogue + // Stops you getting locked into dialogue while waking up + if (OWInput.GetInputMode() != InputMode.Character) + { + __instance._collider.enabled = false; + __instance.StartCoroutine(AwakeCoroutine(__instance)); + } + } + + private static IEnumerator AwakeCoroutine(RemoteDialogueTrigger instance) + { + while (OWInput.GetInputMode() != InputMode.Character) + { + yield return null; + } + + instance._collider.enabled = true; + } + /// /// Should fix a bug where disabled a CharacterDialogueTree makes its related RemoteDialogueTriggers softlock your game ///