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
+10 -5

No files matched your search

-1
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Reactor.Utilities;
namespace MiraAPI.Events;
+10 -4
View File
@@ -26,11 +26,17 @@ public static class CanUsePatches
[HarmonyPrefix]
public static bool CanUsePatch(Il2CppSystem.Object __instance, [HarmonyArgument(0)] NetworkedPlayerInfo pc, [HarmonyArgument(1)] out bool canUse, [HarmonyArgument(2)] out bool couldUse)
{
var @event = new PlayerCanUseEvent(__instance.Cast<IUsable>());
MiraEventManager.InvokeEvent(@event);
canUse = couldUse = false;
return !@event.IsCancelled;
IUsable usable = __instance.Cast<IUsable>();
if (usable != null)
{
var @event = new PlayerCanUseEvent(__instance.Cast<IUsable>());
MiraEventManager.InvokeEvent(@event);
return !@event.IsCancelled;
}
return true;
}
}