Decompiled source of CarJack v1.7.5

CarJack.Common.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CommonAPI;
using DG.Tweening;
using Microsoft.CodeAnalysis;
using Reptile;
using Rewired;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("CarJack.Common")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a78143e9a8a145d78869252df6b5998f040a6bc5")]
[assembly: AssemblyProduct("CarJack.Common")]
[assembly: AssemblyTitle("CarJack.Common")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CarJack.Common
{
	public class CarAssets
	{
		public CarBundle MainBundle;

		public List<CarBundle> Bundles;

		public string MainBundlePath;

		public string AddonBundlePath;

		public string PluginDirectoryName;

		public static CarAssets Instance { get; private set; }

		public CarAssets()
		{
			Bundles = new List<CarBundle>();
			Instance = this;
		}

		public void UnloadAllBundles()
		{
			foreach (CarBundle bundle in Bundles)
			{
				bundle.Bundle.Unload(true);
			}
			Bundles = new List<CarBundle>();
		}

		public void LoadBundles()
		{
			MainBundle = new CarBundle(MainBundlePath);
			Bundles.Add(MainBundle);
			string[] files = Directory.GetFiles(AddonBundlePath, "*.carbundle", SearchOption.AllDirectories);
			foreach (string text in files)
			{
				if (IsPathInsidePluginFolder(text))
				{
					Debug.LogWarning((object)("CarJack Warning: Skipped loading car bundle \"" + text + "\" because it's in the same folder as the CarJack plugin. Car bundles should be placed in their own subfolder inside the plugins folder."));
					continue;
				}
				try
				{
					CarBundle item = new CarBundle(text);
					Bundles.Add(item);
				}
				catch (Exception arg)
				{
					Debug.LogError((object)$"CarJack Error: Failed to load car bundle \"{text}\".\nException:\n{arg}");
				}
			}
		}

		private bool IsPathInsidePluginFolder(string path)
		{
			if (string.IsNullOrEmpty(PluginDirectoryName))
			{
				return false;
			}
			path = CleanPath(path);
			string value = CleanPath(Path.Combine(AddonBundlePath, PluginDirectoryName));
			if (path.StartsWith(value))
			{
				return true;
			}
			return false;
		}

		private string CleanPath(string path)
		{
			path = path.Replace('\\', '/').ToLowerInvariant().Trim();
			while (path.EndsWith("/") && path.Length > 1)
			{
				path = path.Substring(0, path.Length - 1);
			}
			return path;
		}
	}
	[RequireComponent(typeof(AudioSource))]
	public class CarAudioSource : MonoBehaviour
	{
		public enum AudioTypes
		{
			Master = 0,
			Music = 4,
			SFX = 1,
			UI = 2,
			Gameplay = 3,
			Voices = 5,
			Ambience = 6
		}

		public AudioTypes AudioType = AudioTypes.Gameplay;

		private DrivableCar _car;

		private AudioSource _audioSource;

		private void Awake()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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
			_car = ((Component)this).GetComponentInParent<DrivableCar>();
			_audioSource = ((Component)this).GetComponent<AudioSource>();
			_audioSource.outputAudioMixerGroup = Core.Instance.AudioManager.mixerGroups[(int)AudioType];
			Core.OnCoreUpdatePaused += new OnCoreUpdateHandler(OnPause);
			Core.OnCoreUpdateUnPaused += new OnCoreUpdateUnpausedHandler(OnUnPause);
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Core.OnCoreUpdatePaused -= new OnCoreUpdateHandler(OnPause);
			Core.OnCoreUpdateUnPaused -= new OnCoreUpdateUnpausedHandler(OnUnPause);
		}

		private void OnPause()
		{
			_audioSource.mute = true;
		}

		private void OnUnPause()
		{
			_audioSource.mute = false;
		}

		private void Update()
		{
			if (!Core.Instance.IsCorePaused)
			{
				CarCamera instance = CarCamera.Instance;
				if ((Object)(object)instance == (Object)null || (Object)(object)instance.Target != (Object)(object)_car)
				{
					_audioSource.spatialBlend = 1f;
				}
				else
				{
					_audioSource.spatialBlend = 0f;
				}
			}
		}
	}
	public class CarBundle
	{
		public string Name;

		public AssetBundle Bundle;

		public CarBundle(string path)
		{
			Name = Path.GetFileNameWithoutExtension(path);
			Bundle = AssetBundle.LoadFromFile(path);
			if ((Object)(object)Bundle == (Object)null)
			{
				throw new IOException("AssetBundle.LoadFromFile returned null!");
			}
		}
	}
	public class CarCamera : MonoBehaviour
	{
		public static bool Enabled = true;

		public float Radius = 0.1f;

		public float MaxLerpSpeed = 5f;

		public float MaxLerpSpeedJoystick = 2f;

		public float FreeCameraTimer = 1f;

		public LayerMask ObstructionMask;

		public float LerpMultiplier = 0.15f;

		public float Distance = 7f;

		public float Height = 2f;

		public DrivableCar Target;

		private bool _controller;

		private float _xAxis;

		private float _yAxis;

		private bool _wasLookingBehind;

		private bool _lookBehind;

		private float _currentFreeCameraTimer;

		public static CarCamera Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		private void ResetInputs()
		{
			_controller = false;
			_xAxis = 0f;
			_yAxis = 0f;
			_lookBehind = false;
		}

		private void PollInputs()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			ResetInputs();
			GameInput gameInput = Core.Instance.GameInput;
			_xAxis = gameInput.GetAxis(13, 0);
			_yAxis = gameInput.GetAxis(14, 0);
			_lookBehind = gameInput.GetButtonHeld(12, 0);
			if ((int)gameInput.GetCurrentControllerType(0) == 2)
			{
				_currentFreeCameraTimer = 0f;
				_controller = true;
			}
			if ((_xAxis != 0f || _yAxis != 0f) && !_controller)
			{
				_currentFreeCameraTimer = FreeCameraTimer;
			}
		}

		private void Update()
		{
			//IL_00d9: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled || Core.Instance.IsCorePaused || (Object)(object)Target == (Object)null)
			{
				return;
			}
			PollInputs();
			float aimSensitivity = Core.Instance.SaveManager.Settings.gameplaySettings.aimSensitivity;
			bool invertY = Core.Instance.SaveManager.Settings.gameplaySettings.invertY;
			float num = Mathf.Lerp(0.75f, 1.8f, aimSensitivity);
			float num2 = MaxLerpSpeed;
			_currentFreeCameraTimer = Mathf.Max(_currentFreeCameraTimer - Time.deltaTime, 0f);
			Quaternion val;
			if (_controller || _currentFreeCameraTimer > 0f)
			{
				if (_controller && (_xAxis != 0f || _yAxis != 0f))
				{
					num2 = MaxLerpSpeedJoystick;
				}
				val = ((Component)this).transform.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles;
				eulerAngles.y += _xAxis * num;
				eulerAngles.x += _yAxis * num * (float)(invertY ? 1 : (-1));
				eulerAngles.z = 0f;
				eulerAngles.x = ConvertTo180Rotation(eulerAngles.x);
				eulerAngles.x = Mathf.Max(-80f, eulerAngles.x);
				eulerAngles.x = Mathf.Min(80f, eulerAngles.x);
				((Component)this).transform.rotation = Quaternion.Euler(eulerAngles);
			}
			Vector3 velocity = Target.Rigidbody.velocity;
			if (Target is DrivableChopper)
			{
				velocity.y = 0f;
			}
			Vector3 normalized = ((Vector3)(ref velocity)).normalized;
			Quaternion val2 = ((Component)this).transform.rotation;
			if (((Vector3)(ref normalized)).magnitude > float.Epsilon && !Target.Still)
			{
				val2 = Quaternion.LookRotation(normalized, Vector3.up);
				Vector3 eulerAngles2 = ((Quaternion)(ref val2)).eulerAngles;
				eulerAngles2.x += Target.ExtraPitch;
				val2 = Quaternion.Euler(eulerAngles2);
			}
			val = Quaternion.Lerp(((Component)this).transform.rotation, val2, Mathf.Min(num2, LerpMultiplier * ((Vector3)(ref velocity)).magnitude) * Time.deltaTime);
			Vector3 eulerAngles3 = ((Quaternion)(ref val)).eulerAngles;
			if (_currentFreeCameraTimer <= 0f)
			{
				((Component)this).transform.rotation = Quaternion.Euler(eulerAngles3.x, eulerAngles3.y, 0f);
			}
			if (_lookBehind)
			{
				((Component)this).transform.rotation = Quaternion.LookRotation(-((Component)Target).transform.forward, Vector3.up);
				val = ((Component)this).transform.rotation;
				Vector3 eulerAngles4 = ((Quaternion)(ref val)).eulerAngles;
				eulerAngles4.x += Target.ExtraPitch;
				((Component)this).transform.rotation = Quaternion.Euler(eulerAngles4);
				_wasLookingBehind = true;
			}
			else if (_wasLookingBehind)
			{
				((Component)this).transform.rotation = Quaternion.LookRotation(((Component)Target).transform.forward, Vector3.up);
				val = ((Component)this).transform.rotation;
				Vector3 eulerAngles5 = ((Quaternion)(ref val)).eulerAngles;
				eulerAngles5.x += Target.ExtraPitch;
				((Component)this).transform.rotation = Quaternion.Euler(eulerAngles5);
				_wasLookingBehind = false;
			}
			float num3 = Distance + Target.ExtraDistance;
			float num4 = Height + Target.ExtraHeight;
			Vector3 val3 = ((Component)Target).transform.position + num4 * Vector3.up;
			Vector3 position = val3 - ((Component)this).transform.forward * num3;
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(new Ray(val3, -((Component)this).transform.forward), ref val4, num3 + Radius, LayerMask.op_Implicit(ObstructionMask)))
			{
				position = val3 - ((Component)this).transform.forward * (((RaycastHit)(ref val4)).distance - Radius);
			}
			((Component)this).transform.position = position;
		}

		private float ConvertTo180Rotation(float rotation)
		{
			if (rotation > 180f)
			{
				rotation -= 360f;
			}
			return rotation;
		}

		public void SetTarget(DrivableCar target)
		{
			Target = target;
		}
	}
	public class CarController : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized;
		}

		public static ICarConfig Config;

		public static Action OnPlayerExitingCar;

		public static Action OnPlayerEnteredCar;

		public DrivableCar CurrentCar;

		public CarPassengerSeat CurrentSeat;

		public static CarController Instance { get; private set; }

		public static void Initialize(ICarConfig config)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Config = config;
			object obj = <>O.<0>__StageManager_OnStageInitialized;
			if (obj == null)
			{
				OnStageInitializedDelegate val = StageManager_OnStageInitialized;
				<>O.<0>__StageManager_OnStageInitialized = val;
				obj = (object)val;
			}
			StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj;
		}

		private static void StageManager_OnStageInitialized()
		{
			Create();
			CreateResources();
		}

		private static void CreateResources()
		{
			Object.Instantiate<GameObject>(CarAssets.Instance.MainBundle.Bundle.LoadAsset<GameObject>("Car Resources"));
		}

		public static CarController Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return new GameObject("Car Controller").AddComponent<CarController>();
		}

		private void Awake()
		{
			Instance = this;
		}

		private void Update()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!Core.Instance.IsCorePaused && (Object)(object)CurrentCar != (Object)null)
			{
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				if ((Object)(object)CurrentSeat != (Object)null)
				{
					((Component)currentPlayer).transform.position = ((Component)CurrentSeat).transform.position;
				}
				else
				{
					((Component)currentPlayer).transform.position = ((Component)CurrentCar).transform.position;
				}
				Vector3 val = ((Component)CurrentCar).transform.forward - Vector3.Project(((Component)CurrentCar).transform.forward, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				currentPlayer.SetRotHard(Quaternion.LookRotation(normalized, Vector3.up));
				UpdatePhoneInCar();
			}
		}

		private void UpdatePhoneInCar()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Invalid comparison between Unknown and I4
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Invalid comparison between Unknown and I4
			GameInput gameInput = Core.Instance.GameInput;
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			if (currentPlayer.phone.IsOn)
			{
				currentPlayer.phone.PhoneUpdate();
			}
			else if ((int)gameInput.GetCurrentControllerType(0) == 0 && CurrentCar.Driving)
			{
				if (gameInput.GetButtonNew(17, 0) && !currentPlayer.IsBusyWithSequence() && !currentPlayer.phoneLocked && currentPlayer.phone.m_PhoneAllowed && ((int)currentPlayer.phone.state == 0 || (int)currentPlayer.phone.state == 1 || (int)currentPlayer.phone.state == 3))
				{
					currentPlayer.phone.audioManager.PlaySfxGameplay((SfxCollectionID)23, (AudioClipID)284, 0f);
					currentPlayer.phone.TurnOn();
				}
			}
			else
			{
				currentPlayer.phone.PhoneUpdate();
			}
		}

		private CarCamera MakeCamera(GameObject go)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			CarCamera carCamera = go.AddComponent<CarCamera>();
			carCamera.ObstructionMask = LayerMask.op_Implicit(31);
			return carCamera;
		}

		public void EnterCarAsPassenger(DrivableCar car, int seatIndex)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CurrentCar != (Object)null)
			{
				CurrentCar.Driving = false;
				CurrentCar.InCar = false;
			}
			CarPassengerSeat passengerSeat = car.GetPassengerSeat(seatIndex);
			CurrentCar = car;
			CurrentSeat = passengerSeat;
			car.Driving = false;
			car.InCar = true;
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			currentPlayer.phone.TurnOff(false);
			currentPlayer.StopHoldSpraycan();
			currentPlayer.characterVisual.SetPhone(false);
			car.GroundMask = currentPlayer.motor.groundDetection.groundMask;
			currentPlayer.DisablePlayer();
			currentPlayer.CompletelyStop();
			((Component)currentPlayer).gameObject.SetActive(false);
			((Component)currentPlayer.interactionCollider).transform.parent = ((Component)passengerSeat).transform;
			((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			GameplayCamera instance = GameplayCamera.instance;
			((Behaviour)instance).enabled = false;
			CarCamera carCamera = ((Component)instance).GetComponent<CarCamera>();
			if ((Object)(object)carCamera == (Object)null)
			{
				carCamera = MakeCamera(((Component)instance).gameObject);
			}
			carCamera.SetTarget(car);
			currentPlayer.FlushInput();
			passengerSeat.PutInSeat(currentPlayer);
			OnPlayerEnteredCar?.Invoke();
		}

		public void EnterCar(DrivableCar car)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)CurrentCar != (Object)null)
			{
				CurrentCar.Driving = false;
				CurrentCar.InCar = false;
			}
			CurrentCar = car;
			CurrentSeat = null;
			car.Driving = true;
			car.InCar = true;
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			currentPlayer.phone.TurnOff(false);
			currentPlayer.StopHoldSpraycan();
			currentPlayer.characterVisual.SetPhone(false);
			car.GroundMask = currentPlayer.motor.groundDetection.groundMask;
			currentPlayer.DisablePlayer();
			currentPlayer.CompletelyStop();
			((Component)currentPlayer).gameObject.SetActive(false);
			((Component)currentPlayer.interactionCollider).transform.parent = ((Component)car).transform;
			((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			GameplayCamera instance = GameplayCamera.instance;
			((Behaviour)instance).enabled = false;
			CarCamera component = ((Component)instance).GetComponent<CarCamera>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			component = MakeCamera(((Component)instance).gameObject);
			component.SetTarget(car);
			currentPlayer.FlushInput();
			car.EnterCar(currentPlayer);
			OnPlayerEnteredCar?.Invoke();
		}

		public void ExitCar()
		{
			//IL_00da: 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)
			DrivableCar currentCar = CurrentCar;
			if (!((Object)(object)CurrentCar == (Object)null))
			{
				OnPlayerExitingCar?.Invoke();
				bool flag = false;
				if (CurrentCar.Driving)
				{
					CurrentCar.ExitCar();
				}
				else
				{
					flag = true;
					CurrentSeat.ExitSeat();
				}
				CurrentCar.Driving = false;
				CurrentCar.InCar = false;
				CurrentSeat = null;
				CurrentCar = null;
				GameplayCamera instance = GameplayCamera.instance;
				((Behaviour)instance).enabled = true;
				CarCamera component = ((Component)instance).GetComponent<CarCamera>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				((Component)currentPlayer).gameObject.SetActive(true);
				Transform parent = ((Component)currentPlayer).transform.Find("RootObject");
				((Component)currentPlayer.interactionCollider).transform.parent = parent;
				((Component)currentPlayer.interactionCollider).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
				((Component)currentPlayer.characterVisual).transform.SetAsLastSibling();
				currentPlayer.EnablePlayer(false);
				instance.ResetCameraPositionRotation();
				if (!flag)
				{
					Object.Destroy((Object)(object)((Component)currentCar).gameObject);
				}
			}
		}
	}
	public static class CarDatabase
	{
		public static Dictionary<string, CarEntry> CarByInternalName;

		public static void Initialize()
		{
			CarByInternalName = new Dictionary<string, CarEntry>();
			foreach (CarBundle bundle in CarAssets.Instance.Bundles)
			{
				LoadBundle(bundle);
			}
		}

		private static void LoadBundle(CarBundle bundle)
		{
			foreach (GameObject item in (from x in bundle.Bundle.LoadAllAssets<GameObject>()
				where (Object)(object)x.GetComponent<DrivableCar>() != (Object)null
				select x).ToList())
			{
				DrivableCar component = item.GetComponent<DrivableCar>();
				CarEntry carEntry = new CarEntry();
				carEntry.Bundle = bundle;
				carEntry.Prefab = item;
				CarByInternalName[component.InternalName] = carEntry;
			}
		}
	}
	public class CarDriverSeat : CarSeat
	{
		public int HonkLayerIndex = -1;

		public int ReverseLayerIndex = -1;

		public float ReverseAnimationLerp = 10f;

		public float HonkAnimationLerp = 20f;

		public float SteerAnimationLerp = 5f;

		private float _currentSteer = 0.5f;

		private float _currentHonk;

		private float _currentReverse;

		protected override void Update()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			base.Update();
			if (!((Object)(object)CurrentVisual == (Object)null))
			{
				float num = Car.SteerAxis * 0.5f + 0.5f;
				_currentSteer = Mathf.Lerp(_currentSteer, num, SteerAnimationLerp * Time.deltaTime);
				CurrentVisual.anim.SetFloat("Steer", _currentSteer);
				float num2 = 0f;
				float num3 = 0f;
				if (Vector3.Dot(Car.Rigidbody.velocity, ((Component)Car).transform.forward) <= -1f && Car.ThrottleAxis < 0f && Car.Grounded)
				{
					num3 = 1f;
				}
				if (Car.HornHeld)
				{
					num2 = 1f;
				}
				_currentHonk = Mathf.Lerp(_currentHonk, num2, HonkAnimationLerp * Time.deltaTime);
				_currentReverse = Mathf.Lerp(_currentReverse, num3, ReverseAnimationLerp * Time.deltaTime);
				if (HonkLayerIndex != -1)
				{
					CurrentVisual.anim.SetLayerWeight(HonkLayerIndex, _currentHonk);
				}
				if (ReverseLayerIndex != -1)
				{
					CurrentVisual.anim.SetLayerWeight(ReverseLayerIndex, _currentReverse);
				}
			}
		}
	}
	public class CarEntry
	{
		public CarBundle Bundle;

		public GameObject Prefab;
	}
	public class CarPassengerSeat : CarSeat
	{
		public int SeatIndex;

		protected override void Awake()
		{
			base.Awake();
			BoxCollider componentInChildren = ((Component)this).GetComponentInChildren<BoxCollider>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				((Component)componentInChildren).gameObject.AddComponent<PassengerSeatInteractable>().Initialize(this);
			}
		}
	}
	public class CarResources : MonoBehaviour
	{
		public AudioClip[] CrashSFX;

		public static CarResources Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public AudioClip GetCrashSFX()
		{
			return CrashSFX[Random.Range(0, CrashSFX.Length)];
		}
	}
	public abstract class CarSeat : MonoBehaviour
	{
		public bool PlayerVisible = true;

		public RuntimeAnimatorController controller;

		[NonSerialized]
		public DrivableCar Car;

		private float _blinkTimer;

		private const float BlinkDuration = 0.1f;

		public Player Player;

		private Characters _cachedCharacter;

		protected CharacterVisual CurrentVisual;

		protected virtual void Awake()
		{
			Car = ((Component)this).GetComponentInParent<DrivableCar>();
			ResetBlinkTimer();
		}

		private void ResetBlinkTimer()
		{
			_blinkTimer = Random.Range(2, 4);
		}

		public void PutInSeat(Player player)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			_cachedCharacter = player.character;
			Player = player;
			if (PlayerVisible)
			{
				CurrentVisual = VisualFromPlayer(player, controller);
				((Component)CurrentVisual).GetComponentInChildren<Animator>().runtimeAnimatorController = controller;
				((Component)CurrentVisual).transform.SetParent(((Component)this).transform);
				((Component)CurrentVisual).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			}
		}

		public void ExitSeat()
		{
			Player = null;
			if ((Object)(object)CurrentVisual != (Object)null)
			{
				((MonoBehaviour)this).StopAllCoroutines();
				Object.Destroy((Object)(object)((Component)CurrentVisual).gameObject);
			}
		}

		private CharacterVisual VisualFromPlayer(Player player, RuntimeAnimatorController controller)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(((Component)player.characterVisual).gameObject);
			obj.SetActive(true);
			CharacterVisual component = obj.GetComponent<CharacterVisual>();
			((Renderer)component.mainRenderer).enabled = true;
			component.SetMoveStyleVisualAnim((Player)null, (MoveStyle)0, (GameObject)null);
			component.SetMoveStyleVisualProps((Player)null, (MoveStyle)0, false);
			component.SetSpraycan(false, (Characters)(-1));
			component.SetPhone(false);
			component.SetBoostpackEffect((BoostpackEffectMode)0, -1f);
			component.VFX.boostpackTrail.SetActive(false);
			component.Init((Characters)(-1), controller, false, 0f);
			component.canBlink = player.characterVisual.canBlink;
			component.characterObject.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
			OpenEyes(component);
			return component;
		}

		private void LateUpdate()
		{
			if (!Core.Instance.IsCorePaused && !((Object)(object)CurrentVisual == (Object)null) && CurrentVisual.canBlink)
			{
				_blinkTimer -= Time.deltaTime;
				if (_blinkTimer <= 0f)
				{
					ResetBlinkTimer();
					((MonoBehaviour)this).StartCoroutine(DoBlink());
				}
			}
		}

		private IEnumerator DoBlink()
		{
			CloseEyes(CurrentVisual);
			yield return (object)new WaitForSeconds(0.1f);
			OpenEyes(CurrentVisual);
		}

		private void CloseEyes(CharacterVisual visual)
		{
			if (visual.canBlink && visual.mainRenderer.sharedMesh.blendShapeCount > 0)
			{
				visual.mainRenderer.SetBlendShapeWeight(0, 100f);
			}
		}

		private void OpenEyes(CharacterVisual visual)
		{
			if (visual.canBlink && visual.mainRenderer.sharedMesh.blendShapeCount > 0)
			{
				visual.mainRenderer.SetBlendShapeWeight(0, 0f);
			}
		}

		protected virtual void Update()
		{
			//IL_002f: 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)
			if (!Core.Instance.IsCorePaused && (Object)(object)Player != (Object)null && (Object)(object)CurrentVisual != (Object)null && Player.character != _cachedCharacter)
			{
				Player player = Player;
				ExitSeat();
				PutInSeat(player);
			}
		}
	}
	public class CarWheel : MonoBehaviour
	{
		[NonSerialized]
		public bool Grounded;

		[Header("Suspension")]
		public float Damping;

		public float Strength;

		public float StartLength;

		public float MaxDistance;

		public float RestDistance;

		[Header("Visuals")]
		public GameObject Mesh;

		public float MeshRadius = 0.5f;

		public float RotationAcceleration = 100f;

		public float RotationDeacceleration = 1f;

		public float RotationMultiplier = 1f;

		[Header("Stats")]
		public float Mass = 10f;

		public float Traction = 0.5f;

		public float SteerAngle = 45f;

		public float SteerSpeed = 5f;

		public float ReverseSpeed = 400f;

		public float Speed = 10f;

		[Header("Functionality")]
		public bool Throttle;

		public bool Steer;

		public bool HandBrake;

		[NonSerialized]
		public float CurrentSpeed;

		private float _currentRoll;

		private float _currentSteerAngle;

		private DrivableCar _car;

		private float SlipSpeed = 5f;

		private const float MinimumSidewaysSpeedForSlip = 4f;

		private const float SidewaysSlipMultiplier = 0.05f;

		private const float MaximumSuspensionOffsetForRest = 0.5f;

		private float _currentSlip;

		private const float WheelSpinSlip = 0.35f;

		private const float WheelSpinSlipThreshold = 5f;

		private const float MaxSlipTractionLoss = 0.9f;

		public float Slipping => _currentSlip;

		public void Initialize(DrivableCar car)
		{
			_car = car;
		}

		private void OnDrawGizmos()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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)
			Gizmos.color = Color.white;
			Gizmos.DrawWireSphere(((Component)this).transform.position, MeshRadius);
			Gizmos.color = Color.red;
			Gizmos.DrawLine(((Component)this).transform.position + ((Component)this).transform.up * StartLength, ((Component)this).transform.position - ((Component)this).transform.up * MaxDistance);
			Gizmos.color = Color.green;
			Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position - ((Component)this).transform.up * RestDistance);
		}

		public void DoPhysics(ref bool resting)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_0020: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			CalculateSlip();
			bool flag = false;
			if (_car.HasSurfaceAngleLimit && Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= _car.SurfaceAngleLimit)
			{
				flag = true;
				resting = false;
			}
			float num = MaxDistance;
			Grounded = false;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(new Ray(((Component)this).transform.position + ((Component)this).transform.up * StartLength, -((Component)this).transform.up), ref val, MaxDistance + StartLength, LayerMask.op_Implicit(_car.GroundMask)))
			{
				num = ((RaycastHit)(ref val)).distance - StartLength;
				Grounded = true;
				float num2 = RestDistance - num;
				float num3 = Vector3.Dot(_car.Rigidbody.GetPointVelocity(((Component)this).transform.position), ((Component)this).transform.up);
				float num4 = num2 * Strength - num3 * Damping;
				if (flag)
				{
					num4 = Mathf.Max(num4, 0f);
				}
				else if (Mathf.Abs(num2) > 0.5f)
				{
					resting = false;
				}
				if (!_car.Still)
				{
					_car.Rigidbody.AddForceAtPosition(((Component)this).transform.up * num4, ((Component)this).transform.position);
				}
			}
			if ((Object)(object)Mesh != (Object)null)
			{
				Mesh.transform.position = ((Component)this).transform.position - (num - MeshRadius) * ((Component)this).transform.up;
			}
			if (Grounded && !flag)
			{
				float traction = Traction;
				Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position);
				Vector3 val2 = pointVelocity - Vector3.Project(pointVelocity, ((Component)this).transform.up);
				float num5 = Evaluate(value: ((Vector3)(ref val2)).magnitude, curve: _car.TractionCurve, maxValue: _car.TractionCurveMax);
				traction *= num5;
				traction *= 0f - _currentSlip + 1f;
				traction = Mathf.Lerp(traction, 0.1f, _car.DriftingAmount);
				float num6 = (0f - Vector3.Dot(pointVelocity, ((Component)this).transform.right)) * traction / Time.fixedDeltaTime;
				_car.Rigidbody.AddForceAtPosition(((Component)this).transform.right * Mass * num6, ((Component)this).transform.position);
			}
			DoInput(flag);
		}

		private float Evaluate(AnimationCurve curve, float value, float maxValue)
		{
			value = Mathf.Abs(value);
			float num = Mathf.Min(value, maxValue) / maxValue;
			return curve.Evaluate(num);
		}

		private void CalculateSlip()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position);
			float num = Vector3.Dot(pointVelocity, ((Component)this).transform.forward);
			float num2 = Mathf.Abs(CurrentSpeed - num);
			float num3 = 0f;
			if (num2 >= 5f)
			{
				num3 = 0.35f;
			}
			float num4 = Mathf.Abs(Vector3.Dot(pointVelocity, ((Component)this).transform.right));
			num4 = Mathf.Max(0f, num4 - 4f);
			num3 += num4 * 0.05f * _car.SlipMultiplier;
			num3 = Mathf.Clamp(num3, 0f, 0.9f);
			if (_currentSlip < num3)
			{
				_currentSlip = num3;
			}
			_currentSlip = Mathf.Lerp(_currentSlip, num3, SlipSpeed * Time.deltaTime);
		}

		private void DoInput(bool tooSteep)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			Vector3 pointVelocity = _car.Rigidbody.GetPointVelocity(((Component)this).transform.position);
			Vector3 val = pointVelocity - Vector3.Project(pointVelocity, ((Component)this).transform.up);
			_ = ((Vector3)(ref val)).magnitude;
			float num = Vector3.Dot(pointVelocity, ((Component)this).transform.forward);
			float throttleAxis = _car.ThrottleAxis;
			float steerAxis = _car.SteerAxis;
			if (Grounded)
			{
				float num2 = 1f - Mathf.Abs(throttleAxis);
				if (num > 0f)
				{
					_car.Rigidbody.AddForceAtPosition(-((Component)this).transform.forward * _car.Deacceleration * num2, ((Component)this).transform.position);
				}
				else
				{
					_car.Rigidbody.AddForceAtPosition(((Component)this).transform.forward * _car.Deacceleration * num2, ((Component)this).transform.position);
				}
			}
			if (Throttle && (!Grounded || tooSteep) && Mathf.Abs(CurrentSpeed) < 100f)
			{
				CurrentSpeed += throttleAxis * RotationAcceleration * Time.deltaTime;
			}
			float num3 = Vector3.Dot(pointVelocity, ((Component)this).transform.forward);
			bool flag = ((num3 > 0.15f && throttleAxis < 0f) || (num3 < -0.15f && throttleAxis > 0f)) && !_car.Still;
			if (Grounded && !tooSteep)
			{
				bool flag2 = false;
				float speed = Speed;
				float num4 = Mathf.Min(Mathf.Abs(num), _car.SpeedCurveMax) / _car.SpeedCurveMax;
				float num5 = _car.SpeedCurve.Evaluate(num4);
				speed *= num5;
				if (throttleAxis < 0f)
				{
					speed = ReverseSpeed;
					num4 = Mathf.Min(Mathf.Abs(num), _car.ReverseCurveMax) / _car.ReverseCurveMax;
					num5 = _car.ReverseCurve.Evaluate(num4);
					speed *= num5;
				}
				Vector3 velocity;
				if (flag)
				{
					speed = _car.BrakeForce;
					velocity = _car.Rigidbody.velocity;
					if (((Vector3)(ref velocity)).magnitude <= 0.15f || _car.Still)
					{
						speed = 0f;
					}
				}
				float num6 = throttleAxis * speed;
				if (Throttle)
				{
					flag2 = true;
				}
				if (flag)
				{
					flag2 = true;
				}
				if (_car.BrakeHeld && HandBrake)
				{
					if (num3 > 0f)
					{
						num6 = 0f - _car.HandBrakeForce;
					}
					else if (num3 < 0f)
					{
						num6 = _car.HandBrakeForce;
					}
					velocity = _car.Rigidbody.velocity;
					if (((Vector3)(ref velocity)).magnitude <= 0.15f || _car.Still)
					{
						num6 = 0f;
					}
					flag2 = true;
				}
				if (flag2)
				{
					_car.Rigidbody.AddForceAtPosition(((Component)this).transform.forward * num6, ((Component)this).transform.position);
				}
			}
			if (Steer)
			{
				float steerAngle = SteerAngle;
				float num7 = Evaluate(_car.SteerCurve, num, _car.SteerCurveMax);
				float num8 = steerAngle * num7 * steerAxis;
				_currentSteerAngle = Mathf.Lerp(_currentSteerAngle, num8, SteerSpeed * Time.deltaTime);
				float num9 = 0f;
				if (Grounded)
				{
					num9 = _car.CounterSteering;
				}
				((Component)this).transform.localRotation = Quaternion.Euler(0f, _currentSteerAngle + num9, 0f);
			}
		}

		public void DoUpdate()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			if (Grounded)
			{
				float num = Vector3.Dot(_car.Rigidbody.GetPointVelocity(((Component)this).transform.position), ((Component)this).transform.forward);
				float num2 = Mathf.Abs(num);
				float num3 = Mathf.Abs(_car.ThrottleAxis);
				CurrentSpeed = num;
				if (num3 >= 0.9f && num2 <= num3 * 4f && Mathf.Sign(num) == Mathf.Sign(_car.ThrottleAxis) && Throttle)
				{
					CurrentSpeed = 50f * Mathf.Sign(_car.ThrottleAxis);
				}
			}
			else if (CurrentSpeed > 0f)
			{
				CurrentSpeed = Mathf.Max(CurrentSpeed - RotationDeacceleration * Time.deltaTime, 0f);
			}
			else
			{
				CurrentSpeed = Mathf.Min(CurrentSpeed + RotationDeacceleration * Time.deltaTime, 0f);
			}
			if (_car.BrakeHeld && HandBrake)
			{
				CurrentSpeed = 0f;
			}
			_currentRoll += CurrentSpeed * RotationMultiplier * Time.deltaTime;
			_currentRoll -= Mathf.Floor(_currentRoll / 360f) * 360f;
			Mesh.transform.localRotation = Quaternion.Euler(_currentRoll, 0f, 0f);
		}
	}
	public class DrivableCar : MonoBehaviour
	{
		private const int CurrentVersion = 1;

		[HideInInspector]
		[SerializeField]
		private int Version;

		[Header("Unique identifier")]
		public string InternalName = "";

		[Header("How much the car should countersteer to avoid losing control")]
		public float CounterSteerMultiplier = 0.1f;

		[Header("How sensible the car is to sliding")]
		public float SlipMultiplier = 0.75f;

		public bool HasSurfaceAngleLimit = true;

		public float SurfaceAngleLimit = 60f;

		public float Deacceleration = 100f;

		[Header("Curves based on the car's speed")]
		public AnimationCurve ReverseCurve;

		public float ReverseCurveMax = 50f;

		public float BrakeForce = 1000f;

		public float HandBrakeForce = 500f;

		public AnimationCurve SteerCurve;

		public float SteerCurveMax = 50f;

		public AnimationCurve SpeedCurve;

		public float SpeedCurveMax = 50f;

		public AnimationCurve TractionCurve;

		public float TractionCurveMax = 50f;

		public LayerMask GroundMask;

		public Transform CenterOfMass;

		[NonSerialized]
		public Rigidbody Rigidbody;

		[NonSerialized]
		public CarWheel[] Wheels;

		[NonSerialized]
		public GameObject Chassis;

		[NonSerialized]
		public bool Driving;

		[NonSerialized]
		public bool InCar;

		protected const float ControllerRotationDeadZone = 0.2f;

		[NonSerialized]
		public bool InputEnabled = true;

		[NonSerialized]
		public float ThrottleAxis;

		[NonSerialized]
		public float SteerAxis;

		[NonSerialized]
		public bool HornHeld;

		[NonSerialized]
		public bool GetOutOfCarButtonNew;

		[NonSerialized]
		public float PitchAxis;

		[NonSerialized]
		public float YawAxis;

		[NonSerialized]
		public float RollAxis;

		[NonSerialized]
		public bool BrakeHeld;

		[NonSerialized]
		public bool LockDoorsButtonNew;

		private Vector3 _velocityBeforePause;

		private Vector3 _angularVelocityBeforePause;

		private Vector3 _previousVelocity = Vector3.zero;

		private Vector3 _previousAngularVelocity = Vector3.zero;

		private OneShotAudioSource _oneShotAudioSource;

		private ScrapeAudio _scrapeAudio;

		private float _crashAudioCooldown;

		[NonSerialized]
		public CarDriverSeat DriverSeat;

		public Action OnHandleInput;

		[Header("Air Control")]
		public float AirControlStrength = 1f;

		public float AirControlTopSpeed = 2f;

		public float AirDeacceleration = 1f;

		[Header("How much you can alter the car's direction in the air.")]
		public float AirAerodynamics;

		[Header("Camera")]
		public float ExtraDistance;

		public float ExtraHeight;

		public float ExtraPitch;

		private bool _grounded;

		private bool _steep;

		private bool _resting;

		private const float LastSafeLocationInterval = 0.5f;

		private float _lastSafeLocationTimer = 0.5f;

		private Vector3 _prevLastSafePosition = Vector3.zero;

		private Quaternion _prevLastSafeRotation = Quaternion.identity;

		private Vector3 _lastSafePosition = Vector3.zero;

		private Quaternion _lastSafeRotation = Quaternion.identity;

		public const float MaximumSpeedForStill = 0.15f;

		private const float MaximumAngleForStill = 20f;

		private const float StillTime = 0.25f;

		private bool _still;

		private float _stillTimer;

		public const float MinimumSidewaysVelocityForDrift = 1f;

		public const float DriftMinimumAngle = 20f;

		public const float DriftingLerp = 5f;

		public const float DriftTraction = 0.1f;

		[NonSerialized]
		public float DriftingAmount;

		[NonSerialized]
		public float CounterSteering;

		[NonSerialized]
		public bool DoorsLocked;

		[NonSerialized]
		public bool AllWheelsOffGround;

		private CarPassengerSeat[] _passengerSeats;

		[NonSerialized]
		protected bool AllowAutoRecovery = true;

		private const float AutoRecoveryVelocityThreshold = 0.1f;

		private const float AutoRecoveryTime = 1f;

		private float _autoRecoveryTimer = 1f;

		private bool _forcedPause;

		public bool Grounded => _grounded;

		public bool Still => _still;

		private void UpdateAutoRecovery()
		{
			if (!PlayerData.Instance.AutoRecover || !AllowAutoRecovery)
			{
				_autoRecoveryTimer = 1f;
			}
			else if (IsStuck())
			{
				_autoRecoveryTimer -= Time.deltaTime;
				if (_autoRecoveryTimer <= 0f)
				{
					_autoRecoveryTimer = 1f;
					PlaceAtLastSafeLocation();
				}
			}
			else
			{
				_autoRecoveryTimer = 1f;
			}
		}

		private bool IsStuck()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Rigidbody.velocity;
			float magnitude = ((Vector3)(ref val)).magnitude;
			val = Rigidbody.angularVelocity;
			if (magnitude + ((Vector3)(ref val)).magnitude > 0.1f)
			{
				return false;
			}
			if (!AllWheelsOffGround && !_steep)
			{
				return false;
			}
			return true;
		}

		private void UpdateAirAero()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Dot(Rigidbody.velocity, ((Component)this).transform.forward);
			Vector3 val = Rigidbody.velocity - Vector3.Project(Rigidbody.velocity, ((Component)this).transform.forward);
			val = Vector3.Lerp(val, Vector3.zero, AirAerodynamics * Time.deltaTime);
			Rigidbody.velocity = val + num * ((Component)this).transform.forward;
		}

		private void UpdateCounterSteer()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			CounterSteering = 0f;
			Vector3 velocity = Rigidbody.velocity;
			if (!(((Vector3)(ref velocity)).magnitude < 5f))
			{
				Vector3 forward = ((Component)this).transform.forward;
				velocity = Rigidbody.velocity;
				bool flag = Vector3.Dot(forward, ((Vector3)(ref velocity)).normalized) < 0f;
				Vector3 val = (flag ? (-((Component)this).transform.forward) : ((Component)this).transform.forward);
				velocity = Rigidbody.velocity;
				float num = Vector3.SignedAngle(val, ((Vector3)(ref velocity)).normalized, ((Component)this).transform.up);
				float num2 = CounterSteerMultiplier * (0f - Mathf.Abs(SteerAxis) + 1f);
				CounterSteering = num * num2 * (flag ? (-1f) : 1f);
			}
		}

		private void UpdateDrift()
		{
			float targetDrift = GetTargetDrift();
			if (targetDrift < DriftingAmount)
			{
				DriftingAmount = Mathf.Lerp(DriftingAmount, targetDrift, 5f * Time.deltaTime);
			}
			else
			{
				DriftingAmount = targetDrift;
			}
		}

		private float GetTargetDrift()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Dot(Rigidbody.velocity, ((Component)this).transform.right);
			Vector3 forward = ((Component)this).transform.forward;
			Vector3 velocity = Rigidbody.velocity;
			bool flag = Vector3.Dot(forward, ((Vector3)(ref velocity)).normalized) < 0f;
			if (flag)
			{
				return 0f;
			}
			Vector3 val = (flag ? (-((Component)this).transform.forward) : ((Component)this).transform.forward);
			velocity = Rigidbody.velocity;
			float num2 = Vector3.Angle(val, ((Vector3)(ref velocity)).normalized);
			if (Mathf.Abs(num) < 1f)
			{
				return 0f;
			}
			if (num2 < 20f)
			{
				return 0f;
			}
			return Mathf.Abs(ThrottleAxis);
		}

		private void UpdateStill()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			_still = false;
			if (IsStill())
			{
				if (_stillTimer >= 0.25f)
				{
					Rigidbody.velocity = Vector3.zero;
					Rigidbody.angularVelocity = Vector3.zero;
					Rigidbody.Sleep();
					_still = true;
				}
				else
				{
					_stillTimer += Time.deltaTime;
				}
			}
			else
			{
				Rigidbody.WakeUp();
				_stillTimer = 0f;
			}
		}

		private bool IsStill()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (!_resting)
			{
				return false;
			}
			if (!_grounded)
			{
				return false;
			}
			if (_steep)
			{
				return false;
			}
			if (ThrottleAxis != 0f && !BrakeHeld)
			{
				return false;
			}
			Vector3 val = Rigidbody.velocity;
			float magnitude = ((Vector3)(ref val)).magnitude;
			val = Rigidbody.angularVelocity;
			if (magnitude + ((Vector3)(ref val)).magnitude > 0.15f)
			{
				return false;
			}
			if (Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= 20f)
			{
				return false;
			}
			return true;
		}

		public void Initialize()
		{
			Driving = false;
			ResetLastSafeLocation();
		}

		private void FixUp()
		{
			((Component)this).gameObject.layer = 17;
			Transform val = ((Component)this).transform.Find("Interaction");
			if ((Object)(object)val != (Object)null)
			{
				((Component)val).gameObject.layer = 9;
			}
			FixUpVersion();
		}

		private void FixUpVersion()
		{
			if (Version < 1)
			{
				CarWheel[] componentsInChildren = ((Component)this).GetComponentsInChildren<CarWheel>();
				foreach (CarWheel obj in componentsInChildren)
				{
					obj.HandBrake = obj.Throttle;
				}
			}
		}

		private void PlaceAtLastSafeLocation()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			PlaceAt(_prevLastSafePosition, _prevLastSafeRotation);
			ResetLastSafeLocation();
		}

		private void RecordLastSafeLocation()
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			_lastSafeLocationTimer = 0.5f;
			_prevLastSafePosition = _lastSafePosition;
			_prevLastSafeRotation = _lastSafeRotation;
			_lastSafePosition = Rigidbody.position;
			_lastSafeRotation = Rigidbody.rotation;
		}

		private void ResetLastSafeLocation()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			_lastSafeLocationTimer = 0.5f;
			_lastSafePosition = Rigidbody.position;
			_lastSafeRotation = Rigidbody.rotation;
			_prevLastSafePosition = _lastSafePosition;
			_prevLastSafeRotation = _lastSafeRotation;
		}

		private void OnCrash(float force, Vector3 point)
		{
			if (!(force < 4f) && !(_crashAudioCooldown > 0f))
			{
				AudioClip crashSFX = CarResources.Instance.GetCrashSFX();
				_oneShotAudioSource.Play(crashSFX);
				_crashAudioCooldown = 0.5f;
			}
		}

		private void OnCollisionStay(Collision other)
		{
			if ((Object)(object)_scrapeAudio != (Object)null)
			{
				_scrapeAudio.OnScrape(other);
			}
		}

		private void OnCollisionEnter(Collision other)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Rigidbody.velocity - _previousVelocity;
			float magnitude = ((Vector3)(ref val)).magnitude;
			val = Rigidbody.angularVelocity - _previousAngularVelocity;
			float force = magnitude + ((Vector3)(ref val)).magnitude;
			OnCrash(force, ((ContactPoint)(ref other.contacts[0])).point);
			float magnitude2 = ((Vector3)(ref _previousVelocity)).magnitude;
			BreakableObject component = other.gameObject.GetComponent<BreakableObject>();
			if ((Object)(object)component != (Object)null && magnitude2 >= 5f)
			{
				Rigidbody.velocity = _previousVelocity;
				Rigidbody.angularVelocity = _previousAngularVelocity;
				component.Break(false);
				return;
			}
			if (other.gameObject.layer == 17)
			{
				BasicCop componentInParent = other.gameObject.GetComponentInParent<BasicCop>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					Rigidbody.velocity = _previousVelocity;
					Rigidbody.angularVelocity = _previousAngularVelocity;
					if (magnitude2 >= 5f && (int)componentInParent.hitBoxResponse.State == 0)
					{
						val = ((Component)componentInParent).transform.position - ((Component)this).transform.position;
						Vector3 normalized = ((Vector3)(ref val)).normalized;
						componentInParent.hitBoxResponse.ManualDamage((HitType)5, normalized, magnitude2 * 0.1f, 1f, 2f, 2);
						TimedCollisionIgnore.Create(other.collider, Chassis.GetComponentInChildren<Collider>(), 1.5f);
					}
					return;
				}
			}
			if (other.gameObject.layer != 21)
			{
				return;
			}
			JunkHolder componentInParent2 = other.gameObject.GetComponentInParent<JunkHolder>();
			if ((Object)(object)componentInParent2 != (Object)null)
			{
				if (!componentInParent2.moved)
				{
					Rigidbody.velocity = _previousVelocity;
					Rigidbody.angularVelocity = _previousAngularVelocity;
				}
				componentInParent2.FallApart(((ContactPoint)(ref other.contacts[0])).point, false);
				return;
			}
			Junk component2 = other.gameObject.GetComponent<Junk>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				if (component2.rigidBody.isKinematic)
				{
					Rigidbody.velocity = _previousVelocity;
					Rigidbody.angularVelocity = _previousAngularVelocity;
				}
				if ((int)component2.interactOn == 0)
				{
					component2.FallApart(false);
				}
				else
				{
					component2.FallApart(true);
				}
			}
		}

		private void OnTriggerStay(Collider other)
		{
			if (((Component)other).gameObject.layer == 19)
			{
				Teleport componentInParent = ((Component)other).GetComponentInParent<Teleport>();
				if ((Object)(object)componentInParent != (Object)null && InputEnabled && InCar)
				{
					((MonoBehaviour)this).StartCoroutine(DoTeleport(componentInParent));
				}
			}
			else if (((Component)other).CompareTag("MovingObject"))
			{
				((Component)other).GetComponentInParent<MoveAlongPoints>().TriggerDetectLayer(9);
			}
		}

		public void PlaceAt(Vector3 position, Quaternion rotation, bool keepSpeed = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Dot(((Component)this).transform.right, Rigidbody.velocity);
			float num2 = Vector3.Dot(((Component)this).transform.up, Rigidbody.velocity);
			float num3 = Vector3.Dot(((Component)this).transform.forward, Rigidbody.velocity);
			float num4 = Vector3.Dot(((Component)this).transform.right, Rigidbody.angularVelocity);
			float num5 = Vector3.Dot(((Component)this).transform.up, Rigidbody.angularVelocity);
			float num6 = Vector3.Dot(((Component)this).transform.forward, Rigidbody.angularVelocity);
			((Component)this).transform.position = position;
			((Component)this).transform.rotation = rotation;
			if (!keepSpeed)
			{
				Rigidbody.velocity = Vector3.zero;
				Rigidbody.angularVelocity = Vector3.zero;
			}
			else
			{
				Rigidbody.velocity = num * ((Component)this).transform.right + num2 * ((Component)this).transform.up + num3 * ((Component)this).transform.forward;
				Rigidbody.angularVelocity = num4 * ((Component)this).transform.right + num5 * ((Component)this).transform.up + num6 * ((Component)this).transform.forward;
			}
		}

		private void ResetInputs()
		{
			ThrottleAxis = 0f;
			SteerAxis = 0f;
			HornHeld = false;
			GetOutOfCarButtonNew = false;
			PitchAxis = 0f;
			YawAxis = 0f;
			RollAxis = 0f;
			BrakeHeld = false;
			LockDoorsButtonNew = false;
		}

		private IEnumerator DoTeleport(Teleport teleport)
		{
			if ((Object)(object)((Component)teleport).GetComponent<StageTransition>() == (Object)null)
			{
				DoForcedPause();
				InputEnabled = false;
				if (teleport.automaticallyReturnPlayerToLastSafeLocation)
				{
					teleport.fadeToBlackDuration = teleport.fadeToBlackDurationDeathzone;
					teleport.blackDuration = teleport.blackDurationDeathzone;
					teleport.fadeOpenDuration = teleport.fadeOpenDurationDeathzone;
				}
				else
				{
					teleport.fadeToBlackDuration = teleport.fadeToBlackDurationDoor;
					teleport.blackDuration = teleport.blackDurationDoor;
					teleport.fadeOpenDuration = teleport.fadeOpenDurationDoor;
				}
				Tween val = Core.Instance.UIManager.effects.FadeToBlack(teleport.fadeToBlackDuration);
				yield return TweenExtensions.WaitForCompletion(val);
				((Component)Core.Instance.UIManager.effects.fullScreenFade).gameObject.SetActive(true);
				((Graphic)Core.Instance.UIManager.effects.fullScreenFade).color = EffectsUI.niceBlack;
				yield return (object)new WaitForSeconds(teleport.blackDuration);
				UndoForcedPause();
				if (teleport.automaticallyReturnPlayerToLastSafeLocation)
				{
					PlaceAtLastSafeLocation();
				}
				else if ((Object)(object)teleport.teleportTo != (Object)null)
				{
					PlaceAt(teleport.teleportTo.position, teleport.teleportTo.rotation, teleport.giveSpeedAtSpawn);
				}
				InputEnabled = true;
				Core.Instance.UIManager.effects.FadeOpen(teleport.fadeOpenDuration);
			}
		}

		protected float GetAxisDeadZone(GameInput gameInput, int actionId, float deadzone)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			ControllerType currentControllerType = gameInput.GetCurrentControllerType(0);
			float axis = gameInput.GetAxis(actionId, 0);
			if ((int)currentControllerType != 2)
			{
				return axis;
			}
			if (Mathf.Abs(axis) <= deadzone)
			{
				return 0f;
			}
			return axis;
		}

		protected virtual void PollDrivingInputs()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Invalid comparison between Unknown and I4
			GameInput gameInput = Core.Instance.GameInput;
			BrakeHeld = gameInput.GetButtonHeld(7, 0);
			SteerAxis = gameInput.GetAxis(5, 0);
			if (BrakeHeld)
			{
				RollAxis = GetAxisDeadZone(gameInput, 5, 0.2f);
			}
			else
			{
				YawAxis = GetAxisDeadZone(gameInput, 5, 0.2f);
			}
			if ((int)gameInput.GetCurrentControllerType(0) == 2)
			{
				PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f);
				ThrottleAxis += gameInput.GetAxis(8, 0);
				ThrottleAxis -= gameInput.GetAxis(18, 0);
			}
			else
			{
				ThrottleAxis = gameInput.GetAxis(6, 0);
				if (BrakeHeld)
				{
					PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f);
				}
			}
			HornHeld = gameInput.GetButtonHeld(10, 0);
		}

		private void PollInputs()
		{
			ResetInputs();
			if (!InputEnabled)
			{
				return;
			}
			OnHandleInput?.Invoke();
			if (!WorldHandler.instance.GetCurrentPlayer().IsBusyWithSequence() || !InCar)
			{
				GameInput gameInput = Core.Instance.GameInput;
				if (InCar)
				{
					GetOutOfCarButtonNew = gameInput.GetButtonNew(11, 0);
				}
				if (Driving)
				{
					PollDrivingInputs();
				}
			}
		}

		protected virtual void Awake()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			Chassis = ((Component)this).gameObject;
			_passengerSeats = Chassis.GetComponentsInChildren<CarPassengerSeat>();
			DriverSeat = Chassis.GetComponentInChildren<CarDriverSeat>();
			_scrapeAudio = Chassis.GetComponentInChildren<ScrapeAudio>();
			_oneShotAudioSource = Chassis.GetComponentInChildren<OneShotAudioSource>();
			Rigidbody = Chassis.GetComponent<Rigidbody>();
			Wheels = Chassis.GetComponentsInChildren<CarWheel>();
			if ((Object)(object)CenterOfMass != (Object)null)
			{
				Rigidbody.centerOfMass = CenterOfMass.localPosition;
			}
			CarWheel[] wheels = Wheels;
			for (int i = 0; i < wheels.Length; i++)
			{
				wheels[i].Initialize(this);
			}
			ResetLastSafeLocation();
			FixUp();
			Core.OnCoreUpdatePaused += new OnCoreUpdateHandler(OnPause);
			Core.OnCoreUpdateUnPaused += new OnCoreUpdateUnpausedHandler(OnUnPause);
			bool continuousCollisionDetection = CarController.Config.ContinuousCollisionDetection;
			Rigidbody.collisionDetectionMode = (CollisionDetectionMode)(continuousCollisionDetection ? 1 : 0);
			Rigidbody.interpolation = (RigidbodyInterpolation)1;
		}

		public CarPassengerSeat GetPassengerSeat(int index)
		{
			CarPassengerSeat[] passengerSeats = _passengerSeats;
			foreach (CarPassengerSeat carPassengerSeat in passengerSeats)
			{
				if (carPassengerSeat.SeatIndex == index)
				{
					return carPassengerSeat;
				}
			}
			return null;
		}

		public void EnterCar(Player player)
		{
			if (!((Object)(object)DriverSeat == (Object)null))
			{
				DriverSeat.PutInSeat(player);
			}
		}

		public void ExitCar()
		{
			if (!((Object)(object)DriverSeat == (Object)null))
			{
				DriverSeat.ExitSeat();
			}
		}

		private void DoForcedPause()
		{
			OnPause();
			_forcedPause = true;
		}

		private void UndoForcedPause()
		{
			_forcedPause = false;
			OnUnPause();
		}

		private void OnPause()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (!_forcedPause && !((Object)(object)Rigidbody == (Object)null))
			{
				_velocityBeforePause = Rigidbody.velocity;
				_angularVelocityBeforePause = Rigidbody.angularVelocity;
				Rigidbody.isKinematic = true;
			}
		}

		private void OnUnPause()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (!_forcedPause && !((Object)(object)Rigidbody == (Object)null))
			{
				Rigidbody.isKinematic = false;
				Rigidbody.velocity = _velocityBeforePause;
				Rigidbody.angularVelocity = _angularVelocityBeforePause;
			}
		}

		protected virtual bool CheckGrounded()
		{
			CarWheel[] wheels = Wheels;
			for (int i = 0; i < wheels.Length; i++)
			{
				if (!wheels[i].Grounded)
				{
					return false;
				}
			}
			return true;
		}

		protected virtual void FixedUpdateCar()
		{
		}

		private void FixedUpdate()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (Core.Instance.IsCorePaused)
			{
				return;
			}
			AllWheelsOffGround = true;
			_resting = true;
			_grounded = false;
			_steep = false;
			PollInputs();
			if (LockDoorsButtonNew)
			{
				PlayerData.Instance.DoorsLocked = !PlayerData.Instance.DoorsLocked;
				PlayerData.Instance.Save();
				Core.Instance.UIManager.ShowNotification("Car doors are now <color=yellow>" + (PlayerData.Instance.DoorsLocked ? "Locked" : "Unlocked") + "</color>", Array.Empty<string>());
			}
			UpdateCounterSteer();
			CarWheel[] wheels = Wheels;
			foreach (CarWheel obj in wheels)
			{
				obj.DoPhysics(ref _resting);
				if (obj.Grounded)
				{
					AllWheelsOffGround = false;
				}
			}
			_previousAngularVelocity = Rigidbody.angularVelocity;
			_previousVelocity = Rigidbody.velocity;
			_grounded = CheckGrounded();
			if (Vector3.Angle(Vector3.up, ((Component)this).transform.up) >= 50f)
			{
				_steep = true;
			}
			_lastSafeLocationTimer = Mathf.Max(0f, _lastSafeLocationTimer - Time.deltaTime);
			if (_grounded && !_steep && _lastSafeLocationTimer <= 0f)
			{
				RecordLastSafeLocation();
			}
			if (!_grounded)
			{
				AirControl(1f);
				UpdateAirAero();
			}
			UpdateStill();
			UpdateDrift();
			UpdateAutoRecovery();
			FixedUpdateCar();
			if (GetOutOfCarButtonNew && InCar)
			{
				CarController.Instance.ExitCar();
			}
		}

		private void AirControl(float multiplier)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			float num = AirControlStrength * multiplier;
			Vector3 val = ((Component)this).transform.right * (num * PitchAxis);
			Vector3 val2 = ((Component)this).transform.up * (num * YawAxis);
			Vector3 val3 = -((Component)this).transform.forward * (num * RollAxis);
			float num2 = Vector3.Dot(((Component)this).transform.right, Rigidbody.angularVelocity);
			float num3 = Vector3.Dot(((Component)this).transform.up, Rigidbody.angularVelocity);
			float num4 = Vector3.Dot(-((Component)this).transform.forward, Rigidbody.angularVelocity);
			if (num2 >= AirControlTopSpeed && PitchAxis > 0f)
			{
				val = Vector3.zero;
			}
			if (num2 <= 0f - AirControlTopSpeed && PitchAxis < 0f)
			{
				val = Vector3.zero;
			}
			if (num3 >= AirControlTopSpeed && YawAxis > 0f)
			{
				val2 = Vector3.zero;
			}
			if (num3 <= 0f - AirControlTopSpeed && YawAxis < 0f)
			{
				val2 = Vector3.zero;
			}
			if (num4 >= AirControlTopSpeed && RollAxis > 0f)
			{
				val3 = Vector3.zero;
			}
			if (num4 <= 0f - AirControlTopSpeed && RollAxis < 0f)
			{
				val3 = Vector3.zero;
			}
			Rigidbody.AddTorque(val, (ForceMode)5);
			Rigidbody.AddTorque(val2, (ForceMode)5);
			Rigidbody.AddTorque(val3, (ForceMode)5);
			Rigidbody.angularVelocity = Vector3.Lerp(Rigidbody.angularVelocity, Vector3.zero, AirDeacceleration * Time.deltaTime);
		}

		private void Update()
		{
			if (!Core.Instance.IsCorePaused)
			{
				if (Driving)
				{
					DoorsLocked = PlayerData.Instance.DoorsLocked;
				}
				_crashAudioCooldown = Mathf.Max(0f, _crashAudioCooldown - Time.deltaTime);
				CarWheel[] wheels = Wheels;
				for (int i = 0; i < wheels.Length; i++)
				{
					wheels[i].DoUpdate();
				}
			}
		}

		private void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Core.OnCoreUpdatePaused -= new OnCoreUpdateHandler(OnPause);
			Core.OnCoreUpdateUnPaused -= new OnCoreUpdateUnpausedHandler(OnUnPause);
			CarController instance = CarController.Instance;
			if (!((Object)(object)instance == (Object)null) && (Object)(object)instance.CurrentCar == (Object)(object)this)
			{
				CarController.Instance.ExitCar();
			}
		}
	}
	public class DrivableChopper : DrivableCar
	{
		private const int LandingLayerMask = 1;

		private const float LandingRayDistance = 0.1f;

		private const float NoseDownMultiplier = 1.5f;

		[Header("Helicopter")]
		public Transform[] LandingSensors;

		public float ThrottleSpeed = 1f;

		public float LiftAcceleration = 10f;

		public float LiftLerp = 5f;

		public float UprightForce = 1f;

		public float MovementAcceleration = 10f;

		public float IdleAcceleration = 1f;

		public float AirVerticalFriction = 1f;

		[NonSerialized]
		public float ThrottleAmount;

		[NonSerialized]
		public float LiftAmount;

		protected override void Awake()
		{
			base.Awake();
			AllowAutoRecovery = false;
		}

		protected override void PollDrivingInputs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			GameInput gameInput = Core.Instance.GameInput;
			ControllerType currentControllerType = gameInput.GetCurrentControllerType(0);
			ChopperControlTypes chopperControlType = CarController.Config.ChopperControlType;
			if ((int)currentControllerType == 2)
			{
				PitchAxis = GetAxisDeadZone(gameInput, 6, 0.2f);
				ThrottleAxis += gameInput.GetAxis(8, 0);
				ThrottleAxis -= gameInput.GetAxis(18, 0);
				if (chopperControlType == ChopperControlTypes.A)
				{
					YawAxis += (gameInput.GetButtonHeld(65, 0) ? 1f : 0f);
					YawAxis -= (gameInput.GetButtonHeld(15, 0) ? 1f : 0f);
					RollAxis = GetAxisDeadZone(gameInput, 5, 0.2f);
				}
				else
				{
					RollAxis += (gameInput.GetButtonHeld(65, 0) ? 1f : 0f);
					RollAxis -= (gameInput.GetButtonHeld(15, 0) ? 1f : 0f);
					YawAxis = GetAxisDeadZone(gameInput, 5, 0.2f);
				}
			}
			else
			{
				YawAxis = gameInput.GetAxis(5, 0);
				ThrottleAxis = gameInput.GetAxis(6, 0);
				RollAxis += (gameInput.GetButtonHeld(29, 0) ? 1f : 0f);
				RollAxis -= (gameInput.GetButtonHeld(57, 0) ? 1f : 0f);
				PitchAxis += (gameInput.GetButtonHeld(21, 0) ? 1f : 0f);
				PitchAxis -= (gameInput.GetButtonHeld(56, 0) ? 1f : 0f);
			}
		}

		protected override bool CheckGrounded()
		{
			Transform[] landingSensors = LandingSensors;
			foreach (Transform sensor in landingSensors)
			{
				if (!CheckSensorGrounded(sensor))
				{
					return false;
				}
			}
			return true;
		}

		protected override void FixedUpdateCar()
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdateCar();
			float num = ThrottleAxis;
			if (num > 0f)
			{
				num = 1f;
			}
			if (num < 0f)
			{
				num = -1f;
			}
			if (!base.Grounded)
			{
				num = Mathf.Max(0f, num);
			}
			if (ThrottleAmount != 0f && ThrottleAmount != 1f && ThrottleAxis == 0f)
			{
				num = -1f;
			}
			if (ThrottleAmount >= 0.5f && base.Grounded && ThrottleAxis == 0f)
			{
				num = 0f;
				if (0.9f > ThrottleAmount)
				{
					num = 1f;
				}
				if (ThrottleAmount > 0.99f)
				{
					ThrottleAmount = 0.99f;
				}
			}
			ThrottleAmount += num * ThrottleSpeed * Time.deltaTime;
			ThrottleAmount = Mathf.Clamp(ThrottleAmount, 0f, 1f);
			if (base.Grounded)
			{
				LiftAmount = 0f;
			}
			else
			{
				LiftAmount = Mathf.Lerp(LiftAmount, ThrottleAxis, LiftLerp * Time.deltaTime);
			}
			float num2 = LiftAcceleration * ThrottleAmount;
			if (base.Grounded && ThrottleAmount < 1f)
			{
				num2 = 0f;
			}
			float num3 = (0f - Mathf.Abs(Vector3.Dot(((Component)this).transform.up, Vector3.up)) + 1f) * 1.5f;
			num3 = Mathf.Min(1f, num3);
			num3 *= Mathf.Min(0f, ThrottleAxis) + 1f;
			if (!base.Grounded)
			{
				num2 = LiftAmount * LiftAcceleration * (0f - num3 + 1f);
			}
			Rigidbody.AddForce(Vector3.up * num2, (ForceMode)5);
			if (ThrottleAmount >= 1f)
			{
				Rigidbody.useGravity = false;
			}
			else
			{
				Rigidbody.useGravity = true;
			}
			if (!base.Grounded && ThrottleAmount >= 1f)
			{
				float num4 = Vector3.SignedAngle(((Component)this).transform.up, Vector3.up, ((Component)this).transform.forward);
				Rigidbody.AddTorque(num4 * ((Component)this).transform.forward * UprightForce, (ForceMode)5);
				float num5 = Vector3.SignedAngle(((Component)this).transform.up, Vector3.up, ((Component)this).transform.right);
				Rigidbody.AddTorque(num5 * ((Component)this).transform.right * UprightForce, (ForceMode)5);
				Vector3 val = Rigidbody.velocity - Vector3.Project(Rigidbody.velocity, Vector3.up);
				Rigidbody.velocity = Vector3.Lerp(Rigidbody.velocity, val, AirVerticalFriction * num3 * Time.deltaTime);
				Vector3 val2 = new Vector3(((Component)this).transform.up.x, 0f, ((Component)this).transform.up.z);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				Rigidbody.AddForce(normalized * (MovementAcceleration * Mathf.Max(0f, ThrottleAxis)) * num3, (ForceMode)5);
				Rigidbody.AddForce(normalized * IdleAcceleration * num3, (ForceMode)5);
			}
		}

		private bool CheckSensorGrounded(Transform sensor)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return Physics.Raycast(new Ray(sensor.position, Vector3.down), 0.1f, 1);
		}
	}
	[RequireComponent(typeof(AudioSource))]
	public class EngineAudio : MonoBehaviour
	{
		public float MinimumSpeed;

		public float PitchLerp = 5f;

		public AnimationCurve PitchCurve;

		public float PitchCurveMax = 100f;

		public float AddPitch = 1f;

		private DrivableCar _car;

		private AudioSource _audioSource;

		private float _currentPitch = 1f;

		private void Awake()
		{
			_car = ((Component)this).GetComponentInParent<DrivableCar>();
			_audioSource = ((Component)this).GetComponent<AudioSource>();
		}

		private float EvaluatePitchCurve(float value)
		{
			float num = Mathf.Min(PitchCurveMax, Mathf.Abs(value)) / PitchCurveMax;
			return PitchCurve.Evaluate(num);
		}

		private void Update()
		{
			if (Core.Instance.IsCorePaused)
			{
				return;
			}
			float num = 1f;
			float num2 = 0f;
			CarWheel[] wheels = _car.Wheels;
			foreach (CarWheel carWheel in wheels)
			{
				if (carWheel.Throttle)
				{
					float num3 = Mathf.Abs(carWheel.CurrentSpeed);
					if (num3 > num2)
					{
						num2 = num3;
					}
				}
			}
			float volume = 1f;
			if (MinimumSpeed > 0f)
			{
				volume = Mathf.Min(MinimumSpeed, num2) / MinimumSpeed;
			}
			float num4 = EvaluatePitchCurve(num2) * AddPitch;
			num += num4;
			_currentPitch = Mathf.Lerp(_currentPitch, num, PitchLerp * Time.deltaTime);
			_audioSource.pitch = _currentPitch;
			_audioSource.volume = volume;
		}
	}
	[RequireComponent(typeof(AudioSource))]
	public class EngineRestingAudio : MonoBehaviour
	{
		public float MaximumSpeed = 1f;

		private DrivableCar _car;

		private AudioSource _audioSource;

		private void Awake()
		{
			_car = ((Component)this).GetComponentInParent<DrivableCar>();
			_audioSource = ((Component)this).GetComponent<AudioSource>();
		}

		private void Update()
		{
			if (Core.Instance.IsCorePaused)
			{
				return;
			}
			float num = 0f;
			CarWheel[] wheels = _car.Wheels;
			foreach (CarWheel carWheel in wheels)
			{
				if (carWheel.Throttle)
				{
					float num2 = Mathf.Abs(carWheel.CurrentSpeed);
					if (num2 > num)
					{
						num = num2;
					}
				}
			}
			float volume = 0f;
			if (MaximumSpeed > 0f)
			{
				volume = 0f - Mathf.Min(MaximumSpeed, num) / MaximumSpeed + 1f;
			}
			_audioSource.volume = volume;
		}
	}
	[RequireComponent(typeof(AudioSource))]
	public class Horn : MonoBehaviour
	{
		public float LerpSpeed = 5f;

		private DrivableCar _car;

		private AudioSource _audioSource;

		private float _currentVolume;

		private void Awake()
		{
			_car = ((Component)this).GetComponentInParent<DrivableCar>();
			_audioSource = ((Component)this).GetComponent<AudioSource>();
		}

		private void Update()
		{
			if (!Core.Instance.IsCorePaused)
			{
				float num = 0f;
				if (_car.HornHeld)
				{
					num = 1f;
				}
				if (_currentVolume <= 0.1f)
				{
					_audioSource.Stop();
					_audioSource.Play();
				}
				_currentVolume = Mathf.Lerp(_currentVolume, num, LerpSpeed * Time.deltaTime);
				_audioSource.volume = _currentVolume;
			}
		}
	}
	public enum ChopperControlTypes
	{
		A,
		B
	}
	public interface ICarConfig
	{
		bool SlopCrewIntegration { get; set; }

		bool ContinuousCollisionDetection { get; set; }

		bool DeveloperMode { get; set; }

		KeyCode ReloadBundlesKey { get; set; }

		ChopperControlTypes ChopperControlType { get; set; }
	}
	public class OneShotAudioSource : MonoBehaviour
	{
		private AudioSource[] _pooledAudioSources;

		private void Awake()
		{
			_pooledAudioSources = ((Component)this).GetComponentsInChildren<AudioSource>();
		}

		private AudioSource GetPooledAudioSource()
		{
			AudioSource[] pooledAudioSources = _pooledAudioSources;
			foreach (AudioSource val in pooledAudioSources)
			{
				if (!val.isPlaying)
				{
					return val;
				}
			}
			return _pooledAudioSources[0];
		}

		public void Play(AudioClip clip)
		{
			AudioSource pooledAudioSource = GetPooledAudioSource();
			pooledAudioSource.Stop();
			pooledAudioSource.clip = clip;
			pooledAudioSource.Play();
		}
	}
	public class PassengerSeatInteractable : CustomInteractable
	{
		private CarPassengerSeat _seat;

		public void Initialize(CarPassengerSeat seat)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			_seat = seat;
			base.Icon = (InteractableIcon)0;
		}

		public override bool Test(Player player)
		{
			if ((Object)(object)_seat.Player == (Object)null)
			{
				return !_seat.Car.DoorsLocked;
			}
			return false;
		}

		public override void Interact(Player player)
		{
			CarController.Instance.EnterCarAsPassenger(_seat.Car

CarJack.Plugin.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using CarJack.Common;
using CarJack.Common.WhipRemix;
using CommonAPI;
using CommonAPI.Phone;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using Reptile.Phone;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("CarJack.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("CarJack Plugin")]
[assembly: AssemblyFileVersion("1.7.5.0")]
[assembly: AssemblyInformationalVersion("1.7.5+a78143e9a8a145d78869252df6b5998f040a6bc5")]
[assembly: AssemblyProduct("CarJack.Plugin")]
[assembly: AssemblyTitle("CarJack.Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.5.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 CarJack.Plugin
{
	public class CarDebugController : MonoBehaviour
	{
		public static CarDebugController Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			GameObject val = new GameObject("Car Debug Controller");
			Object.DontDestroyOnLoad((Object)val);
			return val.AddComponent<CarDebugController>();
		}

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(CarController.Config.ReloadBundlesKey))
			{
				Core.Instance.BaseModule.StageManager.ExitCurrentStage(Utility.GetCurrentStage(), (Stage)(-1));
				CarAssets.Instance.UnloadAllBundles();
				CarAssets.Instance.LoadBundles();
				CarDatabase.Initialize();
				RecolorManager.UnloadRecolors();
				RecolorManager.LoadRecolors();
			}
		}
	}
	public class CarJackApp : CustomApp
	{
		private static Sprite Icon;

		private SimplePhoneButton _doorButton;

		private SimplePhoneButton _muteButton;

		private SimplePhoneButton _autoRecoverButton;

		private SimplePhoneButton _whipRemixButton;

		public static void Initialize(string location)
		{
			Icon = TextureUtility.LoadSprite(Path.Combine(location, "Phone-App-Icon.png"));
			PhoneAPI.RegisterApp<CarJackApp>("carjack", Icon);
			PhoneAPI.RegisterApp<SpawnCarApp>("spawn car", Icon);
			PhoneAPI.RegisterApp<SpawnCarByBundleApp>("choose bundle", Icon);
			PhoneAPI.RegisterApp<RecolorApp>("whipremix", Icon);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("CarJack", Icon, 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Spawn Car");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				CarController instance = CarController.Instance;
				if ((Object)(object)instance != (Object)null)
				{
					DrivableCar currentCar = instance.CurrentCar;
					if ((Object)(object)currentCar != (Object)null && !currentCar.Driving)
					{
						return;
					}
				}
				if (CarAssets.Instance.Bundles.Count == 1)
				{
					((App)this).MyPhone.GetAppInstance<SpawnCarApp>().SetBundleFilter();
					((App)this).MyPhone.OpenApp(typeof(SpawnCarApp));
				}
				else
				{
					((App)this).MyPhone.OpenApp(typeof(SpawnCarByBundleApp));
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			_doorButton = PhoneUIUtility.CreateSimpleButton("Doors: Unlocked");
			SimplePhoneButton doorButton = _doorButton;
			((PhoneButton)doorButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)doorButton).OnConfirm, (Action)delegate
			{
				ToggleDoorsLocked();
			});
			base.ScrollView.AddButton((PhoneButton)(object)_doorButton);
			_muteButton = PhoneUIUtility.CreateSimpleButton("Mute Players: OFF");
			SimplePhoneButton muteButton = _muteButton;
			((PhoneButton)muteButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)muteButton).OnConfirm, (Action)delegate
			{
				ToggleMutePlayers();
			});
			base.ScrollView.AddButton((PhoneButton)(object)_muteButton);
			_autoRecoverButton = PhoneUIUtility.CreateSimpleButton("Auto-Recovery: ON");
			SimplePhoneButton autoRecoverButton = _autoRecoverButton;
			((PhoneButton)autoRecoverButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)autoRecoverButton).OnConfirm, (Action)delegate
			{
				ToggleAutoRecover();
			});
			base.ScrollView.AddButton((PhoneButton)(object)_autoRecoverButton);
		}

		private void UpdateWhipRemix()
		{
			if (RecolorApp.AvailableForCurrentCar() && (Object)(object)_whipRemixButton == (Object)null)
			{
				CreateWhipRemixButton();
			}
			else if (!RecolorApp.AvailableForCurrentCar() && (Object)(object)_whipRemixButton != (Object)null)
			{
				base.ScrollView.RemoveButton((PhoneButton)(object)_whipRemixButton);
				_whipRemixButton = null;
			}
		}

		private void CreateWhipRemixButton()
		{
			_whipRemixButton = PhoneUIUtility.CreateSimpleButton("WhipRemix");
			SimplePhoneButton whipRemixButton = _whipRemixButton;
			((PhoneButton)whipRemixButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)whipRemixButton).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.OpenApp(typeof(RecolorApp));
			});
			base.ScrollView.AddButton((PhoneButton)(object)_whipRemixButton);
		}

		public override void OnAppUpdate()
		{
			((App)this).OnAppUpdate();
			UpdateDoorsLockedLabel();
			UpdateMutePlayersLabel();
			UpdateAutoRecoverLabel();
			UpdateWhipRemix();
		}

		private void ToggleAutoRecover()
		{
			PlayerData.Instance.AutoRecover = !PlayerData.Instance.AutoRecover;
			UpdateAutoRecoverLabel();
			PlayerData.Instance.Save();
		}

		private void ToggleDoorsLocked()
		{
			PlayerData.Instance.DoorsLocked = !PlayerData.Instance.DoorsLocked;
			UpdateDoorsLockedLabel();
			PlayerData.Instance.Save();
		}

		private void ToggleMutePlayers()
		{
			PlayerData.Instance.MutePlayers = !PlayerData.Instance.MutePlayers;
			UpdateMutePlayersLabel();
			PlayerData.Instance.Save();
		}

		private void UpdateAutoRecoverLabel()
		{
			((TMP_Text)_autoRecoverButton.Label).text = "Auto-Recovery: " + (PlayerData.Instance.AutoRecover ? "ON" : "OFF");
		}

		private void UpdateMutePlayersLabel()
		{
			((TMP_Text)_muteButton.Label).text = "Mute Players: " + (PlayerData.Instance.MutePlayers ? "ON" : "OFF");
		}

		private void UpdateDoorsLockedLabel()
		{
			((TMP_Text)_doorButton.Label).text = "Doors: " + (PlayerData.Instance.DoorsLocked ? "Locked" : "Unlocked");
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public class CarJackPluginAttribute : Attribute
	{
	}
	[BepInPlugin("CarJack.Plugin", "CarJack.Plugin", "1.7.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private static Type ForceLoadCarJackCommonAssembly = typeof(DrivableCar);

		private void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack.Plugin 1.7.5");
			try
			{
				new Harmony("CarJack.Plugin").PatchAll();
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
				new CarAssets
				{
					MainBundlePath = Path.Combine(directoryName, "carjack"),
					AddonBundlePath = Paths.PluginPath,
					PluginDirectoryName = Path.GetFileName(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location))
				}.LoadBundles();
				new RecolorSaveData();
				RecolorManager.Initialize(Paths.PluginPath);
				RecolorManager.LoadRecolors();
				RecolorApp.Initialize();
				CarController.Initialize((ICarConfig)(object)new PluginCarConfig(((BaseUnityPlugin)this).Config));
				if (CarController.Config.DeveloperMode)
				{
					CarDebugController.Create();
				}
				CarDatabase.Initialize();
				CarJackApp.Initialize(directoryName);
				LoadCompatibilityPlugins();
				new PlayerData().LoadOrCreate();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CarJack.Plugin 1.7.5!");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)string.Format("Failed to load {0} {1}!{2}{3}", "CarJack.Plugin", "1.7.5", Environment.NewLine, ex));
			}
		}

		private void LoadCompatibilityPlugins()
		{
			if (Chainloader.PluginInfos.ContainsKey("SlopCrew.Plugin"))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack SlopCrew Plugin!");
				try
				{
					string assemblyPath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "CarJack.SlopCrew.dll");
					LoadPlugin(assemblyPath);
				}
				catch (Exception arg)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load CarJack SlopCrew Plugin!{Environment.NewLine}{arg}");
				}
			}
			if (Chainloader.PluginInfos.ContainsKey("BombRushCamera"))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading CarJack BombRushCamera Plugin!");
				try
				{
					string assemblyPath2 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "CarJack.BombRushCamera.dll");
					LoadPlugin(assemblyPath2);
				}
				catch (Exception arg2)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load CarJack BombRushCamera Plugin!{Environment.NewLine}{arg2}");
				}
			}
		}

		private void LoadPlugin(string assemblyPath)
		{
			Type[] types = Assembly.LoadFrom(assemblyPath).GetTypes();
			foreach (Type type in types)
			{
				if (type.GetCustomAttribute<CarJackPluginAttribute>() != null)
				{
					Activator.CreateInstance(type);
				}
			}
		}
	}
	public class PluginCarConfig : ICarConfig
	{
		private ConfigEntry<bool> _slopCrewIntegration;

		private ConfigEntry<bool> _continuousCollisionDetection;

		private ConfigEntry<bool> _developerMode;

		private ConfigEntry<KeyCode> _reloadBundlesKey;

		private ConfigEntry<ChopperControlTypes> _chopperControlType;

		public ChopperControlTypes ChopperControlType
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return _chopperControlType.Value;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				_chopperControlType.Value = value;
			}
		}

		public bool DeveloperMode
		{
			get
			{
				return _developerMode.Value;
			}
			set
			{
				_developerMode.Value = value;
			}
		}

		public KeyCode ReloadBundlesKey
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return _reloadBundlesKey.Value;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				_reloadBundlesKey.Value = value;
			}
		}

		public bool SlopCrewIntegration
		{
			get
			{
				return _slopCrewIntegration.Value;
			}
			set
			{
				_slopCrewIntegration.Value = value;
			}
		}

		public bool ContinuousCollisionDetection
		{
			get
			{
				return _continuousCollisionDetection.Value;
			}
			set
			{
				_continuousCollisionDetection.Value = value;
			}
		}

		public PluginCarConfig(ConfigFile configFile)
		{
			_continuousCollisionDetection = configFile.Bind<bool>("General", "ContinuousCollisionDetection", true, "Prevents cars from going through geometry at high speeds.");
			_slopCrewIntegration = configFile.Bind<bool>("General", "SlopCrewIntegration", true, "Synchronize cars in SlopCrew.");
			_developerMode = configFile.Bind<bool>("Development", "DeveloperMode", false, "Enables development features.");
			_reloadBundlesKey = configFile.Bind<KeyCode>("Development", "ReloadBundlesKey", (KeyCode)289, "Key to reload all bundles when in developer mode.");
			_chopperControlType = configFile.Bind<ChopperControlTypes>("Controls", "ChopperControlType", (ChopperControlTypes)0, "Control type for helicopters on controller.\r\nA: Left Stick to adjust pitch/roll, face buttons to adjust yaw.\r\nB: Left Stick to adjust pitch/yaw, face buttons to adjust roll.");
		}
	}
	public class RecolorApp : CustomApp
	{
		private const string NewRecolorFolder = "WhipRemix";

		public override bool Available => false;

		public static void Initialize()
		{
			CarController.OnPlayerEnteredCar = (Action)Delegate.Combine(CarController.OnPlayerEnteredCar, new Action(OnEnterCar));
		}

		private static void OnEnterCar()
		{
			Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
			if ((Object)(object)currentPlayer == (Object)null)
			{
				return;
			}
			Phone phone = currentPlayer.phone;
			if (!((Object)(object)phone == (Object)null))
			{
				RecolorApp appInstance = phone.GetAppInstance<RecolorApp>();
				if (!((Object)(object)appInstance == (Object)null))
				{
					appInstance.SetForCurrentCar();
				}
			}
		}

		public static bool AvailableForCurrentCar()
		{
			CarController instance = CarController.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			DrivableCar currentCar = instance.CurrentCar;
			if ((Object)(object)currentCar == (Object)null)
			{
				return false;
			}
			if (!currentCar.Driving)
			{
				return false;
			}
			if ((Object)(object)((Component)currentCar).GetComponent<RecolorableCar>() == (Object)null)
			{
				return false;
			}
			return true;
		}

		public void SetForCurrentCar()
		{
			base.ScrollView.RemoveAllButtons();
			base.ScrollView.ResetScroll();
			base.ScrollView.CancelAnimation();
			CarController instance = CarController.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			DrivableCar car = instance.CurrentCar;
			if ((Object)(object)car == (Object)null)
			{
				return;
			}
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Stock");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				((Component)car).GetComponent<RecolorableCar>().ApplyDefaultColor();
				RecolorSaveData.Instance.SetRecolorForCar(car.InternalName, (string)null);
				Core.Instance.SaveManager.SaveCurrentSaveSlot();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			foreach (KeyValuePair<string, Recolor> recolor in RecolorManager.RecolorsByGUID)
			{
				if (!(recolor.Value.Properties.CarInternalName != car.InternalName))
				{
					SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(recolor.Value.Properties.RecolorDisplayName);
					((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
					{
						((Component)car).GetComponent<RecolorableCar>().ApplyRecolor(recolor.Value);
						RecolorSaveData.Instance.SetRecolorForCar(car.InternalName, recolor.Value.Properties.RecolorGUID);
						Core.Instance.SaveManager.SaveCurrentSaveSlot();
					});
					base.ScrollView.AddButton((PhoneButton)(object)val2);
				}
			}
			SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Create New Recolor");
			((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				CarController instance2 = CarController.Instance;
				Recolor val4 = new Recolor();
				val4.CreateDefault(((Component)instance2.CurrentCar).GetComponent<RecolorableCar>());
				string text = Path.Combine(RecolorManager.RecolorFolder, "WhipRemix");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
				}
				string name = ((Object)CarDatabase.CarByInternalName[car.InternalName].Prefab).name;
				string uniquePath = GetUniquePath(Path.Combine(text, name + " Recolor.whipremix"));
				val4.Properties.RecolorDisplayName = Path.GetFileNameWithoutExtension(uniquePath);
				val4.Save(uniquePath);
				Core.Instance.UIManager.ShowNotification("New recolor ZIP saved to <color=yellow>BepInEx/plugins/WhipRemix/" + val4.Properties.RecolorDisplayName + ".whipremix</color>", Array.Empty<string>());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val3);
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("WhipRemix", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
		}

		public override void OnAppUpdate()
		{
			((App)this).OnAppUpdate();
			if (!AvailableForCurrentCar())
			{
				((App)this).MyPhone.CloseCurrentApp();
			}
		}

		private string GetUniquePath(string path)
		{
			if (!File.Exists(path))
			{
				return path;
			}
			int i = 2;
			string extension = Path.GetExtension(path);
			string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path);
			string directoryName;
			for (directoryName = Path.GetDirectoryName(path); File.Exists(Path.Combine(directoryName, $"{fileNameWithoutExtension} {i}{extension}")); i++)
			{
			}
			return Path.Combine(directoryName, $"{fileNameWithoutExtension} {i}{extension}");
		}
	}
	public class SpawnCarApp : CustomApp
	{
		public override bool Available => false;

		public void SetBundleFilter(CarBundle bundle = null)
		{
			base.ScrollView.RemoveAllButtons();
			base.ScrollView.ResetScroll();
			base.ScrollView.CancelAnimation();
			foreach (KeyValuePair<string, CarEntry> item in CarDatabase.CarByInternalName)
			{
				if (bundle == null || item.Value.Bundle == bundle)
				{
					SimplePhoneButton val = CreateCarButton(item.Key);
					base.ScrollView.AddButton((PhoneButton)(object)val);
				}
			}
		}

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Spawn Car", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
		}

		public override void OnAppUpdate()
		{
			((App)this).OnAppUpdate();
			CarController instance = CarController.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				DrivableCar currentCar = instance.CurrentCar;
				if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving)
				{
					((App)this).MyPhone.CloseCurrentApp();
				}
			}
		}

		private SimplePhoneButton CreateCarButton(string carInternalName)
		{
			SimplePhoneButton obj = PhoneUIUtility.CreateSimpleButton(((Object)CarDatabase.CarByInternalName[carInternalName].Prefab).name);
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				CarController.Instance.ExitCar();
				((App)this).MyPhone.ReturnToHome();
				Player currentPlayer = WorldHandler.instance.GetCurrentPlayer();
				GameObject obj2 = Object.Instantiate<GameObject>(CarDatabase.CarByInternalName[carInternalName].Prefab);
				obj2.transform.position = ((Component)currentPlayer).transform.position;
				obj2.transform.rotation = ((Component)currentPlayer).transform.rotation;
				DrivableCar component = obj2.GetComponent<DrivableCar>();
				component.Initialize();
				component.DoorsLocked = PlayerData.Instance.DoorsLocked;
				RecolorableCar component2 = ((Component)component).GetComponent<RecolorableCar>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.ApplySavedRecolor();
				}
				CarController.Instance.EnterCar(component);
			});
			return obj;
		}
	}
	public class SpawnCarByBundleApp : CustomApp
	{
		public override bool Available => false;

		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateIconlessTitleBar("Choose Bundle", 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			base.ScrollView.RemoveAllButtons();
			base.ScrollView.ResetScroll();
			base.ScrollView.CancelAnimation();
			foreach (CarBundle bundle in CarAssets.Instance.Bundles)
			{
				SimplePhoneButton val = CreateBundleButton(bundle);
				base.ScrollView.AddButton((PhoneButton)(object)val);
			}
		}

		public override void OnAppUpdate()
		{
			((App)this).OnAppUpdate();
			CarController instance = CarController.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				DrivableCar currentCar = instance.CurrentCar;
				if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving)
				{
					((App)this).MyPhone.CloseCurrentApp();
				}
			}
		}

		private SimplePhoneButton CreateBundleButton(CarBundle bundle)
		{
			SimplePhoneButton obj = PhoneUIUtility.CreateSimpleButton(bundle.Name);
			((PhoneButton)obj).OnConfirm = (Action)Delegate.Combine(((PhoneButton)obj).OnConfirm, (Action)delegate
			{
				((App)this).MyPhone.GetAppInstance<SpawnCarApp>().SetBundleFilter(bundle);
				((App)this).MyPhone.OpenApp(typeof(SpawnCarApp));
			});
			return obj;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CarJack.Plugin";

		public const string PLUGIN_NAME = "CarJack.Plugin";

		public const string PLUGIN_VERSION = "1.7.5";
	}
}
namespace CarJack.Plugin.Patches
{
	[HarmonyPatch(typeof(AmbientTrigger))]
	internal static class AmbientTriggerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerEnter")]
		private static bool OnTriggerEnter(Collider trigger)
		{
			DrivableCar componentInParent = ((Component)trigger).GetComponentInParent<DrivableCar>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return true;
			}
			return componentInParent.InCar;
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerExit")]
		private static bool OnTriggerExit(Collider trigger)
		{
			DrivableCar componentInParent = ((Component)trigger).GetComponentInParent<DrivableCar>();
			if ((Object)(object)componentInParent == (Object)null)
			{
				return true;
			}
			return componentInParent.InCar;
		}
	}
	[HarmonyPatch(typeof(AppHomeScreen))]
	internal static class AppHomeScreenPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnPressRight")]
		private static bool OnPressRight_Prefix(AppHomeScreen __instance)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			if ((Object)(object)CarController.Instance == (Object)null)
			{
				return true;
			}
			if (!((Object)(object)CarController.Instance.CurrentCar != (Object)null))
			{
				return true;
			}
			PhoneScrollButton selectedButtton = ((PhoneScroll)__instance.m_ScrollView).SelectedButtton;
			if ((int)((HomescreenButton)((selectedButtton is HomescreenButton) ? selectedButtton : null)).AssignedApp.appType != 3)
			{
				return true;
			}
			((App)__instance).m_AudioManager.PlaySfxGameplay((SfxCollectionID)14, (AudioClipID)305, 0f);
			return false;
		}
	}
	[HarmonyPatch(typeof(BMXOnlyGateway))]
	internal static class BMXOnlyGatewayPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("OnTriggerStay")]
		private static bool OnTriggerStay(Collider other)
		{
			if ((Object)(object)((Component)other).GetComponentInParent<DrivableCar>() != (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(CharacterSelect))]
	internal static class CharacterSelectPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Init")]
		private static void Init_Prefix(Player p, CharacterSelect __instance)
		{
			if (!p.isAI)
			{
				CarController instance = CarController.Instance;
				if (!((Object)(object)instance.CurrentCar == (Object)null))
				{
					instance.ExitCar();
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

CarJack.SlopCrew.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using CarJack.Common;
using CarJack.Common.WhipRemix;
using CarJack.Plugin;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Reptile;
using SlopCrew.API;
using SlopCrew.Plugin;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("CarJack.SlopCrew")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("SlopCrew CarJack Plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a78143e9a8a145d78869252df6b5998f040a6bc5")]
[assembly: AssemblyProduct("CarJack.SlopCrew")]
[assembly: AssemblyTitle("CarJack.SlopCrew")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CarJack.SlopCrew
{
	public class BallController : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized;
		}

		private const float LerpMaxDistance = 10f;

		private const float Lerp = 10f;

		private const string BallSubHostPacketGUID = "CarJack-Ball-SubHost";

		private const string BallHostPacketGUID = "CarJack-Ball-Host";

		private const string BallPacketGUID = "CarJack-Ball";

		private const float TickRate = 0.1f;

		private const string BallGameObjectName = "rocket ball";

		private ISlopCrewAPI _api;

		private GameObject _ball;

		private Rigidbody _ballRB;

		private float _currentTick = 0.1f;

		private bool _host;

		private bool _subHost;

		private bool _hostFound;

		private bool _subHostFound;

		private Vector3 _receivedPosition;

		private Quaternion _receivedRotation;

		public static void Initialize()
		{
			//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
			object obj = <>O.<0>__StageManager_OnStageInitialized;
			if (obj == null)
			{
				OnStageInitializedDelegate val = StageManager_OnStageInitialized;
				<>O.<0>__StageManager_OnStageInitialized = val;
				obj = (object)val;
			}
			StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj;
		}

		private void Awake()
		{
			_api = APIManager.API;
			_api.OnCustomPacketReceived += OnBallPacketReceived;
			_api.OnCustomPacketReceived += OnBallHostPacketReceived;
		}

		private void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (Core.Instance.IsCorePaused || !_hostFound || !_subHostFound)
			{
				return;
			}
			if (_subHost)
			{
				_receivedPosition = _ballRB.position;
				_receivedRotation = _ballRB.rotation;
				return;
			}
			Vector3 val = _ballRB.position - _receivedPosition;
			if (((Vector3)(ref val)).magnitude >= 10f)
			{
				_ballRB.MovePosition(_receivedPosition);
				_ballRB.MoveRotation(_receivedRotation);
				return;
			}
			Vector3 val2 = Vector3.Lerp(_ballRB.position, _receivedPosition, 10f * Time.deltaTime);
			Quaternion val3 = Quaternion.Lerp(_ballRB.rotation, _receivedRotation, 10f * Time.deltaTime);
			_ballRB.MovePosition(val2);
			_ballRB.MoveRotation(val3);
		}

		private void UpdateHost()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			List<PlayerCarData> playerCars = NetworkController.Instance.PlayerCars;
			float num = float.MaxValue;
			uint num2 = uint.MaxValue;
			float num3 = float.MaxValue;
			DrivableCar currentCar = CarController.Instance.CurrentCar;
			Vector3 val;
			if ((Object)(object)currentCar != (Object)null)
			{
				val = currentCar.Rigidbody.position - _ballRB.position;
				num3 = ((Vector3)(ref val)).magnitude;
			}
			foreach (PlayerCarData item in playerCars)
			{
				val = item.LastPacket.Position - _ballRB.position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < num)
				{
					num = magnitude;
					num2 = item.PlayerID;
				}
			}
			if (num2 == uint.MaxValue)
			{
				_subHost = true;
				_subHostFound = true;
				SendBallHostPacket(uint.MaxValue, subHost: true);
			}
			else if (num3 < num)
			{
				_subHost = true;
				_subHostFound = true;
				SendBallHostPacket(uint.MaxValue, subHost: true);
			}
			else
			{
				_subHost = false;
				_subHostFound = true;
				SendBallHostPacket(num2, subHost: true);
			}
		}

		private void FixedUpdate()
		{
			if (Core.Instance.IsCorePaused || !_api.Connected)
			{
				return;
			}
			_currentTick -= Time.deltaTime;
			if (!(_currentTick <= 0f))
			{
				return;
			}
			_currentTick = 0.1f;
			if (_subHost)
			{
				SendBallPacket();
			}
			if (!_host)
			{
				ReadOnlyCollection<uint> players = _api.Players;
				uint num = uint.MaxValue;
				foreach (uint item in players)
				{
					if (item <= num && NetworkController.Instance.PlayerHasCar(item))
					{
						num = item;
					}
				}
				if (num != uint.MaxValue)
				{
					SendBallHostPacket(num, subHost: false);
					_hostFound = true;
				}
				else
				{
					_hostFound = false;
					_subHostFound = false;
				}
			}
			else
			{
				UpdateHost();
			}
		}

		private void OnDestroy()
		{
			_api.OnCustomPacketReceived -= OnBallPacketReceived;
			_api.OnCustomPacketReceived -= OnBallHostPacketReceived;
		}

		private void SendBallHostPacket(uint playerID, bool subHost)
		{
			MemoryStream memoryStream = new MemoryStream();
			BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
			binaryWriter.Write((byte)0);
			binaryWriter.Write(playerID);
			binaryWriter.Flush();
			if (subHost)
			{
				_api.SendCustomPacket("CarJack-Ball-SubHost", memoryStream.ToArray());
			}
			else
			{
				_api.SendCustomPacket("CarJack-Ball-Host", memoryStream.ToArray());
			}
			binaryWriter.Close();
		}

		private void SendBallPacket()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0069: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			MemoryStream memoryStream = new MemoryStream();
			BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
			Vector3 position = _ballRB.position;
			Quaternion rotation = _ballRB.rotation;
			Vector3 velocity = _ballRB.velocity;
			Vector3 angularVelocity = _ballRB.angularVelocity;
			binaryWriter.Write((byte)0);
			binaryWriter.Write(position.x);
			binaryWriter.Write(position.y);
			binaryWriter.Write(position.z);
			binaryWriter.Write(rotation.x);
			binaryWriter.Write(rotation.y);
			binaryWriter.Write(rotation.z);
			binaryWriter.Write(rotation.w);
			binaryWriter.Write(velocity.x);
			binaryWriter.Write(velocity.y);
			binaryWriter.Write(velocity.z);
			binaryWriter.Write(angularVelocity.x);
			binaryWriter.Write(angularVelocity.y);
			binaryWriter.Write(angularVelocity.z);
			binaryWriter.Flush();
			_api.SendCustomPacket("CarJack-Ball", memoryStream.ToArray());
			binaryWriter.Close();
		}

		private void OnBallHostPacketReceived(uint playerid, string guid, byte[] data)
		{
			if (guid != "CarJack-Ball-Host" && guid != "CarJack-Ball-SubHost")
			{
				return;
			}
			BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));
			binaryReader.ReadByte();
			uint num = binaryReader.ReadUInt32();
			binaryReader.Close();
			if (_api.PlayerIDExists(num) == true || num == uint.MaxValue)
			{
				if (guid == "CarJack-Ball-Host")
				{
					_host = false;
					_hostFound = true;
				}
				else if (guid == "CarJack-Ball-SubHost")
				{
					_subHost = false;
					_subHostFound = true;
				}
			}
			else if (guid == "CarJack-Ball-Host")
			{
				_host = true;
				_hostFound = true;
			}
			else if (guid == "CarJack-Ball-SubHost")
			{
				_subHost = true;
				_subHostFound = true;
			}
		}

		private void OnBallPacketReceived(uint playerid, string guid, byte[] data)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (!(guid != "CarJack-Ball") && !_subHost)
			{
				BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));
				binaryReader.ReadByte();
				float num = binaryReader.ReadSingle();
				float num2 = binaryReader.ReadSingle();
				float num3 = binaryReader.ReadSingle();
				float num4 = binaryReader.ReadSingle();
				float num5 = binaryReader.ReadSingle();
				float num6 = binaryReader.ReadSingle();
				float num7 = binaryReader.ReadSingle();
				float num8 = binaryReader.ReadSingle();
				float num9 = binaryReader.ReadSingle();
				float num10 = binaryReader.ReadSingle();
				float num11 = binaryReader.ReadSingle();
				float num12 = binaryReader.ReadSingle();
				float num13 = binaryReader.ReadSingle();
				_ballRB.velocity = new Vector3(num8, num9, num10);
				_ballRB.angularVelocity = new Vector3(num11, num12, num13);
				_receivedPosition = new Vector3(num, num2, num3);
				_receivedRotation = new Quaternion(num4, num5, num6, num7);
				binaryReader.Close();
			}
		}

		private static void StageManager_OnStageInitialized()
		{
			GameObject val = GameObject.Find("rocket ball");
			if (!((Object)(object)val == (Object)null))
			{
				Create(val);
			}
		}

		private static BallController Create(GameObject ball)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			BallController ballController = new GameObject("Ball Controller").AddComponent<BallController>();
			ballController.SetBall(ball);
			return ballController;
		}

		private void SetBall(GameObject ball)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			_ball = ball;
			_ballRB = ball.GetComponentInChildren<Rigidbody>();
			_receivedPosition = _ballRB.position;
			_receivedRotation = _ballRB.rotation;
		}
	}
	public class NetworkController : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnStageInitializedDelegate <0>__StageManager_OnStageInitialized;
		}

		public List<PlayerCarData> PlayerCars;

		private const byte KickPassengersPacketVersion = 0;

		private const string KickPassengersPacketGUID = "CarJack-KickPassengers";

		private const float LerpMaxDistance = 10f;

		private const float Lerp = 10f;

		private const float TickRate = 0.1f;

		private Dictionary<uint, PlayerCarData> _playerCarsById;

		private ISlopCrewAPI _api;

		private float _currentTick = 0.1f;

		public static NetworkController Instance { get; private set; }

		public static void Initialize()
		{
			//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
			object obj = <>O.<0>__StageManager_OnStageInitialized;
			if (obj == null)
			{
				OnStageInitializedDelegate val = StageManager_OnStageInitialized;
				<>O.<0>__StageManager_OnStageInitialized = val;
				obj = (object)val;
			}
			StageManager.OnStageInitialized += (OnStageInitializedDelegate)obj;
		}

		private static void StageManager_OnStageInitialized()
		{
			Create();
		}

		private static NetworkController Create()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return new GameObject("CarJack Network Controller").AddComponent<NetworkController>();
		}

		private void Awake()
		{
			Instance = this;
			PlayerCars = new List<PlayerCarData>();
			_playerCarsById = new Dictionary<uint, PlayerCarData>();
			_api = APIManager.API;
			_api.OnCustomPacketReceived += _api_OnCustomPacketReceived;
			CarController.OnPlayerExitingCar = (Action)Delegate.Combine(CarController.OnPlayerExitingCar, new Action(SendKickPassengersPacket));
		}

		private void OnDestroy()
		{
			_api.OnCustomPacketReceived -= _api_OnCustomPacketReceived;
			CarController.OnPlayerExitingCar = (Action)Delegate.Remove(CarController.OnPlayerExitingCar, new Action(SendKickPassengersPacket));
		}

		private void _api_OnCustomPacketReceived(uint playerId, string guid, byte[] data)
		{
			BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));
			if (!(guid == "CarJack-KickPassengers"))
			{
				if (guid == "CarJack-PlayerCar")
				{
					OnPlayerCarDataPacketReceived(playerId, binaryReader);
				}
			}
			else
			{
				OnKickPassengersPacketReceived(playerId, binaryReader);
			}
			binaryReader.Close();
		}

		private void SendKickPassengersPacket()
		{
			DrivableCar currentCar = CarController.Instance.CurrentCar;
			if (!((Object)(object)currentCar == (Object)null) && currentCar.Driving)
			{
				_api.SendCustomPacket("CarJack-KickPassengers", new byte[1]);
			}
		}

		private PlayerCarData GetPlayerForCar(DrivableCar car)
		{
			foreach (KeyValuePair<uint, PlayerCarData> item in _playerCarsById)
			{
				if ((Object)(object)item.Value.Car == (Object)(object)car)
				{
					return item.Value;
				}
			}
			return null;
		}

		private void OnKickPassengersPacketReceived(uint playerId, BinaryReader reader)
		{
			reader.ReadByte();
			CarController instance = CarController.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			DrivableCar currentCar = instance.CurrentCar;
			if (!((Object)(object)currentCar == (Object)null) && !currentCar.Driving)
			{
				PlayerCarData playerForCar = GetPlayerForCar(currentCar);
				if (playerForCar != null && !((Object)(object)playerForCar.Seat != (Object)null) && playerForCar.PlayerID == playerId)
				{
					instance.ExitCar();
				}
			}
		}

		private void OnPlayerCarDataPacketReceived(uint playerId, BinaryReader reader)
		{
			PlayerCarPacket playerCarPacket = new PlayerCarPacket();
			playerCarPacket.Deserialize(reader);
			if (!_playerCarsById.TryGetValue(playerId, out var value))
			{
				value = new PlayerCarData();
				value.PlayerID = playerId;
				PlayerCars.Add(value);
				_playerCarsById[playerId] = value;
			}
			value.LastPacket = playerCarPacket;
		}

		public bool PlayerHasCar(uint playerId)
		{
			if (!_playerCarsById.TryGetValue(playerId, out var value))
			{
				return false;
			}
			if ((Object)(object)value.Car != (Object)null)
			{
				return true;
			}
			return false;
		}

		public DrivableCar GetPlayersCar(uint playerId)
		{
			if (_api.PlayerIDExists(playerId) == false)
			{
				return CarController.Instance.CurrentCar;
			}
			if (!_playerCarsById.TryGetValue(playerId, out var value))
			{
				return null;
			}
			return value.Car;
		}

		private void FixedUpdate()
		{
			if (_api.Connected)
			{
				_currentTick -= Time.deltaTime;
				if (_currentTick <= 0f)
				{
					_currentTick = Time.deltaTime;
					Tick();
				}
			}
		}

		public uint GetDriver(DrivableCar car)
		{
			foreach (PlayerCarData playerCar in PlayerCars)
			{
				if ((Object)(object)playerCar.Car == (Object)(object)car)
				{
					return playerCar.PlayerID;
				}
			}
			return uint.MaxValue;
		}

		private void Tick()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			PlayerCarPacket playerCarPacket = new PlayerCarPacket();
			if ((Object)(object)CarController.Instance.CurrentCar != (Object)null)
			{
				DrivableCar currentCar = CarController.Instance.CurrentCar;
				if ((Object)(object)CarController.Instance.CurrentSeat == (Object)null)
				{
					playerCarPacket.CarInternalName = currentCar.InternalName;
				}
				playerCarPacket.Position = currentCar.Rigidbody.position;
				playerCarPacket.Rotation = currentCar.Rigidbody.rotation;
				playerCarPacket.Velocity = currentCar.Rigidbody.velocity;
				playerCarPacket.AngularVelocity = currentCar.Rigidbody.angularVelocity;
				playerCarPacket.ThrottleAxis = currentCar.ThrottleAxis;
				playerCarPacket.SteerAxis = currentCar.SteerAxis;
				playerCarPacket.HornHeld = currentCar.HornHeld;
				if ((Object)(object)CarController.Instance.CurrentSeat != (Object)null)
				{
					playerCarPacket.PassengerSeat = CarController.Instance.CurrentSeat.SeatIndex;
					playerCarPacket.DriverPlayerID = GetDriver(currentCar);
				}
				playerCarPacket.DoorsLocked = PlayerData.Instance.DoorsLocked;
				RecolorableCar component = ((Component)currentCar).GetComponent<RecolorableCar>();
				if ((Object)(object)component != (Object)null && component.CurrentRecolor != null)
				{
					playerCarPacket.RecolorGUID = component.CurrentRecolor.Properties.RecolorGUID;
				}
			}
			MemoryStream memoryStream = new MemoryStream();
			BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
			playerCarPacket.Serialize(binaryWriter);
			binaryWriter.Flush();
			_api.SendCustomPacket("CarJack-PlayerCar", memoryStream.ToArray());
			binaryWriter.Close();
			List<PlayerCarData> list = new List<PlayerCarData>();
			Dictionary<uint, PlayerCarData> dictionary = new Dictionary<uint, PlayerCarData>();
			for (int i = 0; i < PlayerCars.Count; i++)
			{
				if (TickCar(PlayerCars[i]))
				{
					list.Add(PlayerCars[i]);
					dictionary[PlayerCars[i].PlayerID] = PlayerCars[i];
				}
			}
			PlayerCars = list;
			_playerCarsById = dictionary;
		}

		private void Update()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			if (Core.Instance.IsCorePaused)
			{
				return;
			}
			foreach (PlayerCarData playerCar in PlayerCars)
			{
				if (!((Object)(object)playerCar.Car == (Object)null) && !((Object)(object)playerCar.Seat != (Object)null))
				{
					Vector3 val = Vector3.Lerp(playerCar.Car.Rigidbody.position, playerCar.LastPacket.Position, 10f * Time.deltaTime);
					Quaternion val2 = Quaternion.Lerp(playerCar.Car.Rigidbody.rotation, playerCar.LastPacket.Rotation, 10f * Time.deltaTime);
					Vector3 val3 = playerCar.Car.Rigidbody.position - playerCar.LastPacket.Position;
					if (((Vector3)(ref val3)).magnitude >= 10f)
					{
						val = playerCar.LastPacket.Position;
						val2 = playerCar.LastPacket.Rotation;
						((Component)playerCar.Car).transform.position = val;
						((Component)playerCar.Car).transform.rotation = val2;
					}
					else
					{
						playerCar.Car.Rigidbody.MovePosition(val);
					}
					playerCar.Car.Rigidbody.MoveRotation(val2);
				}
			}
		}

		private bool TickCar(PlayerCarData playerCarData)
		{
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			bool result = true;
			if (playerCarData.LastPacket.PassengerSeat != -1)
			{
				playerCarData.LastPacket.CarInternalName = "carjack.bluecar";
			}
			if (_api.PlayerIDExists(playerCarData.PlayerID) == false)
			{
				playerCarData.LastPacket.CarInternalName = "";
				result = false;
			}
			Player player = Utility.GetPlayer(playerCarData.PlayerID);
			if (playerCarData.LastPacket.CarInternalName == "")
			{
				if ((Object)(object)player != (Object)null)
				{
					((Component)player.characterVisual).gameObject.SetActive(true);
					player.EnablePlayer(false);
				}
				if ((Object)(object)playerCarData.Car != (Object)null)
				{
					if ((Object)(object)playerCarData.Seat == (Object)null)
					{
						Object.Destroy((Object)(object)((Component)playerCarData.Car).gameObject);
					}
					else if ((Object)(object)playerCarData.Seat.Player == (Object)(object)player)
					{
						playerCarData.Seat.ExitSeat();
					}
					playerCarData.Seat = null;
					playerCarData.Car = null;
				}
				if ((Object)(object)playerCarData.Polo != (Object)null)
				{
					playerCarData.Polo.SetActive(true);
				}
			}
			else
			{
				string text = "carjack.bluecar";
				if (CarDatabase.CarByInternalName.TryGetValue(playerCarData.LastPacket.CarInternalName, out var value))
				{
					text = value.Prefab.GetComponent<DrivableCar>().InternalName;
				}
				else
				{
					flag = true;
				}
				DrivableCar currentCar = playerCarData.Car;
				if (playerCarData.LastPacket.PassengerSeat != -1)
				{
					DrivableCar val = (currentCar = GetPlayersCar(playerCarData.LastPacket.DriverPlayerID));
					if ((Object)(object)val != (Object)null)
					{
						CarPassengerSeat passengerSeat = val.GetPassengerSeat(playerCarData.LastPacket.PassengerSeat);
						if ((Object)(object)passengerSeat != (Object)null)
						{
							((Component)player).transform.position = ((Component)passengerSeat).transform.position;
							if ((Object)(object)passengerSeat != (Object)(object)playerCarData.Seat)
							{
								CarSeat seat = playerCarData.Seat;
								if ((Object)(object)seat != (Object)null && (Object)(object)seat.Player == (Object)(object)player)
								{
									seat.ExitSeat();
								}
								((Component)player.characterVisual).gameObject.SetActive(false);
								player.CompletelyStop();
								player.DisablePlayer();
								Transform val2 = ((Component)player).transform.Find("Mascot_Polo_street(Clone)");
								if ((Object)(object)val2 != (Object)null)
								{
									playerCarData.Polo = ((Component)val2).gameObject;
									((Component)val2).gameObject.SetActive(false);
								}
								playerCarData.Seat = (CarSeat)(object)passengerSeat;
								((CarSeat)passengerSeat).PutInSeat(player);
							}
						}
					}
				}
				else
				{
					if ((Object)(object)playerCarData.Seat != (Object)null)
					{
						if ((Object)(object)playerCarData.Seat.Player == (Object)(object)player)
						{
							playerCarData.Seat.ExitSeat();
						}
						playerCarData.Seat = null;
					}
					if ((Object)(object)currentCar == (Object)null || currentCar.InternalName != text)
					{
						if ((Object)(object)currentCar != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)currentCar).gameObject);
						}
						GameObject val3 = Object.Instantiate<GameObject>(CarDatabase.CarByInternalName[text].Prefab);
						val3.transform.position = playerCarData.LastPacket.Position;
						val3.transform.rotation = playerCarData.LastPacket.Rotation;
						currentCar = val3.GetComponent<DrivableCar>();
						currentCar.Initialize();
						currentCar.EnterCar(player);
						uint playerId = playerCarData.PlayerID;
						DrivableCar obj = currentCar;
						obj.OnHandleInput = (Action)Delegate.Combine(obj.OnHandleInput, (Action)delegate
						{
							if (_playerCarsById.TryGetValue(playerId, out var value3))
							{
								currentCar.ThrottleAxis = value3.LastPacket.ThrottleAxis;
								currentCar.SteerAxis = value3.LastPacket.SteerAxis;
								currentCar.HornHeld = value3.LastPacket.HornHeld;
							}
						});
					}
					if ((Object)(object)currentCar != (Object)null)
					{
						if ((Object)(object)player != (Object)null)
						{
							((Component)player.characterVisual).gameObject.SetActive(false);
							((Component)player).transform.position = ((Component)currentCar).transform.position;
							player.CompletelyStop();
							player.DisablePlayer();
							Transform val4 = ((Component)player).transform.Find("Mascot_Polo_street(Clone)");
							if ((Object)(object)val4 != (Object)null)
							{
								playerCarData.Polo = ((Component)val4).gameObject;
								((Component)val4).gameObject.SetActive(false);
							}
						}
						currentCar.Rigidbody.velocity = playerCarData.LastPacket.Velocity;
						currentCar.Rigidbody.angularVelocity = playerCarData.LastPacket.AngularVelocity;
						currentCar.DoorsLocked = flag || playerCarData.LastPacket.DoorsLocked;
						RecolorableCar component = ((Component)currentCar).GetComponent<RecolorableCar>();
						if ((Object)(object)component != (Object)null)
						{
							Recolor val5 = null;
							if (!string.IsNullOrEmpty(playerCarData.LastPacket.RecolorGUID) && RecolorManager.RecolorsByGUID.TryGetValue(playerCarData.LastPacket.RecolorGUID, out var value2) && value2.Properties.CarInternalName == currentCar.InternalName)
							{
								val5 = value2;
							}
							if (component.CurrentRecolor != val5)
							{
								if (val5 == null)
								{
									component.ApplyDefaultColor();
								}
								else
								{
									component.ApplyRecolor(val5);
								}
							}
						}
					}
					else if ((Object)(object)player != (Object)null)
					{
						((Component)player.characterVisual).gameObject.SetActive(true);
						player.EnablePlayer(false);
						if ((Object)(object)playerCarData.Polo != (Object)null)
						{
							playerCarData.Polo.SetActive(true);
						}
					}
				}
				playerCarData.Car = currentCar;
			}
			return result;
		}
	}
	public class PlayerCarData
	{
		public uint PlayerID;

		public DrivableCar Car;

		public PlayerCarPacket LastPacket;

		public GameObject Polo;

		public CarSeat Seat;
	}
	public class PlayerCarPacket
	{
		private const byte Version = 3;

		public const string GUID = "CarJack-PlayerCar";

		public string CarInternalName = "";

		public Vector3 Position = Vector3.zero;

		public Quaternion Rotation = Quaternion.identity;

		public Vector3 Velocity = Vector3.zero;

		public Vector3 AngularVelocity = Vector3.zero;

		public float ThrottleAxis;

		public float SteerAxis;

		public bool HornHeld;

		public bool BrakeHeld;

		public float PitchAxis;

		public float YawAxis;

		public float RollAxis;

		public int PassengerSeat = -1;

		public uint DriverPlayerID = uint.MaxValue;

		public bool DoorsLocked;

		public string RecolorGUID = string.Empty;

		public void Serialize(BinaryWriter writer)
		{
			writer.Write((byte)3);
			writer.Write(CarInternalName);
			writer.Write(Position.x);
			writer.Write(Position.y);
			writer.Write(Position.z);
			writer.Write(Rotation.x);
			writer.Write(Rotation.y);
			writer.Write(Rotation.z);
			writer.Write(Rotation.w);
			writer.Write(Velocity.x);
			writer.Write(Velocity.y);
			writer.Write(Velocity.z);
			writer.Write(AngularVelocity.x);
			writer.Write(AngularVelocity.y);
			writer.Write(AngularVelocity.z);
			writer.Write(ThrottleAxis);
			writer.Write(SteerAxis);
			writer.Write(HornHeld);
			writer.Write(BrakeHeld);
			writer.Write(PitchAxis);
			writer.Write(YawAxis);
			writer.Write(RollAxis);
			writer.Write(PassengerSeat);
			writer.Write(DriverPlayerID);
			writer.Write(DoorsLocked);
			writer.Write(RecolorGUID);
		}

		public void Deserialize(BinaryReader reader)
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			byte b = reader.ReadByte();
			CarInternalName = reader.ReadString();
			float num = reader.ReadSingle();
			float num2 = reader.ReadSingle();
			float num3 = reader.ReadSingle();
			float num4 = reader.ReadSingle();
			float num5 = reader.ReadSingle();
			float num6 = reader.ReadSingle();
			float num7 = reader.ReadSingle();
			float num8 = reader.ReadSingle();
			float num9 = reader.ReadSingle();
			float num10 = reader.ReadSingle();
			float num11 = reader.ReadSingle();
			float num12 = reader.ReadSingle();
			float num13 = reader.ReadSingle();
			ThrottleAxis = reader.ReadSingle();
			SteerAxis = reader.ReadSingle();
			HornHeld = reader.ReadBoolean();
			BrakeHeld = reader.ReadBoolean();
			PitchAxis = reader.ReadSingle();
			YawAxis = reader.ReadSingle();
			RollAxis = reader.ReadSingle();
			if (b >= 1)
			{
				PassengerSeat = reader.ReadInt32();
				DriverPlayerID = reader.ReadUInt32();
				if (b >= 2)
				{
					DoorsLocked = reader.ReadBoolean();
				}
				if (b >= 3)
				{
					RecolorGUID = reader.ReadString();
				}
			}
			Position = new Vector3(num, num2, num3);
			Rotation = new Quaternion(num4, num5, num6, num7);
			Velocity = new Vector3(num8, num9, num10);
			AngularVelocity = new Vector3(num11, num12, num13);
		}
	}
	[CarJackPlugin]
	public class Plugin
	{
		public Plugin()
		{
			if (CarController.Config.SlopCrewIntegration)
			{
				BallController.Initialize();
				NetworkController.Initialize();
			}
		}
	}
	public static class Utility
	{
		public static Player GetPlayer(uint playerId)
		{
			if (!ServiceProviderServiceExtensions.GetRequiredService<PlayerManager>(Plugin.Host.Services).Players.TryGetValue(playerId, out var value))
			{
				return null;
			}
			return value.ReptilePlayer;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CarJack.SlopCrew";

		public const string PLUGIN_NAME = "CarJack.SlopCrew";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

CarJack.BombRushCamera.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BombRushCamera;
using CarJack.Common;
using CarJack.Plugin;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("CarJack.BombRushCamera")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BombRushCamera CarJack Plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a78143e9a8a145d78869252df6b5998f040a6bc5")]
[assembly: AssemblyProduct("CarJack.BombRushCamera")]
[assembly: AssemblyTitle("CarJack.BombRushCamera")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CarJack.BombRushCamera
{
	public class CameraController : MonoBehaviour
	{
		private void Update()
		{
			CarCamera.Enabled = !Plugin.Active;
		}
	}
	[CarJackPlugin]
	public class Plugin
	{
		public Plugin()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			GameObject val = new GameObject("CarJack BombRushCamera controller");
			val.AddComponent<CameraController>();
			Object.DontDestroyOnLoad((Object)val);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CarJack.BombRushCamera";

		public const string PLUGIN_NAME = "CarJack.BombRushCamera";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}