From a8dfbb616cd9dea06b74236848f5093ef4511b77 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Sat, 24 Oct 2026 17:01:44 -0500 Subject: [PATCH] Use monobehaviour instead of il2 obj for use event --- MiraAPI/Patches/Events/CanUsePatches.cs | 3 ++- MiraAPI/Patches/Events/UsePatches.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/Events/CanUsePatches.cs b/MiraAPI/Patches/Events/CanUsePatches.cs index 7af9acd2..f99d2b90 100644 --- a/MiraAPI/Patches/Events/CanUsePatches.cs +++ b/MiraAPI/Patches/Events/CanUsePatches.cs @@ -3,6 +3,7 @@ using System.Reflection; using HarmonyLib; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Usables; +using UnityEngine; namespace MiraAPI.Patches.Events; @@ -27,7 +28,7 @@ public static class CanUsePatches [HarmonyPriority(Priority.Last)] [HarmonyPrefix] - public static bool CanUsePatch(Il2CppSystem.Object __instance, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) + public static bool CanUsePatch(MonoBehaviour __instance, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse) { canUse = couldUse = false; diff --git a/MiraAPI/Patches/Events/UsePatches.cs b/MiraAPI/Patches/Events/UsePatches.cs index a6c4b1d4..4d783f39 100644 --- a/MiraAPI/Patches/Events/UsePatches.cs +++ b/MiraAPI/Patches/Events/UsePatches.cs @@ -3,6 +3,7 @@ using System.Reflection; using HarmonyLib; using MiraAPI.Events; using MiraAPI.Events.Vanilla.Usables; +using UnityEngine; namespace MiraAPI.Patches.Events; @@ -25,7 +26,7 @@ public static class UsePatches [HarmonyPriority(Priority.Last)] [HarmonyPrefix] - public static bool UsePatch(Il2CppSystem.Object __instance) + public static bool UsePatch(MonoBehaviour __instance) { var @event = new PlayerUseEvent(__instance.Cast()); MiraEventManager.InvokeEvent(@event);