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 v49Jetpacks v1.0.2
v49Jetpacks.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; [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("v49Jetpacks")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Restores attributes of the jetpack from v49")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("v49Jetpacks")] [assembly: AssemblyTitle("v49Jetpacks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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 v49Jetpacks { [BepInPlugin("butterystancakes.lethalcompany.v49jetpacks", "v49 Jetpacks", "1.0.1")] public class Plugin : BaseUnityPlugin { private const string PLUGIN_GUID = "butterystancakes.lethalcompany.v49jetpacks"; private const string PLUGIN_NAME = "v49 Jetpacks"; private const string PLUGIN_VERSION = "1.0.1"; internal static ManualLogSource Logger; internal static ConfigEntry<bool> configMidairCrashing; internal static ConfigEntry<int> configBatteryLife; private void Awake() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) configMidairCrashing = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaking", "Mid-air Crashing", true, "Jetpacks exploding from \"overheating\" was actually caused by a bug that caused the player to crash into themselves or invisible triggers once the jetpack reached a certain speed, even in open space. This bug was fixed in v50, but you should leave this setting enabled if you want v49 authenticity."); configBatteryLife = ((BaseUnityPlugin)this).Config.Bind<int>("Tweaking", "Battery Life", 60, new ConfigDescription("The battery life of the jetpack in seconds. v49 is 60s. v50 final uses 50s. Nerfed jetpacks (v50 beta) used 40s.", (AcceptableValueBase)(object)new AcceptableValueList<int>(new int[3] { 60, 50, 40 }), Array.Empty<object>())); Logger = ((BaseUnityPlugin)this).Logger; new Harmony("butterystancakes.lethalcompany.v49jetpacks").PatchAll(); Logger.LogInfo((object)"v49 Jetpacks v1.0.1 loaded"); } } [HarmonyPatch] internal class v49JetpacksPatches { [HarmonyPatch(typeof(JetpackItem), "EquipItem")] [HarmonyPostfix] private static void EquipJetpack(JetpackItem __instance) { ((GrabbableObject)__instance).itemProperties.batteryUsage = Plugin.configBatteryLife.Value; __instance.jetpackDeaccelleration = 75f; } [HarmonyPatch(typeof(JetpackItem), "Update")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> JetpackUpdate(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); for (int i = 1; i < list.Count - 1; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 50f && list[i + 1].opcode == OpCodes.Mul) { list[i].operand = 1f; Plugin.Logger.LogInfo((object)"Reduced force change factor from 50x to 1x"); } else if (list[i].opcode == OpCodes.Ldc_I4_1 && Plugin.configMidairCrashing.Value && list[i - 1].opcode == OpCodes.Ldfld && (FieldInfo)list[i - 1].operand == typeof(StartOfRound).GetField("allPlayersCollideWithMask", BindingFlags.Instance | BindingFlags.Public)) { list[i].opcode = OpCodes.Ldc_I4_2; Plugin.Logger.LogInfo((object)"Re-enabled collision with triggers (this will cause \"overheat explosions\" to occur)"); } else { if (!(list[i].opcode == OpCodes.Brfalse) || !(list[i - 1].opcode == OpCodes.Ldfld) || !((FieldInfo)list[i - 1].operand == typeof(PlayerControllerB).GetField("jetpackControls", BindingFlags.Instance | BindingFlags.Public))) { continue; } int num = -1; for (int j = i + 1; j < list.Count - 3; j++) { if (list[j].opcode == OpCodes.Ldarg_0 && list[j + 2].opcode == OpCodes.Stfld && (FieldInfo)list[j + 2].operand == typeof(JetpackItem).GetField("forces", BindingFlags.Instance | BindingFlags.NonPublic)) { num = j + 3; } } if (num > i) { object obj = null; for (int k = i + 1; k < num - 3; k++) { if (obj == null && (list[k].opcode == OpCodes.Ble_Un || list[k].opcode == OpCodes.Brfalse)) { obj = list[k].operand; } list[k].opcode = OpCodes.Nop; } list[i].opcode = OpCodes.Brtrue; list[i].operand = obj; Plugin.Logger.LogInfo((object)"Patched out grounded check (this will allow sliding along terrain again)"); } else { Plugin.Logger.LogError((object)"Unable to find isGrounded condition (has JetpackItem been updated?)"); } } } return list; } } public static class PluginInfo { public const string PLUGIN_GUID = "v49Jetpacks"; public const string PLUGIN_NAME = "v49Jetpacks"; public const string PLUGIN_VERSION = "1.0.1"; } }