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 SmallCrouchMode v1.0.6
SmallCrouchMode.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; 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("SmallCrouchMode")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP")] [assembly: AssemblyProduct("SmallCrouchMode")] [assembly: AssemblyCopyright("Copyright © HP 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4ab92ed5-1336-45ec-8ae8-491ce552fb68")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace SmallCrouchMode; [BepInPlugin("TechedCrayon413.SmallCrouchMode", "Small Crouch Mode", "1.0.6")] public class SmallCrouchModePlugin : BaseUnityPlugin { public static ConfigEntry<KeyCode> CrawlKey; public static ConfigEntry<bool> ToggleMode; private bool _showWarning = false; private bool _warningAcknowledged = false; private Rect _windowRect; private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; CrawlKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Crawl Key", (KeyCode)308, "Key used to crawl"); ToggleMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Crawl Key Toggle Mode", true, "If true = press to toggle, if false = hold"); Harmony val = new Harmony("TechedCrayon413.SmallCrouchMode"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogMessage((object)"Small Crouch Mode will be discontinued for the v1.0.4 update please use CrouchAndCrawlSprint instead"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SmallCrouchMode v1.0.4 loaded successfully"); } private void Update() { if (!_warningAcknowledged && !_showWarning && (Object)(object)MainMenuOpen.instance != (Object)null) { _showWarning = true; } } private void OnGUI() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) if (_showWarning && !_warningAcknowledged) { _windowRect = new Rect((float)(Screen.width - 450) / 2f, (float)(Screen.height - 240) / 2f, 450f, 200f); GUI.Box(_windowRect, "MOD DISCONTINUED NOTICE"); GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, wordWrap = true }; GUI.Label(new Rect(((Rect)(ref _windowRect)).x + 20f, ((Rect)(ref _windowRect)).y + 40f, ((Rect)(ref _windowRect)).width - 40f, 130f), "The 'Small Crouch Mode' mod is discontinued and will not be receiving any further updates\n\nPlease uninstall this mod and download the new mod under its new name:\n\nCrouchAndCrawlSprint", val); if (GUI.Button(new Rect(((Rect)(ref _windowRect)).x + (((Rect)(ref _windowRect)).width - 200f) / 2f, ((Rect)(ref _windowRect)).y + 160f, 200f, 40f), "I Understand / Close")) { _showWarning = false; _warningAcknowledged = true; } } } } public static class CrawlState { public static bool IsCrawling; } [HarmonyPatch] public static class Patch_PlayerController { private static FieldInfo _crouchSpeedField; private static MethodInfo _setCrawlMethod; private static float _originalCrouchSpeed = -1f; private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("PlayerController"); if (type == null) { return null; } _crouchSpeedField = AccessTools.Field(type, "CrouchSpeed"); _setCrawlMethod = AccessTools.Method(type, "SetCrawl", (Type[])null, (Type[])null); return AccessTools.Method(type, "Update", (Type[])null, (Type[])null); } private static void Postfix(object __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (__instance == null || _crouchSpeedField == null || _setCrawlMethod == null) { return; } if (_originalCrouchSpeed < 0f) { _originalCrouchSpeed = (float)_crouchSpeedField.GetValue(__instance); } KeyCode value = SmallCrouchModePlugin.CrawlKey.Value; if (SmallCrouchModePlugin.ToggleMode.Value) { if (Input.GetKeyDown(value)) { CrawlState.IsCrawling = !CrawlState.IsCrawling; } } else { CrawlState.IsCrawling = Input.GetKey(value); } if (CrawlState.IsCrawling) { _setCrawlMethod.Invoke(__instance, null); } else { _crouchSpeedField.SetValue(__instance, _originalCrouchSpeed); } } }