Use monobehaviour instead of il2 obj for use event

This commit is contained in:
Atony committed 2026-10-24 17:01:44 -05:00
1 parent b79c14ce50
commit a8dfbb616c
2 files changed
+4 -2

No files matched your search

+2 -1
View File
@@ -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;
+2 -1
View File
@@ -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<IUsable>());
MiraEventManager.InvokeEvent(@event);