mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Try fix console spam bug
This commit is contained in:
1 parent
8ed38c02ce
commit
c7d16f7fc9
2 files changed
+8
-3
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Reactor.Utilities;
|
|
||||||
|
|
||||||
namespace MiraAPI.Events;
|
namespace MiraAPI.Events;
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,18 @@ public static class CanUsePatches
|
|||||||
[HarmonyPriority(Priority.Last)]
|
[HarmonyPriority(Priority.Last)]
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
public static bool CanUsePatch(Il2CppSystem.Object __instance, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse)
|
public static bool CanUsePatch(Il2CppSystem.Object __instance, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse)
|
||||||
|
{
|
||||||
|
canUse = couldUse = false;
|
||||||
|
|
||||||
|
IUsable usable = __instance.Cast<IUsable>();
|
||||||
|
if (usable != null)
|
||||||
{
|
{
|
||||||
var @event = new PlayerCanUseEvent(__instance.Cast<IUsable>());
|
var @event = new PlayerCanUseEvent(__instance.Cast<IUsable>());
|
||||||
MiraEventManager.InvokeEvent(@event);
|
MiraEventManager.InvokeEvent(@event);
|
||||||
|
|
||||||
canUse = couldUse = false;
|
|
||||||
|
|
||||||
return !@event.IsCancelled;
|
return !@event.IsCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user