mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
Use monobehaviour instead of il2 obj for use event
This commit is contained in:
1 parent
b79c14ce50
commit
a8dfbb616c
2 files changed
+4
-2
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user