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 AutoKnifeAttack v1.0.0
AutoKnifeAttack.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Yan01h")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AutoKnifeAttack")] [assembly: AssemblyTitle("AutoKnifeAttack")] [assembly: AssemblyVersion("1.0.0.0")] namespace AutoKnifeAttack { [BepInPlugin("Yan01h.AutoKnifeAttack", "AutoKnifeAttack", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string PluginGUID = "Yan01h.AutoKnifeAttack"; private const string PluginName = "AutoKnifeAttack"; private const string PluginVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("Yan01h.AutoKnifeAttack"); public static ManualLogSource Log { get; private set; } public void Awake() { Log = Logger.CreateLogSource("Yan01h.AutoKnifeAttack"); Log.LogInfo((object)"Loading AutoKnifeAttack (v1.0.0)"); _harmony.PatchAll(); Log.LogInfo((object)"Plugin: AutoKnifeAttack, Version: 1.0.0 loaded!"); } } } namespace AutoKnifeAttack.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatches { private static float _timeAtLastAttack; [HarmonyPostfix] [HarmonyPatch("Update")] internal static void ItemActivatePostfix(PlayerControllerB __instance) { if (Object.op_Implicit((Object)(object)__instance.currentlyHeldObjectServer) && ((object)__instance.currentlyHeldObjectServer).GetType() == typeof(KnifeItem) && IngamePlayerSettings.Instance.playerInput.actions.FindAction("ActivateItem", false).IsPressed() && Time.realtimeSinceStartup - _timeAtLastAttack > 0.43f) { _timeAtLastAttack = Time.realtimeSinceStartup; __instance.currentlyHeldObjectServer.UseItemOnClient(true); } } } }