diff --git a/Patches/ReloadInPlacePatches.cs b/Patches/ReloadInPlacePatches.cs index 1d6dbce..bb5b5da 100644 --- a/Patches/ReloadInPlacePatches.cs +++ b/Patches/ReloadInPlacePatches.cs @@ -103,6 +103,12 @@ public static class ReloadInPlacePatches { protected override MethodBase GetTargetMethod() { + if (Plugin.FikaPresent()) + { + Type type = Type.GetType("Fika.Core.Coop.ClientClasses.CoopClientFirearmController, Fika.Core"); + return AccessTools.Method(type, "ReloadMag"); + } + return AccessTools.Method(typeof(Player.FirearmController), nameof(Player.FirearmController.ReloadMag)); } diff --git a/Plugin.cs b/Plugin.cs index 46f2e68..e23bd66 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -1,10 +1,12 @@ using BepInEx; +using BepInEx.Bootstrap; using Comfort.Common; using EFT; namespace UIFixes; [BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] +[BepInDependency("com.fika.core", BepInDependency.DependencyFlags.SoftDependency)] public class Plugin : BaseUnityPlugin { public void Awake() @@ -76,4 +78,16 @@ public class Plugin : BaseUnityPlugin bool? inRaid = Singleton.Instance?.InRaid; return inRaid.HasValue && inRaid.Value; } + + private static bool? IsFikaPresent; + + public static bool FikaPresent() + { + if (!IsFikaPresent.HasValue) + { + IsFikaPresent = Chainloader.PluginInfos.ContainsKey("com.fika.core"); + } + + return IsFikaPresent.Value; + } }