Decompiled source of CrouchToStand v1.0.0

CrouchToStand.dll

Decompiled 11 months ago
using System.Collections;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CrouchToStand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CrouchToStand")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("666C668E-9A5E-40B0-BA2F-6CD63B92BDAD")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CrouchToStand;

[BepInPlugin("Mhz.CrouchToStand", "CrouchToStand", "1.0.0")]
public class StandUp : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
	private class JumpPerformedPatch
	{
		private static void Prefix(PlayerControllerB __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(PerformDelayedAction(__instance));
		}
	}

	private static Harmony _harmony;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		_harmony = new Harmony("Mhz.CrouchToStand");
		_harmony.PatchAll();
	}

	private static IEnumerator PerformDelayedAction(PlayerControllerB instance)
	{
		yield return null;
		if (instance.isCrouching)
		{
			instance.Crouch(false);
		}
	}
}