This commit is contained in:
Nick 2022-09-10 13:26:09 -04:00 committed by GitHub
commit 1cb5079764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,19 +3,24 @@ using HarmonyLib;
namespace NewHorizons.Patches; namespace NewHorizons.Patches;
[HarmonyPatch] [HarmonyPatch]
internal class CharacterDialogueTreePatches internal static class CharacterDialogueTreePatches
{ {
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.Awake))] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.Awake))]
private static void CharacterDialogueTree_Awake(CharacterDialogueTree __instance) private static void CharacterDialogueTree_Awake(CharacterDialogueTree __instance)
{ {
GlobalMessenger<OWRigidbody>.AddListener("AttachPlayerToPoint", _ => __instance.EndConversation()); GlobalMessenger<OWRigidbody>.AddListener("AttachPlayerToPoint", __instance.OnAttachPlayerToPoint);
} }
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.OnDestroy))] [HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.OnDestroy))]
private static void CharacterDialogueTree_OnDestroy(CharacterDialogueTree __instance) private static void CharacterDialogueTree_OnDestroy(CharacterDialogueTree __instance)
{ {
GlobalMessenger<OWRigidbody>.RemoveListener("AttachPlayerToPoint", _ => __instance.EndConversation()); GlobalMessenger<OWRigidbody>.RemoveListener("AttachPlayerToPoint", __instance.OnAttachPlayerToPoint);
}
private static void OnAttachPlayerToPoint(this CharacterDialogueTree characterDialogueTree, OWRigidbody rigidbody)
{
characterDialogueTree.EndConversation();
} }
} }