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 NoForcedDropMod v1.0.6
NoForcedDropMod.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using MonoMod.RuntimeDetour; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("NoForcedDropMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoForcedDropMod")] [assembly: AssemblyTitle("NoForcedDropMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace NoForcedDropMod; [BepInPlugin("Mistyck.NoForcedDropMod", "Mistyck No Forced Drop Mod", "1.0.6")] public class Plugin : BaseUnityPlugin { private delegate void ReleaseObjectDelegate(PhysGrabber instance, float disableTimer); private static Hook dropHook; public static Plugin Instance; private static ReleaseObjectDelegate origReleaseObject; private static FieldInfo tumbleField; private static FieldInfo isTumblingField; private static bool prevKnockedDown; private static float exitTumbleCooldown; private const float ExitTumbleDuration = 0.5f; private static float logCooldownTimer; private const float LogCooldown = 1f; private void Awake() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hook test mod loaded."); MethodInfo method = typeof(PhysGrabber).GetMethod("ReleaseObject", BindingFlags.Instance | BindingFlags.Public); MethodInfo method2 = typeof(Plugin).GetMethod("ReleaseObject_Hook", BindingFlags.Static | BindingFlags.NonPublic); if (method != null && method2 != null) { dropHook = new Hook((MethodBase)method, method2); origReleaseObject = dropHook.GenerateTrampoline<ReleaseObjectDelegate>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hook successfully created for ReleaseObject."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Error finding target method or hook."); } tumbleField = typeof(PlayerAvatar).GetField("tumble", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (tumbleField != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Found tumble field in PlayerAvatar."); isTumblingField = tumbleField.FieldType.GetField("isTumbling", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (isTumblingField != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Found isTumbling field in tumble."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find 'isTumbling' field in tumble."); } } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find 'tumble' field in PlayerAvatar."); } } private void Update() { if (exitTumbleCooldown > 0f) { exitTumbleCooldown -= Time.deltaTime; } if (logCooldownTimer > 0f) { logCooldownTimer -= Time.deltaTime; } } private static void ReleaseObject_Hook(PhysGrabber __instance, float _disableTimer) { if (logCooldownTimer <= 0f) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"ReleaseObject_Hook called with _disableTimer = {_disableTimer}"); logCooldownTimer = 1f; } bool flag = false; PlayerAvatar playerAvatar = __instance.playerAvatar; if ((Object)(object)playerAvatar != (Object)null && tumbleField != null && isTumblingField != null) { object value = tumbleField.GetValue(playerAvatar); if (value != null) { try { flag = (bool)isTumblingField.GetValue(value); } catch (Exception ex) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Error reading isTumbling: " + ex.Message)); } } } if (prevKnockedDown && !flag) { exitTumbleCooldown = 0.5f; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Exited tumble state; activating exit cooldown."); } prevKnockedDown = flag; bool mouseButton = Input.GetMouseButton(0); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Knockdown check: isTumbling = {flag}, exitCooldown = {exitTumbleCooldown:F2}"); if (flag || mouseButton || exitTumbleCooldown > 0f) { if (flag) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Knockdown detected; blocking drop to keep beam active."); } else if (mouseButton) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Mouse held down; blocking drop to keep beam active."); } else if (exitTumbleCooldown > 0f) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Exit cooldown active; blocking drop to keep beam active."); } } else { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Manual drop detected (mouse released, no knockdown, cooldown expired); calling original ReleaseObject."); origReleaseObject(__instance, _disableTimer); } } }