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 EasyVehicleFix v0.1.0
BepInEx/plugins/EasyVehicleFix.dll
Decompiled 5 months 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 BepInEx.Logging; using EasyVehicle; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("EasyVehicle")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EasyVehicleFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("EasyVehicleFix")] [assembly: AssemblyTitle("EasyVehicleFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EasyVehicleFix { public static class MyPluginInfo { public const string PLUGIN_GUID = "EasyVehicleFix"; public const string PLUGIN_NAME = "EasyVehicleFix"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace EasyVehiclePatch { [HarmonyPatch] public class Patch { public static InputActionAsset inputActionAsset; public static InputActionMap inputActionMap; public static InputAction inputActionChangeCamera; private static bool changeCameraKeyDown; private static bool changeCameraChecked; public static PlayerControllerB localPlayerController => StartOfRound.Instance?.localPlayerController; private static void ChangeCameraKeyPressed(CallbackContext callbackContext) { Plugin.Logger.LogInfo((object)"Key pressed."); changeCameraKeyDown = true; } private static void ChangeCameraKeyReleased(CallbackContext callbackContext) { Plugin.Logger.LogInfo((object)"Key released."); changeCameraKeyDown = false; changeCameraChecked = false; } [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] public static void AddKeybind() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Plugin.Logger.LogInfo((object)"Adding keybinds."); inputActionAsset = ScriptableObject.CreateInstance<InputActionAsset>(); inputActionMap = new InputActionMap("EasyVehiclePatch"); InputActionSetupExtensions.AddActionMap(inputActionAsset, inputActionMap); inputActionChangeCamera = InputActionSetupExtensions.AddAction(inputActionMap, "EasyVehiclePatch.ChangeCamera", (InputActionType)0, "<keyboard>/v", (string)null, (string)null, (string)null, (string)null); } [HarmonyPatch(typeof(StartOfRound), "OnEnable")] [HarmonyPostfix] public static void OnEnable() { inputActionAsset.Enable(); inputActionChangeCamera.performed += ChangeCameraKeyPressed; inputActionChangeCamera.canceled += ChangeCameraKeyReleased; } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { inputActionAsset.Disable(); inputActionChangeCamera.performed -= ChangeCameraKeyPressed; inputActionChangeCamera.canceled -= ChangeCameraKeyReleased; } [HarmonyPatch(typeof(VehicleController), "GetVehicleInput")] [HarmonyPostfix] public static void GetVehicleInputPostfix(VehicleController __instance) { if (((NetworkBehaviour)__instance).IsOwner) { float num = __instance.moveInputVector.x * 3f; float num2 = 20f; float num3; if (num > 0.05f) { num3 = 0.99f; } else if (num < -0.05f) { num3 = -0.99f; } else { num3 = 0f; num2 = 7f; } __instance.steeringWheelAnimFloat += (num3 - __instance.steeringWheelAnimFloat) / MathF.Max(1f, num2 * (Time.deltaTime * 60f)); __instance.SetCarEffects(0f); __instance.steeringInput = num; __instance.steeringAnimValue = num; if (__instance.moveInputVector.y > 0.1f) { __instance.ShiftToGearAndSync(1); __instance.drivePedalPressed = true; __instance.brakePedalPressed = false; } else if (__instance.moveInputVector.y < -0.1f) { __instance.ShiftToGearAndSync(2); __instance.drivePedalPressed = true; __instance.brakePedalPressed = false; } else { __instance.ShiftToGearAndSync(3); __instance.drivePedalPressed = false; __instance.brakePedalPressed = false; } } } [HarmonyPatch(typeof(VehicleController), "Update")] [HarmonyPrefix] public static void UpdatePatch(VehicleController __instance) { if (!changeCameraChecked && changeCameraKeyDown) { if ((Object)(object)localPlayerController == (Object)(object)__instance.currentDriver) { VehicleComponent.ShiftCamera(__instance); } changeCameraChecked = true; } } } [BepInPlugin("Glacc.EasyVehicleFix", "EasyVehicleFix", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private static Harmony harmony; private void Awake() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; try { MethodInfo method = typeof(VehicleController_Patch).GetMethod("UpdatePostfix", BindingFlags.Static | BindingFlags.NonPublic); Logger.LogInfo((object)$"Method to unpatch: {method}"); MethodBase originalMethod = Harmony.GetOriginalMethod(typeof(Patch).GetMethod("UpdatePatch")); Logger.LogInfo((object)$"Original method: {originalMethod}"); Plugin.harmony.UnpatchSelf(); Plugin.harmony.PatchAll(typeof(PlayerControllerB_Patch)); } catch (Exception ex) { Logger.LogWarning((object)ex.ToString()); } harmony = new Harmony("EasyVehiclePatch"); harmony.PatchAll(typeof(Patch)); Logger.LogInfo((object)"Plugin Glacc.EasyVehicleFix is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Glacc.EasyVehicleFix"; public const string PLUGIN_NAME = "EasyVehicleFix"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }