Try fix console spam bug

This commit is contained in:
ang-xd committed 2025-02-13 17:43:24 -05:00
1 parent 8ed38c02ce
commit c7d16f7fc9
2 files changed
+8 -3

No files matched your search

-1
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Reactor.Utilities;
namespace MiraAPI.Events;
+8 -2
View File
@@ -25,12 +25,18 @@ public static class CanUsePatches
[HarmonyPriority(Priority.Last)]
[HarmonyPrefix]
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>());
MiraEventManager.InvokeEvent(@event);
canUse = couldUse = false;
return !@event.IsCancelled;
}
return true;
}
}