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 JetpackFallFix v2.0.1
JetpackFallFix.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using IL.GameNetcodeStuff; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.GameNetcodeStuff; 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("JetpackFallFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A lethal company mod which fixes buggy jetpack fall damage logic.")] [assembly: AssemblyFileVersion("2.0.1.0")] [assembly: AssemblyInformationalVersion("2.0.1")] [assembly: AssemblyProduct("JetpackFallFix")] [assembly: AssemblyTitle("JetpackFallFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace JetpackFallFix { internal class Patches { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__PlayerControllerB_Awake; public static Manipulator <1>__PlayerControllerB_Update; public static Manipulator <2>__PlayerControllerB_PlayerHitGroundEffects; public static hook_PlayerHitGroundEffects <3>__On_PlayerControllerB_PlayerHitGroundEffects; } private static void LogIfDebugBuild(string text) { } internal static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_Awake; if (obj == null) { hook_Awake val = PlayerControllerB_Awake; <>O.<0>__PlayerControllerB_Awake = val; obj = (object)val; } PlayerControllerB.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__PlayerControllerB_Update; if (obj2 == null) { Manipulator val2 = PlayerControllerB_Update; <>O.<1>__PlayerControllerB_Update = val2; obj2 = (object)val2; } PlayerControllerB.Update += (Manipulator)obj2; object obj3 = <>O.<2>__PlayerControllerB_PlayerHitGroundEffects; if (obj3 == null) { Manipulator val3 = PlayerControllerB_PlayerHitGroundEffects; <>O.<2>__PlayerControllerB_PlayerHitGroundEffects = val3; obj3 = (object)val3; } PlayerControllerB.PlayerHitGroundEffects += (Manipulator)obj3; object obj4 = <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects; if (obj4 == null) { hook_PlayerHitGroundEffects val4 = On_PlayerControllerB_PlayerHitGroundEffects; <>O.<3>__On_PlayerControllerB_PlayerHitGroundEffects = val4; obj4 = (object)val4; } PlayerControllerB.PlayerHitGroundEffects += (hook_PlayerHitGroundEffects)obj4; } private static void PlayerControllerB_Awake(orig_Awake orig, PlayerControllerB self) { orig.Invoke(self); self.velocityAverageCount = 21; } private static void PlayerControllerB_Update(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[8] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "gameplayCamera"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Component>(x, "get_transform"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Transform>(x, "get_position"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f), (Instruction x) => ILPatternMatchingExt.MatchCall<StartOfRound>(x, "get_Instance"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<StartOfRound>(x, "collidersAndRoomMaskAndDefault"), (Instruction x) => ILPatternMatchingExt.MatchCall<Physics>(x, "CheckSphere") }); val.Index += 7; val.Remove(); val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Call, (MethodBase)(from x in typeof(Physics).GetMethods() where x.Name == "CheckSphere" select x).FirstOrDefault()); } private static void On_PlayerControllerB_PlayerHitGroundEffects(orig_PlayerHitGroundEffects orig, PlayerControllerB self) { orig.Invoke(self); self.averageVelocity = 0f; } private static void PlayerControllerB_PlayerHitGroundEffects(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val5 = default(ILLabel); ILLabel val4 = default(ILLabel); ILLabel val3 = default(ILLabel); ILLabel val2 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[12] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "takingFallDamage"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val5), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "jetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "disablingJetpackControls"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<PlayerControllerB>(x, "isSpeedCheating"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2) }); val.Index += 4; val.RemoveRange(4); val.EmitDelegate<Func<PlayerControllerB, bool>>((Func<PlayerControllerB, bool>)delegate(PlayerControllerB self) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!self.jetpackControls && !self.disablingJetpackControls) { LogIfDebugBuild("Take normal fall damage."); return false; } if (self.thisController.velocity.y < -15f) { LogIfDebugBuild("Take fall damage with jetpack."); self.fallValueUncapped = self.thisController.velocity.y; return false; } LogIfDebugBuild("Prevented fall damage bug!"); self.takingFallDamage = false; return true; }); } } [BepInPlugin("JetpackFallFix", "JetpackFallFix", "2.0.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin JetpackFallFix is loaded!"); Patches.Init(); } } public static class PluginInfo { public const string PLUGIN_GUID = "JetpackFallFix"; public const string PLUGIN_NAME = "JetpackFallFix"; public const string PLUGIN_VERSION = "2.0.1"; } }