Decompiled source of Scandals Testing Stuff v1.0.2

BepInEx/plugins/ScandalsStuff/scandals.testingstuff.dll

Decompiled 2 years ago
using 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.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Animations.Rigging;
using scandals.testingstuff.NetcodePatcher;

[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[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.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: AssemblyCompany("scandals.testingstuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("ScandalsTruckStuff")]
[assembly: AssemblyTitle("scandals.testingstuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 ScandalsTruckStuff
{
	[BepInPlugin("scandals.testingstuff", "ScandalsTruckStuff", "1.0.2")]
	public class ScandalsTruckStuff : BaseUnityPlugin
	{
		public static ScandalsTruckStuff 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;
			NetcodePatcher();
			Patch();
			Logger.LogInfo((object)"scandals.testingstuff v1.0.2 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("scandals.testingstuff");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			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!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "scandals.testingstuff";

		public const string PLUGIN_NAME = "ScandalsTruckStuff";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace ScandalsTruckStuff.Utils
{
	public class NullMemberException : Exception
	{
		private NullMemberException(string message)
			: base(message)
		{
		}

		public static NullMemberException Method(Type type, string methodName, Type[] parameters = null, Type[] generics = null)
		{
			string text = "";
			string text2 = "";
			if (parameters != null && parameters.Length != 0)
			{
				text = string.Join(", ", parameters.Select((Type param) => param.ToString()));
			}
			if (generics != null && generics.Length != 0)
			{
				text2 = "<" + string.Join(", ", generics.Select((Type param) => param.ToString())) + ">";
			}
			return new NullMemberException("Could not find method " + type.Name + ":" + text2 + methodName + "(" + text + ")");
		}

		public static NullMemberException Field(Type type, string fieldName)
		{
			return new NullMemberException("Could not find field " + type.Name + "." + fieldName);
		}
	}
	internal static class PatchUtils
	{
		public struct OpcodeMatch
		{
			public OpCode opcode;

			public object operandOrNull;

			public OpcodeMatch(OpCode opcode)
			{
				operandOrNull = null;
				this.opcode = opcode;
			}

			public OpcodeMatch(OpCode opcode, object operand)
			{
				operandOrNull = null;
				this.opcode = opcode;
				operandOrNull = operand;
			}
		}

		public static bool OperandCompare(object inputOperand, object codeInstructionOperand)
		{
			if (inputOperand.Equals(codeInstructionOperand))
			{
				return true;
			}
			Type type = codeInstructionOperand.GetType();
			if (type == typeof(LocalBuilder))
			{
				return inputOperand.Equals(((LocalBuilder)codeInstructionOperand).LocalIndex);
			}
			return Convert.ChangeType(inputOperand, codeInstructionOperand.GetType())?.Equals(codeInstructionOperand) ?? false;
		}

		public static int LocateCodeSegment(int startIndex, List<CodeInstruction> searchSpace, List<OpcodeMatch> searchFor)
		{
			if (startIndex < 0 || startIndex >= searchSpace.Count)
			{
				return -1;
			}
			int num = 0;
			for (int i = startIndex; i < searchSpace.Count; i++)
			{
				CodeInstruction val = searchSpace[i];
				OpcodeMatch opcodeMatch = searchFor[num];
				bool flag = val.opcode == opcodeMatch.opcode;
				if (flag && opcodeMatch.operandOrNull != null)
				{
					flag = OperandCompare(opcodeMatch.operandOrNull, val.operand);
				}
				if (flag)
				{
					num++;
					if (num == searchFor.Count)
					{
						return i - num + 1;
					}
				}
				else
				{
					num = 0;
				}
			}
			return -1;
		}

		public static string GetAllMaskLayers(LayerMask _mask)
		{
			int value = ((LayerMask)(ref _mask)).value;
			string text = "";
			for (int i = 0; i < 32; i++)
			{
				if (((1 << i) & value) != 0)
				{
					text = text + " " + LayerMask.LayerToName(i);
				}
			}
			return text;
		}

		public static bool TryMethod(Type type, string name, out MethodInfo methodInfo)
		{
			return TryMethod(type, name, null, null, out methodInfo);
		}

		public static bool TryMethod(Type type, string name, Type[] parameters, out MethodInfo methodInfo)
		{
			return TryMethod(type, name, parameters, null, out methodInfo);
		}

		public static bool TryMethod(Type type, string name, Type[] parameters, Type[] generics, out MethodInfo methodInfo)
		{
			if (parameters == null && generics == null)
			{
				methodInfo = type.GetMethod(name, AccessTools.all);
			}
			else
			{
				if (generics == null)
				{
					generics = Type.EmptyTypes;
				}
				if (parameters == null)
				{
					parameters = Type.EmptyTypes;
				}
				methodInfo = type.GetMethod(name, generics.Length, AccessTools.all, null, parameters, null);
				if (generics.Length != 0)
				{
					methodInfo = methodInfo.MakeGenericMethod(generics);
				}
			}
			return methodInfo != null;
		}

		public static MethodInfo Method(Type type, string name, Type[] parameters = null, Type[] generics = null)
		{
			if (!TryMethod(type, name, parameters, generics, out MethodInfo methodInfo))
			{
				throw NullMemberException.Method(type, name, parameters, generics);
			}
			return methodInfo;
		}

		public static bool TryField(Type type, string name, out FieldInfo fieldInfo)
		{
			fieldInfo = AccessTools.Field(type, name);
			return fieldInfo != null;
		}

		public static FieldInfo Field(Type type, string name)
		{
			if (!TryField(type, name, out FieldInfo fieldInfo))
			{
				throw NullMemberException.Field(type, name);
			}
			return fieldInfo;
		}
	}
}
namespace ScandalsTruckStuff.Patches
{
	[HarmonyPatch(typeof(VehicleController))]
	internal class CruiserPatches
	{
		private static GameObject frontLeftSteeringAxis;

		private static GameObject frontRightSteeringAxis;

		private static MeshRenderer frontLeftMeshRender;

		private static MeshRenderer frontRightMeshRender;

		private static GameObject frontLeftRotAxis;

		private static GameObject frontRightRotAxis;

		private static GameObject backLeftRotAxis;

		private static GameObject backRightRotAxis;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePostfix(VehicleController __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			frontLeftSteeringAxis = new GameObject("FLSteeringAxis");
			frontRightSteeringAxis = new GameObject("FRSteeringAxis");
			frontLeftRotAxis = new GameObject("FLRotAxis");
			frontRightRotAxis = new GameObject("FRRotAxis");
			backLeftRotAxis = new GameObject("RLRotAxis");
			backRightRotAxis = new GameObject("RRRotAxis");
			frontLeftSteeringAxis.transform.SetParent(((Component)__instance.FrontLeftWheel).transform.parent);
			frontRightSteeringAxis.transform.SetParent(((Component)__instance.FrontRightWheel).transform.parent);
			frontLeftRotAxis.transform.SetParent(frontLeftSteeringAxis.transform);
			frontRightRotAxis.transform.SetParent(frontRightSteeringAxis.transform);
			backLeftRotAxis.transform.SetParent(((Component)__instance.BackLeftWheel).transform.parent);
			backRightRotAxis.transform.SetParent(((Component)__instance.BackRightWheel).transform.parent);
			__instance.SetHeadlightMaterial(false);
			__instance.SetHeadlightMaterial(true);
		}

		[HarmonyPatch("SetWheelFriction")]
		[HarmonyPostfix]
		private static void SetWheelFrictionPostfix(VehicleController __instance)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			WheelFrictionCurve val = default(WheelFrictionCurve);
			((WheelFrictionCurve)(ref val)).extremumSlip = 0.2f;
			((WheelFrictionCurve)(ref val)).extremumValue = 1f;
			((WheelFrictionCurve)(ref val)).asymptoteSlip = 0.8f;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 1f;
			((WheelFrictionCurve)(ref val)).stiffness = 2f;
			__instance.FrontRightWheel.forwardFriction = val;
			__instance.FrontLeftWheel.forwardFriction = val;
			((WheelFrictionCurve)(ref val)).stiffness = 0.75f;
			__instance.BackRightWheel.forwardFriction = val;
			__instance.BackLeftWheel.forwardFriction = val;
			((WheelFrictionCurve)(ref val)).stiffness = 2f;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 1f;
			((WheelFrictionCurve)(ref val)).extremumSlip = 0.7f;
			__instance.FrontRightWheel.sidewaysFriction = val;
			__instance.FrontLeftWheel.sidewaysFriction = val;
			__instance.BackRightWheel.sidewaysFriction = val;
			__instance.BackLeftWheel.sidewaysFriction = val;
			__instance.FrontLeftWheel.mass = 35f;
			__instance.FrontRightWheel.mass = 35f;
			__instance.BackLeftWheel.mass = 35f;
			__instance.BackRightWheel.mass = 35f;
		}

		[HarmonyPatch("SetCarEffects")]
		[HarmonyPostfix]
		private static void SetCarEffectsPostfix(VehicleController __instance, ref float setSteering)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			frontLeftSteeringAxis.transform.localRotation = Quaternion.Euler(0f, __instance.FrontLeftWheel.steerAngle, 0f);
			frontRightSteeringAxis.transform.localRotation = Quaternion.Euler(0f, 180f + __instance.FrontRightWheel.steerAngle, 0f);
			if ((Object)(object)__instance.currentDriver != (Object)null)
			{
				((RigConstraint<MultiRotationConstraintJob, MultiRotationConstraintData, MultiRotationConstraintJobBinder<MultiRotationConstraintData>>)(object)__instance.currentDriver.cameraLookRig1).weight = 0.33f;
				((RigConstraint<MultiRotationConstraintJob, MultiRotationConstraintData, MultiRotationConstraintJobBinder<MultiRotationConstraintData>>)(object)__instance.currentDriver.cameraLookRig2).weight = 1f;
				((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)__instance.currentDriver.leftArmRigSecondary).weight = 1f;
				((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)__instance.currentDriver.rightArmRigSecondary).weight = 1f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.leftArmRig).weight = 1f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.rightArmRig).weight = 1f;
				__instance.currentDriver.upperBodyAnimationsWeight = 1f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.rightArmProceduralRig).weight = 0f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.rightArmNormalRig).weight = 1f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.leftArmRigSecondaryLocal).weight = 1f;
				((RigConstraint<ChainIKConstraintJob, ChainIKConstraintData, ChainIKConstraintJobBinder<ChainIKConstraintData>>)(object)__instance.currentDriver.rightArmRigSecondaryLocal).weight = 1f;
				__instance.currentDriver.playerBodyAnimator.SetLayerWeight(__instance.currentDriver.playerBodyAnimator.GetLayerIndex("HoldingItemsRightHand"), __instance.currentDriver.upperBodyAnimationsWeight);
				__instance.currentDriver.playerBodyAnimator.SetLayerWeight(__instance.currentDriver.playerBodyAnimator.GetLayerIndex("HoldingItemsBothHands"), __instance.currentDriver.upperBodyAnimationsWeight);
				__instance.currentDriver.specialAnimationWeight = 1f;
				__instance.currentDriver.localArmsTransform.localPosition = new Vector3(0f, -0.008f, -0.43f);
				__instance.currentDriver.localArmsTransform.localRotation = Quaternion.Euler(84.78056f, 0f, 0f);
			}
		}

		[HarmonyPatch("MatchWheelMeshToCollider")]
		[HarmonyPostfix]
		private static void MatchWheelMeshToColliderPostfix(VehicleController __instance, MeshRenderer wheelMesh, WheelCollider wheelCollider)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			frontLeftSteeringAxis.transform.position = ((Component)__instance.FrontLeftWheel).transform.position;
			frontRightSteeringAxis.transform.position = ((Component)__instance.FrontRightWheel).transform.position;
			frontLeftRotAxis.transform.Rotate(Vector3.right, __instance.EngineRPM * 0.5f, (Space)1);
			frontRightRotAxis.transform.Rotate(Vector3.left, __instance.EngineRPM * 0.5f, (Space)1);
			backLeftRotAxis.transform.Rotate(Vector3.right, __instance.EngineRPM * 0.5f, (Space)1);
			backRightRotAxis.transform.Rotate(Vector3.right, __instance.EngineRPM * 0.5f, (Space)1);
			((Component)__instance.backLeftWheelMesh).transform.rotation = backLeftRotAxis.transform.rotation;
			((Component)__instance.backRightWheelMesh).transform.rotation = backRightRotAxis.transform.rotation;
			((Component)__instance.leftWheelMesh).transform.rotation = frontLeftRotAxis.transform.rotation;
			((Component)__instance.rightWheelMesh).transform.rotation = frontRightRotAxis.transform.rotation;
		}

		[HarmonyPatch("BreakWindshield")]
		[HarmonyPostfix]
		private static void BreakWindshield_Postfix(VehicleController __instance)
		{
			Material[] sharedMaterials = ((Renderer)__instance.mainBodyMesh).sharedMaterials;
			sharedMaterials[2] = __instance.windshieldBrokenMat;
			((Renderer)__instance.mainBodyMesh).sharedMaterials = sharedMaterials;
			Material[] sharedMaterials2 = (Material[])sharedMaterials.Clone();
			((Renderer)__instance.lod1Mesh).sharedMaterials = sharedMaterials2;
			Material[] sharedMaterials3 = (Material[])sharedMaterials.Clone();
			((Renderer)__instance.lod2Mesh).sharedMaterials = sharedMaterials3;
		}

		[HarmonyPatch("SetHeadlightMaterial")]
		[HarmonyPostfix]
		private static void SetHeadlightMaterial_Postfix(VehicleController __instance, bool on)
		{
			Material val = (on ? __instance.headlightsOnMat : __instance.headlightsOffMat);
			Material[] sharedMaterials = ((Renderer)__instance.mainBodyMesh).sharedMaterials;
			sharedMaterials[1] = val;
			((Renderer)__instance.mainBodyMesh).sharedMaterials = sharedMaterials;
			Material[] sharedMaterials2 = (Material[])sharedMaterials.Clone();
			((Renderer)__instance.lod1Mesh).sharedMaterials = sharedMaterials2;
			Material[] sharedMaterials3 = (Material[])sharedMaterials.Clone();
			((Renderer)__instance.lod2Mesh).sharedMaterials = sharedMaterials3;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(VehicleController __instance)
		{
			if (__instance.ignitionStarted && !__instance.magnetedToShip)
			{
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					__instance.EngineRPM = (__instance.FrontLeftWheel.rpm + __instance.FrontRightWheel.rpm + __instance.BackLeftWheel.rpm + __instance.BackRightWheel.rpm) / 4f;
				}
			}
			else
			{
				__instance.EngineRPM = Mathf.Lerp(__instance.EngineRPM, 0f, 3f * Time.deltaTime);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatches
	{
		[HarmonyPatch("LateUpdate")]
		[HarmonyPrefix]
		private static void LateUpdate_Postfix(PlayerControllerB __instance)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.inSpecialInteractAnimation && __instance.inVehicleAnimation)
			{
				((Component)__instance.playerModelArmsMetarig.parent).transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
				__instance.playerModelArmsMetarig.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				((Component)__instance.playerBodyAnimator).transform.localPosition = new Vector3(0f, 0f, 0f);
				((Component)__instance.playerBodyAnimator).transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				((Component)__instance.meshContainer).transform.localPosition = new Vector3(0f, 0f, 0f);
				((Component)__instance.meshContainer).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace scandals.testingstuff.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}