using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LethalModpack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalModpack")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c9e559f3-1a56-4209-87b4-08547a8901da")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CustomJump
{
[BepInPlugin("com.actus.lethalcompany.customjump", "Custom Jump Mod", "1.0.0")]
public class CustomJumpBase : BaseUnityPlugin
{
private const string modGUID = "com.actus.lethalcompany.customjump";
private const string modName = "Custom Jump Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("com.actus.lethalcompany.customjump");
public static int maxNumberOfAirJumps { get; private set; }
private void Awake()
{
maxNumberOfAirJumps = ((BaseUnityPlugin)this).Config.Bind<int>("General", "maxNumberOfAirJumps", 1, "Set the max number of air jumps (1 = double jump, 2 = triple jump, etc.)").Value;
harmony.PatchAll();
}
}
}
namespace CustomJump.Patches
{
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
internal class CustomJumpPatch
{
private static int currentNumberOfJumps = CustomJumpBase.maxNumberOfAirJumps;
[HarmonyPostfix]
public static void CustomJump(ref PlayerControllerB __instance, ref bool ___isJumping, ref bool ___isFallingFromJump, ref bool ___isExhausted, ref float ___sprintMeter, ref bool ___isFallingNoJump)
{
if (currentNumberOfJumps > 0 && !___isExhausted && (___isFallingFromJump | ___isFallingNoJump) && ((ButtonControl)Keyboard.current.spaceKey).wasPressedThisFrame)
{
currentNumberOfJumps--;
((MonoBehaviour)__instance).StartCoroutine("PlayerJump");
___sprintMeter = Mathf.Clamp(___sprintMeter - 0.08f, 0f, 1f);
___isJumping = true;
}
if (__instance.thisController.isGrounded)
{
currentNumberOfJumps = CustomJumpBase.maxNumberOfAirJumps;
}
}
}
}