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 RocketCruiserMod v1.0.1
Rocket.CruiserMod.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CruiserMod.Patches; using HarmonyLib; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Rocket.CruiserMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CruiserMod")] [assembly: AssemblyTitle("Rocket.CruiserMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 CruiserMod { [BepInPlugin("Rocket.CruiserMod", "CruiserMod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] public class CruiserMod : BaseUnityPlugin { public static bool explosionArmed; public static ConfigEntry<bool>? EnableExplodeOnEject; public static ConfigEntry<bool>? EnableInvincibleVehicle; public static ConfigEntry<bool>? EnableMagnetChanges; public static ConfigEntry<bool>? EnableSpringForceModification; public static ConfigEntry<float>? CustomSpringForce; public static ConfigEntry<bool>? EnablePushForceModification; public static ConfigEntry<float>? CustomPushForceMultiplier; public static ConfigEntry<bool>? EnableJumpForceModification; public static ConfigEntry<float>? CustomJumpForce; public static ConfigEntry<bool>? EnableAlwaysStart; public static CruiserMod Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; EnableExplodeOnEject = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableExplodeOnEject", true, "If true, allows the vehicle to explode when ejecting if armed during ignition."); EnableInvincibleVehicle = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableInvincibleVehicle", true, "If true, makes the vehicle invincible to all damage."); EnableMagnetChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableMagnetChanges", true, "If true, modifies the ship's magnet behavior."); EnableSpringForceModification = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableSpringForceModification", true, "If true, uses the custom spring force value."); CustomSpringForce = ((BaseUnityPlugin)this).Config.Bind<float>("Features", "CustomSpringForce", 70f, "Custom spring force value to use when EnableSpringForceModification is true."); EnablePushForceModification = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnablePushForceModification", true, "If true, uses the custom push force multiplier value."); CustomPushForceMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Features", "CustomPushForceMultiplier", 1f, "Custom push force multiplier to use when EnablePushForceModification is true."); EnableJumpForceModification = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableJumpForceModification", true, "If true, uses the custom jump force value."); CustomJumpForce = ((BaseUnityPlugin)this).Config.Bind<float>("Features", "CustomJumpForce", 4000f, "Custom jump force value to use when EnableJumpForceModification is true."); EnableAlwaysStart = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "EnableAlwaysStart", true, "If true, the vehicle will always start on the first ignition attempt."); Patch(); Logger.LogInfo((object)"Rocket.CruiserMod v1.0.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Rocket.CruiserMod"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); if (EnableExplodeOnEject.Value) { Harmony.PatchAll(typeof(EjectPatch)); Harmony.PatchAll(typeof(IgnitionPatch)); } if (EnableInvincibleVehicle.Value) { Harmony.PatchAll(typeof(InvulnerableVehiclePatch)); } if (EnableMagnetChanges.Value) { Harmony.PatchAll(typeof(MagnetPatch)); } if (EnableSpringForceModification.Value || EnablePushForceModification.Value || EnableJumpForceModification.Value) { Harmony.PatchAll(typeof(VehicleForcesPatch)); } if (EnableAlwaysStart.Value) { Harmony.PatchAll(typeof(AlwaysStartPatch)); } Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Rocket.CruiserMod"; public const string PLUGIN_NAME = "CruiserMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace CruiserMod.Patches { [HarmonyPatch(typeof(VehicleController))] public class AlwaysStartPatch { [HarmonyPatch("TryIgnition")] [HarmonyPrefix] private static void TryIgnitionPrefix(VehicleController __instance) { if (CruiserMod.EnableAlwaysStart.Value) { __instance.chanceToStartIgnition = 100f; CruiserMod.Logger.LogDebug((object)"Vehicle set to always start on first try"); } } [HarmonyPatch("SetIgnition")] [HarmonyPostfix] private static void SetIgnitionPostfix(VehicleController __instance, bool started) { if (CruiserMod.EnableAlwaysStart.Value && started) { CruiserMod.Logger.LogDebug((object)"Vehicle started successfully"); } } } [HarmonyPatch(typeof(VehicleController))] public class EjectPatch { [HarmonyPatch("SpringDriverSeatLocalClient")] [HarmonyPostfix] private static void SpringDriverPostfix(VehicleController __instance) { if (CruiserMod.explosionArmed) { ((MonoBehaviour)__instance).StartCoroutine(DelayedDestroy(__instance)); CruiserMod.explosionArmed = false; } } private static IEnumerator DelayedDestroy(VehicleController vehicle) { yield return (object)new WaitForSeconds(1f); vehicle.DestroyCar(); } } [HarmonyPatch(typeof(VehicleController))] public class IgnitionPatch { private static Key shiftKey = (Key)51; [HarmonyPatch("TryIgnition")] [HarmonyPrefix] private static void TryIgnitionPrefix(VehicleController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (((ButtonControl)Keyboard.current[shiftKey]).isPressed) { CruiserMod.explosionArmed = true; } else { CruiserMod.explosionArmed = false; } } [HarmonyPatch("SetIgnition")] [HarmonyPostfix] private static void SetIgnitionPostfix(VehicleController __instance, bool started) { if (!started && CruiserMod.explosionArmed) { CruiserMod.explosionArmed = false; } } } [HarmonyPatch(typeof(VehicleController))] public class InvulnerableVehiclePatch { [HarmonyPatch("DealPermanentDamage")] [HarmonyPrefix] private static bool PreventDamage(VehicleController __instance, int damageAmount, Vector3 damagePosition) { return false; } } [HarmonyPatch(typeof(VehicleController))] public class MagnetPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePostfix(VehicleController __instance) { if (((NetworkBehaviour)__instance).IsOwner && !StartOfRound.Instance.isObjectAttachedToMagnet && StartOfRound.Instance.magnetOn) { __instance.StartMagneting(); } } } [HarmonyPatch(typeof(VehicleController))] public class VehicleForcesPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePostfix(VehicleController __instance) { if (CruiserMod.EnableSpringForceModification.Value) { __instance.springForce = CruiserMod.CustomSpringForce.Value; } if (CruiserMod.EnablePushForceModification.Value) { __instance.pushForceMultiplier = CruiserMod.CustomPushForceMultiplier.Value; } if (CruiserMod.EnableJumpForceModification.Value) { __instance.jumpForce = CruiserMod.CustomJumpForce.Value; } } [HarmonyPatch("SpringDriverSeatLocalClient")] [HarmonyPrefix] private static void SpringDriverSeatPrefix(VehicleController __instance) { if (CruiserMod.EnableSpringForceModification.Value) { __instance.springForce = CruiserMod.CustomSpringForce.Value; } } [HarmonyPatch("PushTruckWithArms")] [HarmonyPrefix] private static void PushTruckWithArmsPrefix(VehicleController __instance) { if (CruiserMod.EnablePushForceModification.Value) { __instance.pushForceMultiplier = CruiserMod.CustomPushForceMultiplier.Value; } } [HarmonyPatch("jerkCarUpward")] [HarmonyPrefix] private static void JerkCarUpwardPrefix(VehicleController __instance) { if (CruiserMod.EnableJumpForceModification.Value) { __instance.jumpForce = CruiserMod.CustomJumpForce.Value; } } } }