Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HoldtoAutoKnifeStab v1.1.0
HoldtoAutoKnifeStab.dll
Decompiled 9 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("lethaltestmod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Atlas Playbook v0.4.1")] [assembly: AssemblyProduct("lethaltestmod")] [assembly: AssemblyCopyright("Copyright © Atlas Playbook v0.4.1 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e75e037d-b118-4f16-80e0-ee240e02127b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HoldtoAutoKnifeStab { [BepInPlugin("Samnoon.HoldtoAutoKnifeStab", "HoldtoAutoKnifeStab", "1.1.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("Samnoon.HoldtoAutoKnifeStab"); public static ManualLogSource Log { get; private set; } public static ConfigEntry<float> AttackInterval { get; private set; } public void Awake() { Log = ((BaseUnityPlugin)this).Logger; AttackInterval = ((BaseUnityPlugin)this).Config.Bind<float>("General", "AttackInterval", 0.11f, "Knife auto-attack interval in seconds (e.g. 0.11 = 11 attacks per second)."); Log.LogInfo((object)"Loading HoldtoAutoKnifeStab (v1.1.0)"); _harmony.PatchAll(); Log.LogInfo((object)"Plugin loaded!"); } } } namespace HoldtoAutoKnifeStab.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatches { private static float _timeAtLastAttack; [HarmonyPostfix] [HarmonyPatch("Update")] internal static void ItemActivatePostfix(PlayerControllerB __instance) { GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && ((object)currentlyHeldObjectServer).GetType() == typeof(KnifeItem) && IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).IsPressed() && Time.realtimeSinceStartup - _timeAtLastAttack > Plugin.AttackInterval.Value) { _timeAtLastAttack = Time.realtimeSinceStartup; currentlyHeldObjectServer.UseItemOnClient(true); } } } }