Decompiled source of Company Hauler v2.2.14

BepInEx/plugins/companyhauler/glojam.CompanyHauler.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CompanyHauler.Compatibility;
using CompanyHauler.Networking;
using CompanyHauler.Patches;
using CompanyHauler.Patches.Enemies;
using CompanyHauler.Patches.InternalUtils;
using CompanyHauler.Scripts;
using CompanyHauler.Utils;
using FirstPersonView;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalMin;
using Microsoft.CodeAnalysis;
using ScandalLib.Patches;
using ScandalLib.Scripts;
using ScandalsTweaks.Compatibility;
using ScandalsTweaks.Patches;
using ScandalsTweaks.Patches.Enemies;
using ScandalsTweaks.Utils;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;
using VoxxWeatherPlugin.Patches;
using VoxxWeatherPlugin.Utils;
using VoxxWeatherPlugin.Weathers;
using Woecust.ImmersiveVisor;
using glojam.CompanyHauler.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("FirstPersonView")]
[assembly: IgnoresAccessChecksTo("ImmersiveVisor")]
[assembly: IgnoresAccessChecksTo("NoteBoxz.LethalMin")]
[assembly: IgnoresAccessChecksTo("scandal.scandallib")]
[assembly: IgnoresAccessChecksTo("scandal.scandalstweaks")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("voxx.LethalElementsPlugin")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("glojam.CompanyHauler")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.2.14.0")]
[assembly: AssemblyInformationalVersion("2.2.14+57aec18cdfc839339c2c3037585e9d289b0c403e")]
[assembly: AssemblyProduct("CompanyHauler")]
[assembly: AssemblyTitle("glojam.CompanyHauler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.14.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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;
		}
	}
}
public class HaulerCollisionTrigger : MonoBehaviour
{
	public HaulerController mainScript = null;

	public BoxCollider insideTruckNavMeshBounds = null;

	public EnemyAI[] enemiesLastHit = null;

	private float timeSinceHittingPlayer;

	private float timeSinceHittingEnemy;

	private int enemyIndex;

	public void Start()
	{
		enemiesLastHit = (EnemyAI[])(object)new EnemyAI[3];
	}

	public void OnTriggerEnter(Collider other)
	{
		//IL_0454: Unknown result type (might be due to invalid IL or missing references)
		//IL_0464: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: 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_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_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_0549: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_056c: Unknown result type (might be due to invalid IL or missing references)
		//IL_057d: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0637: Unknown result type (might be due to invalid IL or missing references)
		//IL_063d: Invalid comparison between Unknown and I4
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_068f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_0696: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Unknown result type (might be due to invalid IL or missing references)
		//IL_069a: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ad: Expected I4, but got Unknown
		//IL_06be: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0701: Unknown result type (might be due to invalid IL or missing references)
		//IL_072a: Unknown result type (might be due to invalid IL or missing references)
		//IL_072f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0737: Unknown result type (might be due to invalid IL or missing references)
		if (!((VehicleController)mainScript).hasBeenSpawned || (((VehicleController)mainScript).magnetedToShip && ((VehicleController)mainScript).magnetTime > 0.8f))
		{
			return;
		}
		if (((Component)other).CompareTag("Player"))
		{
			PlayerControllerB val = default(PlayerControllerB);
			if (!((Component)other).TryGetComponent<PlayerControllerB>(ref val) || Time.realtimeSinceStartup - timeSinceHittingPlayer < 0.25f)
			{
				return;
			}
			Transform physicsTransform = ((VehicleController)mainScript).physicsRegion.physicsTransform;
			if ((Object)(object)val.overridePhysicsParent == (Object)(object)physicsTransform || (Object)(object)val.physicsParent == (Object)(object)physicsTransform)
			{
				return;
			}
			float num = Mathf.Abs(((Vector3)(ref ((VehicleController)mainScript).averageVelocity)).magnitude);
			if (num < 2f)
			{
				return;
			}
			Vector3 val2 = ((Component)val).transform.position - ((VehicleController)mainScript).mainRigidbody.position;
			float num2 = Vector3.Angle(Vector3.Normalize(((VehicleController)mainScript).averageVelocity * 1000f), Vector3.Normalize(val2 * 1000f));
			if (num2 > 70f)
			{
				return;
			}
			if (num2 < 30f && mainScript.wheelRPM > 400f)
			{
				num += 6f;
			}
			if ((((Component)val.gameplayCamera).transform.position - ((VehicleController)mainScript).mainRigidbody.position).y < -0.1f)
			{
				num *= 2f;
			}
			timeSinceHittingPlayer = Time.realtimeSinceStartup;
			Vector3 val3 = Vector3.ClampMagnitude(((VehicleController)mainScript).averageVelocity, 40f);
			if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				if ((Object)(object)physicsTransform == (Object)(object)GameNetworkManager.Instance.localPlayerController.physicsParent)
				{
					return;
				}
				if (num > 20f)
				{
					GameNetworkManager.Instance.localPlayerController.KillPlayer(val3, true, (CauseOfDeath)8, 0, default(Vector3), false);
				}
				else
				{
					int num3 = 0;
					if (num > 15f)
					{
						num3 = 80;
					}
					else if (num > 12f)
					{
						num3 = 60;
					}
					else if (num > 8f)
					{
						num3 = 40;
					}
					if (num3 > 0)
					{
						GameNetworkManager.Instance.localPlayerController.DamagePlayer(num3, true, true, (CauseOfDeath)8, 0, false, val3);
					}
				}
				if (!GameNetworkManager.Instance.localPlayerController.isPlayerDead && ((Vector3)(ref GameNetworkManager.Instance.localPlayerController.externalForceAutoFade)).sqrMagnitude < ((Vector3)(ref ((VehicleController)mainScript).averageVelocity)).sqrMagnitude)
				{
					GameNetworkManager.Instance.localPlayerController.externalForceAutoFade = ((VehicleController)mainScript).averageVelocity;
				}
			}
			else if (((NetworkBehaviour)mainScript).IsOwner && ((Vector3)(ref ((VehicleController)mainScript).averageVelocity)).magnitude > 1.8f)
			{
				mainScript.CarReactToObstacle(((VehicleController)mainScript).averageVelocity, ((Component)val).transform.position, ((VehicleController)mainScript).averageVelocity, (CarObstacleType)0);
			}
		}
		else
		{
			EnemyAICollisionDetect val4 = default(EnemyAICollisionDetect);
			if (!((Component)other).gameObject.CompareTag("Enemy") || Time.realtimeSinceStartup - timeSinceHittingEnemy < 0.25f || !((Component)other).TryGetComponent<EnemyAICollisionDetect>(ref val4) || (Object)(object)val4.mainScript == (Object)null || val4.mainScript.isEnemyDead)
			{
				return;
			}
			if (val4.mainScript is SandWormAI)
			{
				timeSinceHittingEnemy = Time.realtimeSinceStartup;
				((VehicleController)mainScript).mainRigidbody.AddExplosionForce(((VehicleController)mainScript).mainRigidbody.mass * 100f, ((Component)mainScript).transform.position + ((Component)mainScript).transform.forward + Vector3.up * 1.5f, 12f, 3f, (ForceMode)1);
			}
			else
			{
				if (val4.mainScript is BushWolfEnemy)
				{
					return;
				}
				EnemyAI obj = val4.mainScript;
				FlowerSnakeEnemy val5 = (FlowerSnakeEnemy)(object)((obj is FlowerSnakeEnemy) ? obj : null);
				if ((val5 != null && Object.op_Implicit((Object)(object)val5.clingingToPlayer)) || Vector3.Angle(((VehicleController)mainScript).averageVelocity, ((Component)val4.mainScript).transform.position - ((Component)this).transform.position) > 130f || ((Collider)insideTruckNavMeshBounds).ClosestPoint(((Component)val4.mainScript).transform.position) == ((Component)val4.mainScript).transform.position || ((Collider)insideTruckNavMeshBounds).ClosestPoint(val4.mainScript.agent.destination) == val4.mainScript.agent.destination)
				{
					return;
				}
				bool dealDamage = false;
				for (int i = 0; i < enemiesLastHit.Length; i++)
				{
					if ((Object)(object)enemiesLastHit[i] == (Object)(object)val4.mainScript && (Time.realtimeSinceStartup - timeSinceHittingEnemy < 0.6f || ((Vector3)(ref ((VehicleController)mainScript).averageVelocity)).magnitude < 4f))
					{
						dealDamage = true;
					}
				}
				if (((Vector3)(ref ((VehicleController)mainScript).averageVelocity)).magnitude < 6f && (!((VehicleController)mainScript).ignitionStarted || (int)((VehicleController)mainScript).gear == 3 || Mathf.Abs(mainScript.wheelRPM) < 40f))
				{
					dealDamage = false;
				}
				timeSinceHittingEnemy = Time.realtimeSinceStartup;
				Vector3 position = ((Component)val4).transform.position;
				bool flag = false;
				EnemySize enemySize = val4.mainScript.enemyType.EnemySize;
				EnemySize val6 = enemySize;
				switch ((int)val6)
				{
				case 0:
					flag = mainScript.CarReactToObstacle(((VehicleController)mainScript).averageVelocity, position, ((VehicleController)mainScript).averageVelocity, (CarObstacleType)1, 1f, val4.mainScript, dealDamage);
					break;
				case 1:
					flag = mainScript.CarReactToObstacle(((VehicleController)mainScript).averageVelocity, position, ((VehicleController)mainScript).averageVelocity, (CarObstacleType)1, 3f, val4.mainScript, dealDamage);
					break;
				case 2:
					flag = mainScript.CarReactToObstacle(((VehicleController)mainScript).averageVelocity, position, ((VehicleController)mainScript).averageVelocity, (CarObstacleType)1, 2f, val4.mainScript, dealDamage);
					break;
				}
				if (flag)
				{
					enemyIndex = (enemyIndex + 1) % 3;
					enemiesLastHit[enemyIndex] = val4.mainScript;
					return;
				}
				for (int j = 0; j < enemiesLastHit.Length; j++)
				{
					if ((Object)(object)enemiesLastHit[j] == (Object)(object)val4.mainScript)
					{
						enemiesLastHit[j] = null;
					}
				}
			}
		}
	}
}
namespace CompanyHauler
{
	[BepInPlugin("glojam.CompanyHauler", "CompanyHauler", "2.2.14")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static VehicleControls VehicleControlsInstance;

		internal static bool initialized;

		public static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		public void Awake()
		{
			if (!initialized)
			{
				initialized = true;
				Logger = ((BaseUnityPlugin)this).Logger;
				Instance = this;
				VehicleControlsInstance = new VehicleControls();
				UserConfig.InitConfig();
				Patch();
				LogInfo("glojam.CompanyHauler v2.2.14 has loaded!");
			}
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("glojam.CompanyHauler");
			}
			LogDebug("Patching...");
			CompatibilityUtils.Init(Harmony);
			Harmony.PatchAll(typeof(ScandalsTweaksPatches));
			Harmony.PatchAll(typeof(BaboonBirdAIPatches));
			Harmony.PatchAll(typeof(ForestGiantAIPatches));
			Harmony.PatchAll(typeof(GiantKiwiAIPatches));
			Harmony.PatchAll(typeof(MaskedPlayerEnemyPatches));
			Harmony.PatchAll(typeof(MouthDogAIPatches));
			Harmony.PatchAll(typeof(PumaAIPatches));
			Harmony.PatchAll(typeof(RadMechAIPatches));
			Harmony.PatchAll(typeof(RedLocustBeesPatches));
			Harmony.PatchAll(typeof(SandWormAIPatches));
			Harmony.PatchAll(typeof(ElevatorAnimationEventsPatches));
			Harmony.PatchAll(typeof(GameNetworkManagerPatches));
			Harmony.PatchAll(typeof(HUDManagerPatches));
			Harmony.PatchAll(typeof(LandminePatches));
			Harmony.PatchAll(typeof(PlayerControllerBPatches));
			Harmony.PatchAll(typeof(StartOfRoundPatches));
			Harmony.PatchAll(typeof(VehicleControllerPatches));
			LogDebug("Finished patching!");
		}

		internal static void Unpatch()
		{
			LogDebug("Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			LogDebug("Finished unpatching!");
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogMessage(string messageLog)
		{
			Logger.LogMessage((object)messageLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogDebug(string debugLog)
		{
			Logger.LogDebug((object)debugLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogInfo(string infoLog)
		{
			Logger.LogInfo((object)infoLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogWarning(string warningLog)
		{
			Logger.LogWarning((object)warningLog);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogError(string errorLog)
		{
			Logger.LogError((object)errorLog);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "glojam.CompanyHauler";

		public const string PLUGIN_NAME = "CompanyHauler";

		public const string PLUGIN_VERSION = "2.2.14";
	}
}
namespace CompanyHauler.Utils
{
	public static class CameraUtils
	{
		private static readonly Plane[] frustumPlanes = (Plane[])(object)new Plane[6];

		public static bool IsVisibleToPlayersLocalCamera(this Renderer renderer, Camera playersCamera)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = renderer.bounds;
			GeometryUtility.CalculateFrustumPlanes(playersCamera, frustumPlanes);
			if (GeometryUtility.TestPlanesAABB(frustumPlanes, bounds))
			{
				return true;
			}
			return false;
		}
	}
	internal static class CompatibilityUtils
	{
		internal const string GUID_LETHAL_LEVEL_LOADER = "imabatby.lethallevelloader";

		internal const string GUID_SCANDALLIB = "scandal.scandallib";

		internal const string GUID_SCANDALS_TWEAKS = "scandal.scandalstweaks";

		internal const string GUID_INPUT_UTILS = "com.rune580.LethalCompanyInputUtils";

		internal const string GUID_LETHALELEMENTS = "voxx.LethalElementsPlugin";

		internal const string GUID_LETHALMIN = "NoteBoxz.LethalMin";

		internal const string GUID_IMMERSIVE_VISOR = "ImmersiveVisor";

		internal const string GUID_FIRST_PERSON_VIEW = "com.seeya.firstpersonview";

		internal static bool INSTALLED_LETHALELEMENTS;

		internal static bool INSTALLED_LETHALMIN;

		internal static bool INSTALLED_IMMERSIVE_VISOR;

		internal static bool INSTALLED_FIRST_PERSON_VIEW;

		internal static void Init(Harmony harmony)
		{
			if (Chainloader.PluginInfos.ContainsKey("voxx.LethalElementsPlugin"))
			{
				INSTALLED_LETHALELEMENTS = true;
				harmony.PatchAll(typeof(LethalElementsCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - LethalElements detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("NoteBoxz.LethalMin"))
			{
				INSTALLED_LETHALMIN = true;
				harmony.PatchAll(typeof(LethalMinCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - LethalMin detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("ImmersiveVisor"))
			{
				INSTALLED_IMMERSIVE_VISOR = true;
				harmony.PatchAll(typeof(ImmersiveVisorCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - ImmersiveVisor detected");
			}
			if (Chainloader.PluginInfos.ContainsKey("com.seeya.firstpersonview"))
			{
				INSTALLED_FIRST_PERSON_VIEW = true;
				harmony.PatchAll(typeof(FirstPersonViewCompatibility));
				Plugin.LogDebug("CROSS-COMPATIBILITY - FirstPersonView detected");
			}
		}
	}
	internal class UserConfig
	{
		internal static ConfigEntry<bool> haulerMirror;

		internal static ConfigEntry<bool> RecenterWheel;

		internal static void InitConfig()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			config.SaveOnConfigSet = false;
			haulerMirror = config.Bind<bool>("General", "Enable Mirrors", true, "Enable rendering for the side mirrors? (may impact performance for low end hardware)");
			RecenterWheel = config.Bind<bool>("Quality Of Life", "Automatically Center Wheel", false, "Should the wheel be automatically re-centered?");
			ClearOrphanedEntries(config);
			config.Save();
			config.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
	internal class VehicleControls : LcInputActions
	{
		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction GasPedalKey { get; set; } = null;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction BrakePedalKey { get; set; } = null;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction JumpKey { get; set; } = null;

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction ToggleMagnetKey { get; set; } = null;
	}
	public static class VehicleUtils
	{
		internal static HaulerController pickupController;

		public static bool IsEnemyInPickup(EnemyAI enemyScript, BoxCollider navMeshBounds)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			return ((Collider)navMeshBounds).ClosestPoint(((Component)enemyScript).transform.position) == ((Component)enemyScript).transform.position || ((Collider)navMeshBounds).ClosestPoint(enemyScript.agent.destination) == enemyScript.agent.destination;
		}

		public static bool IsPlayerSeatedInPickup(PlayerControllerB playerScript, HaulerController pickupScript)
		{
			return (Object)(object)playerScript != (Object)null && (Object)(object)playerScript?.overridePhysicsParent == (Object)(object)((pickupScript != null) ? ((Component)pickupScript).transform : null);
		}

		public static bool IsPlayerInPickupBounds(PlayerControllerB playerScript, HaulerController pickupScript, bool usePlayerData = false)
		{
			return usePlayerData ? PlayerControllerBPatches.playerData[playerScript].playerRidingOnPickup : pickupScript.vehicleZone.playerInZone;
		}

		public static bool IsPlayerInPickupCab(PlayerControllerB playerScript, HaulerController pickupScript, bool usePlayerData = false)
		{
			return usePlayerData ? PlayerControllerBPatches.playerData[playerScript].playerRidingInPickupCab : pickupScript.vehicleCabZone.playerInZone;
		}

		public static bool IsPlayerOnOutsideOfPickup(PlayerControllerB playerScript, HaulerController pickupScript, bool usePlayerData = false)
		{
			return IsPlayerInPickupBounds(playerScript, pickupScript, usePlayerData) && !IsPlayerInPickupCab(playerScript, pickupScript, usePlayerData) && !IsPlayerSeatedInPickup(playerScript, pickupScript);
		}

		public static bool IsPickupCabEnclosed(HaulerController pickupScript)
		{
			return !((VehicleController)pickupScript).windshieldBroken && !((VehicleController)pickupScript).driverSideDoor.boolValue && !((VehicleController)pickupScript).passengerSideDoor.boolValue && !pickupScript.backLeftDoor.boolValue && !pickupScript.backRightDoor.boolValue && !pickupScript.frontLeftWindow.isWindowOpen && !pickupScript.frontRightWindow.isWindowOpen && !pickupScript.backLeftWindow.isWindowOpen && !pickupScript.backRightWindow.isWindowOpen && !pickupScript.sunroofOpen;
		}

		public static bool IsPickupMovingFastEnough(HaulerController pickupScript, float threshold)
		{
			return ((Vector3)(ref ((VehicleController)pickupScript).averageVelocity)).magnitude > threshold;
		}

		public static bool IsSeatedPlayerProtected(PlayerControllerB playerScript, HaulerController pickupScript, bool checkSunroof = false, bool checkWindows = false, bool windshieldCheck = false, bool velocityCheck = false, float velocityMagnitude = 0f)
		{
			if (velocityCheck && IsPickupMovingFastEnough(pickupScript, velocityMagnitude))
			{
				return true;
			}
			bool flag = (Object)(object)playerScript == (Object)(object)((VehicleController)pickupScript).currentDriver;
			bool flag2 = (Object)(object)playerScript == (Object)(object)((VehicleController)pickupScript).currentPassenger;
			bool flag3 = (Object)(object)playerScript == (Object)(object)pickupScript.currentBackLeftPassenger;
			bool flag4 = (Object)(object)playerScript == (Object)(object)pickupScript.currentBackMiddlePassenger;
			bool flag5 = (Object)(object)playerScript == (Object)(object)pickupScript.currentBackRightPassenger;
			bool flag6 = flag || flag2;
			bool windshieldBroken = ((VehicleController)pickupScript).windshieldBroken;
			bool sunroofOpen = pickupScript.sunroofOpen;
			if ((checkSunroof && sunroofOpen) || (flag6 && windshieldCheck && windshieldBroken))
			{
				return false;
			}
			bool flag7 = ((VehicleController)pickupScript).driverSideDoor.boolValue || (checkWindows && pickupScript.frontLeftWindow.isWindowOpen);
			bool flag8 = ((VehicleController)pickupScript).passengerSideDoor.boolValue || (checkWindows && pickupScript.frontRightWindow.isWindowOpen);
			bool flag9 = pickupScript.backLeftDoor.boolValue || (checkWindows && pickupScript.backLeftWindow.isWindowOpen);
			bool flag10 = pickupScript.backRightDoor.boolValue || (checkWindows && pickupScript.backRightWindow.isWindowOpen);
			if (flag && flag7)
			{
				return false;
			}
			if (flag2 && flag8)
			{
				return false;
			}
			if (flag3 && flag9)
			{
				return false;
			}
			if (flag4 && (flag9 || flag10))
			{
				return false;
			}
			if (flag5 && flag10)
			{
				return false;
			}
			return true;
		}

		public static bool IsPlayerProtectedByPickup(PlayerControllerB playerScript, HaulerController pickupScript, bool checkSunroof = false, bool checkWindows = false, bool windshieldCheck = false, bool velocityCheck = false, float velocityMagnitude = 0f)
		{
			if (((VehicleController)pickupScript).carDestroyed)
			{
				return false;
			}
			if (velocityCheck && IsPickupMovingFastEnough(pickupScript, velocityMagnitude))
			{
				return true;
			}
			bool flag = IsPlayerInPickupCab(playerScript, pickupScript);
			bool windshieldBroken = ((VehicleController)pickupScript).windshieldBroken;
			bool sunroofOpen = pickupScript.sunroofOpen;
			bool flag2 = ((VehicleController)pickupScript).driverSideDoor.boolValue || ((VehicleController)pickupScript).passengerSideDoor.boolValue || pickupScript.backLeftDoor.boolValue || pickupScript.backRightDoor.boolValue;
			bool flag3 = pickupScript.frontLeftWindow.isWindowOpen || pickupScript.frontRightWindow.isWindowOpen || pickupScript.backLeftWindow.isWindowOpen || pickupScript.backRightWindow.isWindowOpen;
			if (flag && (flag2 || (checkSunroof && sunroofOpen) || (checkWindows && flag3) || (windshieldCheck && windshieldBroken)))
			{
				return false;
			}
			if (IsPlayerInPickupBounds(playerScript, pickupScript) && !flag)
			{
				return false;
			}
			return true;
		}

		public static bool IsPlayerNearPickup(PlayerControllerB playerScript, HaulerController pickupScript)
		{
			//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((VehicleController)pickupScript).mainRigidbody.position;
			Vector3 position2 = ((Component)playerScript).transform.position;
			return Vector3.Distance(position2, position) <= 10f;
		}
	}
}
namespace CompanyHauler.Behaviour
{
	public class HaulerCameraManager : MonoBehaviour
	{
		public HaulerController mainController = null;

		public MeshRenderer leftMirrorMesh = null;

		public MeshRenderer rightMirrorMesh = null;

		public MeshRenderer[] meshMirrors = null;

		public Camera[] cameraMirrors = null;

		public float cameraFramerate;

		public int camerasToRenderPerFrame = 1;

		private float elapsed;

		private int nextCameraToRender = 0;

		private float cameraRenderCountRemainder = 0f;

		public void LateUpdate()
		{
			if ((Object)(object)mainController == (Object)null || !((NetworkBehaviour)mainController).IsSpawned || ((VehicleController)mainController).carDestroyed)
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return;
			}
			for (int i = 0; i < cameraMirrors.Length; i++)
			{
				if (!((Object)(object)cameraMirrors[i] == (Object)null))
				{
					((Behaviour)cameraMirrors[i]).enabled = false;
				}
			}
			if (!UserConfig.haulerMirror.Value || !VehicleUtils.IsPlayerSeatedInPickup(localPlayerController, mainController))
			{
				((Renderer)leftMirrorMesh).enabled = false;
				((Renderer)rightMirrorMesh).enabled = false;
				return;
			}
			elapsed += Time.deltaTime;
			if (elapsed < 1f / cameraFramerate)
			{
				return;
			}
			elapsed = 0f;
			((Renderer)leftMirrorMesh).enabled = true;
			((Renderer)rightMirrorMesh).enabled = true;
			int num = 0;
			for (int j = 0; j < cameraMirrors.Length; j++)
			{
				if (((Renderer)(object)meshMirrors[j]).IsVisibleToPlayersLocalCamera(localPlayerController.gameplayCamera))
				{
					num++;
				}
			}
			float num2 = (float)camerasToRenderPerFrame * (float)num / (float)cameraMirrors.Length;
			cameraRenderCountRemainder += num2;
			int num3 = (nextCameraToRender + cameraMirrors.Length - 1) % cameraMirrors.Length;
			while (cameraRenderCountRemainder >= 0f)
			{
				if (((Renderer)(object)meshMirrors[nextCameraToRender]).IsVisibleToPlayersLocalCamera(localPlayerController.gameplayCamera))
				{
					((Behaviour)cameraMirrors[nextCameraToRender]).enabled = true;
					cameraRenderCountRemainder -= 1f;
				}
				nextCameraToRender = (nextCameraToRender + 1) % cameraMirrors.Length;
				if (nextCameraToRender == num3)
				{
					break;
				}
			}
		}
	}
}
namespace CompanyHauler.Scripts
{
	public class HaulerAnimationEvents : MonoBehaviour
	{
		public HaulerController haulerController = null;

		public void OnSunroofOpen()
		{
			haulerController.sunroofOpen = true;
		}

		public void OnSunroofClose()
		{
			haulerController.sunroofOpen = false;
		}
	}
	public class HaulerController : VehicleController
	{
		[Header("DEBUG")]
		public bool isInTestMode = false;

		public float debugMotorTorque;

		public float debugBrakeTorque;

		public float debugSteeringAngle;

		[Header("Networking")]
		private bool receivedSyncData;

		public Vector2 syncedMoveInputVector;

		public bool syncedDrivePedalPressed;

		public bool syncedBrakePedalPressed;

		internal bool syncedTyreSlipping;

		internal float syncedTyreStress;

		internal float syncedEngineRPM;

		internal float syncedFrontWheelRPM;

		internal float syncedBackWheelRPM;

		internal float syncedWheelRPM;

		internal int syncedCarHP;

		internal float syncEffectsInterval;

		internal float syncTorqueInterval;

		internal float syncDrivetrainInterval;

		internal float syncedSteeringWheelRotation;

		internal float syncedCurrentMotorTorque;

		internal float syncedCurrentBrakeTorque;

		private float syncedSongTime;

		[Header("Player")]
		public HaulerPhysicsRegion vehicleZone = null;

		public HaulerPlayerZone vehicleCabZone = null;

		public PlayerControllerB lastDriver = null;

		public PlayerControllerB playerWhoShifted = null;

		public PlayerControllerB? currentBackLeftPassenger = null;

		public PlayerControllerB? currentBackMiddlePassenger = null;

		public PlayerControllerB? currentBackRightPassenger = null;

		public HaulerSeatAnimator frontLeftSeat = null;

		public HaulerSeatAnimator frontRightSeat = null;

		public HaulerSeatAnimator backLeftSeat = null;

		public HaulerSeatAnimator backSeat = null;

		public HaulerSeatAnimator backRightSeat = null;

		public Transform[] backLeftExitPoints = null;

		public Transform[] backRightExitPoints = null;

		public AnimatedObjectTrigger backLeftDoor = null;

		public AnimatedObjectTrigger backRightDoor = null;

		public InteractTrigger backLeftDoorTrigger = null;

		public InteractTrigger backRightDoorTrigger = null;

		public InteractTrigger backLeftPassengerSeatTrigger = null;

		public InteractTrigger backPassengerSeatTrigger = null;

		public InteractTrigger backRightPassengerSeatTrigger = null;

		public bool localPlayerInBackLeftPassengerSeat;

		public bool localPlayerInMiddlePassengerSeat;

		public bool localPlayerInBackRightPassengerSeat;

		[Header("Physics")]
		public HaulerWheelCollider frontLeftWheel = null;

		public HaulerWheelCollider frontRightWheel = null;

		public HaulerWheelCollider backLeftWheel = null;

		public HaulerWheelCollider backRightWheel = null;

		public HaulerCollisionTrigger collisionTrigger = null;

		public float timeSinceLastCollision;

		public List<WheelCollider> allWheels = null;

		public WheelHit[] wheelHits = (WheelHit[])(object)new WheelHit[4];

		public Rigidbody playerPhysicsBody = null;

		public AnimationCurve steeringCurve = null;

		public Vector3 previousVehiclePosition;

		public Quaternion previousVehicleRotation;

		public AnimationCurve engineCurve = null;

		public AnimationCurve enginePowerCurve = null;

		public float torqueBoost = 1.25f;

		public float enginePower;

		public float engineReversePower;

		public bool forwardSlipping;

		public bool sidewaySlipping;

		public Coroutine shiftGearCoroutine = null;

		public float[] gearRatios = null;

		public float diffRatio;

		public int currentGear;

		public float upShiftThreshold;

		public float downShiftThreshold;

		public float lastShiftTime;

		public float shiftCooldown;

		public float shiftTime;

		public float steeringWheelAnimValue;

		public float normalisedCarHP;

		public float currentSteeringWheelAnimValue;

		public float steeringReturnSpeed;

		public float steeringSpeed;

		public float carDeacceleration;

		public float minTorque;

		public float maxReverseTorque;

		public float maxForwardTorque;

		public float inclineBoost;

		public float minInclineBoost;

		public float maxInclineBoost;

		public float maxInclineBoostAngle = 32f;

		public bool allowBoostTorque;

		public float forwardBoostSpeed;

		public float reverseBoostSpeed;

		public float boostReturnSpeed;

		public float boostMultiplierLimit;

		public float forwardBoostThreshold;

		public float reverseBoostThreshold;

		public float boostMultiplier;

		public float reverseCarAcceleration;

		public float brakeAcceleration;

		public float maxBrakeTorque;

		public float maxParkingBrakeTorque;

		public float currentMotorTorque;

		public float currentBrakeTorque;

		public float steeringAngle;

		public float maxSteeringAngle;

		public float forwardWheelSpeed;

		public float reverseWheelSpeed;

		public float fRpmDiff;

		public float bRpmDiff;

		public float frontWheelsRPM;

		public float backWheelsRPM;

		public float wheelRPM;

		public float frontWheelRPM;

		public float backWheelRPM;

		public bool backWheelsGrounded;

		public bool allWheelsGrounded;

		public bool allWheelsAirborne;

		public float forwardsSlip;

		public float sidewaysSlip;

		public bool hasDeliveredVehicle;

		[Header("VFX")]
		public TextMeshPro radioScreen = null;

		private Coroutine radioOnCoroutine = null;

		public Collider[] weatherEffectBlockers = null;

		public InteractTrigger startIgnitionTrigger = null;

		public InteractTrigger stopIgnitionTrigger = null;

		public Animator ignitionAnimator = null;

		public GameObject carKeyContainer = null;

		public GameObject keyItemHolder = null;

		public Transform ignitionKeyPosition = null;

		private Vector3 ignitionKeyScale = new Vector3(1f, 1f, 1f);

		private Vector3 keyPosLocal = new Vector3(0.05029682f, 0.1181492f, -0.09794867f);

		private Vector3 keyPosServer = new Vector3(0.0414306f, 0.09218378f, -0.09290992f);

		private Vector3 keyRotLocal = new Vector3(29.962f, -2.063f, -3.106f);

		private Vector3 keyRotServer = new Vector3(29.427f, -5.158f, -53.66f);

		public HaulerWindow frontLeftWindow = null;

		public HaulerWindow frontRightWindow = null;

		public HaulerWindow backLeftWindow = null;

		public HaulerWindow backRightWindow = null;

		public Material needleOnMaterial = null;

		public Material needleOffMaterial = null;

		public Material tachometerOnMaterial = null;

		public Material tachometerOffMaterial = null;

		public Material speedometerOnMaterial = null;

		public Material speedometerOffMaterial = null;

		public GameObject gaugeLightContainer = null;

		public Image speedometerImage = null;

		public Image tachometerImage = null;

		public MeshRenderer speedometerMesh = null;

		public MeshRenderer tachometerMesh = null;

		public Transform speedometerTransform = null;

		public Transform tachometerTransform = null;

		public float speedometerFloat;

		public float tachometerFloat;

		private Coroutine dashboardSweepCoroutine = null;

		private int currentSweepStage;

		private bool hasSweepedDashboard;

		public SpriteRenderer tractionControlSymbol = null;

		private bool tractionControlLightActive;

		public SpriteRenderer checkEngineSymbol = null;

		private bool hasPlayedCheckEngineWarning;

		private bool checkEngineLightActive;

		public SpriteRenderer coolantLevelSymbol = null;

		private bool coolantLevelLightActive;

		public SpriteRenderer immobiliserSymbol = null;

		public SpriteRenderer leftSignalSymbol = null;

		public SpriteRenderer hazardSignalSymbol = null;

		public SpriteRenderer rightSignalSymbol = null;

		public SpriteRenderer dippedBeamSymbol = null;

		private bool dippedBeamLightActive;

		public SpriteRenderer mainBeamSymbol = null;

		private bool mainBeamLightActive;

		public SpriteRenderer oilLevelSymbol = null;

		private bool oilLevelLightActive;

		public SpriteRenderer parkingBrakeSymbol = null;

		private bool parkingBrakeLightActive;

		public SpriteRenderer batteryLowSymbol = null;

		private bool batteryLowLightActive;

		public bool brakeLightsOn;

		public GameObject centerMountedLightContainer = null;

		public MeshRenderer centerMountedLight = null;

		public Material backLightOffMat = null;

		public Transform tempPushTransform = null;

		public MeshRenderer windshieldMesh = null;

		public AnimatedObjectTrigger windowWipers = null;

		public bool automaticWipersOn;

		public bool tailgateOpen;

		public bool sunroofOpen;

		public bool isCabinLightToggled;

		public float playerSteeringWheelAnimFloat;

		public float syncedPlayerSteeringAnim;

		public float shiftSpeed = 25f;

		public bool gaugesOn;

		public bool headlampsOn;

		public bool disableAnimations;

		public bool inIgnitionAnimation;

		public bool ignitionOn;

		public bool twistingKey;

		internal const string STEERING_WHEEL_SPEED = "steeringWheelTurnSpeed";

		internal const string ANIMATION_SPEED = "animationSpeed";

		internal const string IGNITION_ANIM = "SAIgnition_Anim";

		internal const string CAR_ANIM = "SA_CarAnim";

		internal const string JUMP_WHILE_IN_CAR = "SA_JumpInCar";

		internal const string CAR_MOTION_TIME = "SA_CarMotionTime";

		private readonly string DOOR_ENTER_HOVERTIP = "Use door : [LMB]";

		private readonly string DOOR_EXIT_HOVERTIP = "Exit : [LMB]";

		private readonly string PLAYER_MOVEMENT = "Move";

		[Header("Destruction")]
		public GameObject[] disableOnDestroy = null;

		public GameObject mainBodyContainer = null;

		public GameObject sunroofContainer = null;

		public GameObject hoodDoorContainer = null;

		public GameObject frontLeftDoorContainer = null;

		public GameObject frontRightDoorContainer = null;

		public GameObject backLeftDoorContainer = null;

		public GameObject backRightDoorContainer = null;

		[Header("Audio")]
		public AudioSource roofRainAudio = null;

		public AudioSource cabinAudio = null;

		public AudioClip ignitionChime = null;

		public AudioClip chimeSoundWarning = null;

		public AudioSource carKeyAudio = null;

		public AudioClip dashButtonPress = null;

		public AudioSource windshieldAudio = null;

		public AudioSource roofInteractionAudio = null;

		public AudioSource leftDashboardAudio = null;

		public AudioSource centerDashboardAudio = null;

		public AudioSource rightDashboardAudio = null;

		public bool roofRainAudioActive;

		public bool hasPlayedIgnitionChime;

		public float timeLastSyncedRadio;

		public float radioPingTimestamp;

		public void OnEnable()
		{
			VehicleUtils.pickupController = this;
		}

		public void Awake()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			base.ragdollPhysicsBody.interpolation = (RigidbodyInterpolation)1;
			base.windwiperPhysicsBody1.interpolation = (RigidbodyInterpolation)1;
			base.windwiperPhysicsBody2.interpolation = (RigidbodyInterpolation)1;
			playerPhysicsBody.interpolation = (RigidbodyInterpolation)0;
			playerPhysicsBody.freezeRotation = true;
			base.backDoorOpen = true;
			((VehicleController)this).Awake();
			((PlayerPhysicsRegion)vehicleZone).priority = 1;
			base.syncedPosition = ((Component)this).transform.position;
			base.syncedRotation = ((Component)this).transform.rotation;
			InitializePickup();
		}

		public void SetBackDoorOpen(bool open)
		{
			tailgateOpen = open;
		}

		public void Start()
		{
			//IL_011d: 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_0136: 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)
			((MonoBehaviour)this).StartCoroutine(SetRainCollision());
			if (maxBrakeTorque > maxParkingBrakeTorque)
			{
				maxBrakeTorque = maxParkingBrakeTorque - 100f;
			}
			base.carHP = base.baseCarHP;
			base.FrontLeftWheel.brakeTorque = maxParkingBrakeTorque;
			base.FrontRightWheel.brakeTorque = maxParkingBrakeTorque;
			base.BackLeftWheel.brakeTorque = maxParkingBrakeTorque;
			base.BackRightWheel.brakeTorque = maxParkingBrakeTorque;
			base.currentRadioClip = new Random(StartOfRound.Instance.randomMapSeed).Next(0, base.radioClips.Length);
			base.radioAudio.clip = base.radioClips[base.currentRadioClip];
			base.decals = (DecalProjector[])(object)new DecalProjector[24];
			if (StartOfRound.Instance.inShipPhase)
			{
				base.magnetedToShip = true;
				base.loadedVehicleFromSave = true;
				hasDeliveredVehicle = true;
				base.inDropshipAnimation = false;
				base.hasBeenSpawned = true;
				SetVehicleKinematic(setKinematic: true);
				((Component)this).transform.position = StartOfRound.Instance.magnetPoint.position + StartOfRound.Instance.magnetPoint.forward * 7f;
				StartMagneting();
			}
		}

		public void SendClientSyncData()
		{
			//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_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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			if (base.magnetedToShip)
			{
				Vector3 eulerAngles = ((Quaternion)(ref base.magnetTargetRotation)).eulerAngles;
				MagnetCarRpc(base.magnetTargetPosition, eulerAngles, base.magnetStartPosition, base.magnetStartRotation, RoundManager.Instance.tempTransform.eulerAngles, base.averageVelocityAtMagnetStart);
			}
		}

		public IEnumerator SetRainCollision()
		{
			yield return (object)new WaitForSeconds(4f);
			ParticleSystem[] particleTriggers = (ParticleSystem[])(object)new ParticleSystem[13]
			{
				References.rainParticles,
				References.rainHitParticles,
				References.stormyRainParticles,
				References.stormyRainHitParticles,
				References.wesleyHurricaneRainParticles,
				References.wesleyHurricaneRainHitParticles,
				References.wesleyHurricaneSandParticles,
				References.wesleyForsakenRainParticles,
				References.wesleyForsakenRainHitParticles,
				References.kenjiAcidRainParticles,
				References.kenjiAcidRainHitParticles,
				References.kenjiAcidStormyRainParticles,
				References.kenjiAcidStormyRainHitParticles
			};
			for (int i = 0; i < particleTriggers.Length; i++)
			{
				if ((Object)(object)particleTriggers[i] == (Object)null)
				{
					Plugin.LogDebug("Weather particle or Trigger is null!");
					continue;
				}
				TriggerModule trigger = particleTriggers[i].trigger;
				for (int j = 0; j < weatherEffectBlockers.Length; j++)
				{
					int index = ((TriggerModule)(ref trigger)).colliderCount + j;
					((TriggerModule)(ref trigger)).SetCollider(index, (Component)(object)weatherEffectBlockers[j]);
				}
				trigger = default(TriggerModule);
			}
		}

		public void ChangeGear_Forward(CallbackContext context)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			if (((CallbackContext)(ref context)).performed && base.localPlayerInControl)
			{
				int num = (int)base.gear;
				if (num < 3)
				{
					ShiftToGearAndSync(num + 1);
				}
			}
		}

		public void ChangeGear_Backward(CallbackContext context)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			if (((CallbackContext)(ref context)).performed && base.localPlayerInControl)
			{
				int num = (int)base.gear;
				if (num > 1)
				{
					ShiftToGearAndSync(num - 1);
				}
			}
		}

		public void ShiftToGearAndSync(int setGear)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_004a: 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: Invalid comparison between I4 and Unknown
			if ((int)base.gear != setGear)
			{
				base.timeAtLastGearShift = Time.realtimeSinceStartup;
				playerWhoShifted = GameNetworkManager.Instance.localPlayerController;
				int num = 0;
				if (setGear != 3)
				{
					num = ((setGear > (int)base.gear) ? 1 : 2);
				}
				base.gear = (CarGearShift)setGear;
				base.gearStickAudio.PlayOneShot(base.gearStickAudios[num]);
				ShiftToGearRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, setGear, num);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ShiftToGearRpc(int playerId, int setGear, int gearIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0090: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3646988633u, val3, val, (SendTo)5, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					BytePacker.WriteValueBitPacked(val2, setGear);
					BytePacker.WriteValueBitPacked(val2, gearIndex);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 3646988633u, val3, val, (SendTo)5, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					base.timeAtLastGearShift = Time.realtimeSinceStartup;
					playerWhoShifted = StartOfRound.Instance.allPlayerScripts[playerId];
					base.gear = (CarGearShift)setGear;
					base.gearStickAudio.PlayOneShot(base.gearStickAudios[gearIndex]);
				}
			}
		}

		public void SetFrontCabinLightOn(bool setOn)
		{
			if (!setOn || !isCabinLightToggled)
			{
				base.frontCabinLightContainer.SetActive(setOn);
				((Renderer)base.frontCabinLightMesh).material = (setOn ? base.headlightsOnMat : base.headlightsOffMat);
			}
		}

		public void ToggleCabinLights()
		{
			ToggleCabinLightsOwnerRpc();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ToggleCabinLightsOwnerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1606966662u, val3, val, (SendTo)0, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1606966662u, val3, val, (SendTo)0, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					isCabinLightToggled = !isCabinLightToggled;
					ToggleCabinLightsLocalClient(isCabinLightToggled, ignitionOn);
					ToggleCabinLightsRpc(isCabinLightToggled, ignitionOn);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ToggleCabinLightsRpc(bool setToggle, bool isIgnitionOn)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(559298925u, val3, val, (SendTo)5, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setToggle, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val2, 559298925u, val3, val, (SendTo)5, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					isCabinLightToggled = setToggle;
					ToggleCabinLightsLocalClient(isCabinLightToggled, isIgnitionOn);
				}
			}
		}

		public void ToggleCabinLightsLocalClient(bool setToggle, bool isIgnitionOn)
		{
			if (setToggle)
			{
				SetFrontCabinLightOn(setOn: false);
			}
			else
			{
				SetFrontCabinLightOn(isIgnitionOn);
			}
		}

		public void StartTryCarIgnition()
		{
			if (base.localPlayerInControl && !base.ignitionStarted && !inIgnitionAnimation && (!inIgnitionAnimation || !startIgnitionTrigger.isBeingHeldByPlayer))
			{
				CancelIgnitionCoroutine();
				disableAnimations = true;
				inIgnitionAnimation = true;
				base.keyIgnitionCoroutine = ((MonoBehaviour)this).StartCoroutine(TryIgnition(isLocalDriver: true));
				TryIgnitionRpc(base.keyIsInIgnition, ignitionOn);
			}
		}

		private IEnumerator TryIgnition(bool isLocalDriver)
		{
			if ((Object)(object)base.currentDriver == (Object)null)
			{
				base.keyIgnitionCoroutine = null;
				yield break;
			}
			if (base.keyIsInIgnition)
			{
				SetIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: true);
				base.currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 12);
				ignitionAnimator.SetInteger("SAIgnition_Anim", 12);
				yield return (object)new WaitForSeconds(0.02f);
				carKeyAudio.PlayOneShot(base.twistKey);
				SetIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.1467f);
			}
			else
			{
				SetIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: false);
				base.currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 2);
				ignitionAnimator.SetInteger("SAIgnition_Anim", 2);
				yield return (object)new WaitForSeconds(0.6f);
				carKeyAudio.PlayOneShot(base.insertKey);
				SetIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.2f);
				carKeyAudio.PlayOneShot(base.twistKey);
				SetIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.18f);
			}
			SetIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
			if (!isLocalDriver)
			{
				yield break;
			}
			bool shiftInterlock = (int)base.gear == 3;
			if (shiftInterlock)
			{
				PlayIgnitionAudio();
			}
			ignitionOn = true;
			if (dashboardSweepCoroutine == null && !hasSweepedDashboard)
			{
				dashboardSweepCoroutine = ((MonoBehaviour)this).StartCoroutine(DashboardSweepCoroutine());
			}
			SetIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
			SetFrontCabinLightOn(ignitionOn);
			SetDashboardGaugesOn(on: true);
			TryStartIgnitionRpc(shiftInterlock);
			if (!shiftInterlock)
			{
				yield break;
			}
			yield return (object)new WaitForSeconds(Random.Range(0.7f, 1.4f));
			if ((float)Random.Range(0, 100) < base.chanceToStartIgnition)
			{
				inIgnitionAnimation = false;
				ignitionOn = true;
				PlayerControllerB currentDriver = base.currentDriver;
				if (currentDriver != null)
				{
					currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 1);
				}
				SetIgnitionValues(keyTwisting: false, keyInHand: false, keyInSlot: true);
				SetIgnition(setStarted: true, setCabinLight: true);
				SetFrontCabinLightOn(ignitionOn);
				SetDashboardGaugesOn(on: true);
				CancelIgnitionAnimation(ignitionOn: true, setIgnitionAnim: true);
				StartIgnitionRpc();
			}
			else
			{
				base.chanceToStartIgnition += 14f;
				base.chanceToStartIgnition = Mathf.Clamp(base.chanceToStartIgnition, 0f, 101f);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TryIgnitionRpc(bool setKeyInSlot, bool isIgnitionOn)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1565903847u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1565903847u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!base.ignitionStarted)
			{
				CancelIgnitionCoroutine();
				disableAnimations = true;
				inIgnitionAnimation = true;
				SetIgnitionValues(keyTwisting: false, keyInHand: false, setKeyInSlot);
				if (ignitionOn != isIgnitionOn)
				{
					ignitionOn = isIgnitionOn;
					SetFrontCabinLightOn(ignitionOn);
				}
				base.keyIgnitionCoroutine = ((MonoBehaviour)this).StartCoroutine(TryIgnition(isLocalDriver: false));
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TryStartIgnitionRpc(bool shiftInterlock)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00a0: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1377561967u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref shiftInterlock, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1377561967u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (shiftInterlock)
				{
					PlayIgnitionAudio();
				}
				ignitionOn = true;
				if (dashboardSweepCoroutine == null && !hasSweepedDashboard)
				{
					dashboardSweepCoroutine = ((MonoBehaviour)this).StartCoroutine(DashboardSweepCoroutine());
				}
				SetIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				SetFrontCabinLightOn(ignitionOn);
				SetDashboardGaugesOn(on: true);
			}
		}

		private void PlayIgnitionAudio()
		{
			if (!hasPlayedIgnitionChime)
			{
				hasPlayedIgnitionChime = true;
				cabinAudio.Play();
			}
			base.engineAudio1.Stop();
			base.engineAudio1.clip = base.revEngineStart;
			base.engineAudio1.volume = 0.7f;
			base.engineAudio1.PlayOneShot(base.engineRev);
			base.carEngine1AudioActive = true;
			base.engineAudio1.pitch = 1f;
		}

		public void CancelTryCarIgnition()
		{
			if (base.localPlayerInControl && !base.ignitionStarted && inIgnitionAnimation && (inIgnitionAnimation || !startIgnitionTrigger.isBeingHeldByPlayer))
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				int integer = localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim");
				if (integer == 0 && base.keyIsInIgnition)
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 13);
				}
				else if ((integer == 2 || integer == 12) && base.keyIsInIgnition)
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 3);
				}
				else
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				}
				int integer2 = localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim");
				CancelIgnitionAnimation(ignitionOn: false, setIgnitionAnim: false);
				disableAnimations = true;
				inIgnitionAnimation = false;
				int num = integer2;
				if (integer == 13)
				{
					num = 3;
				}
				ignitionAnimator.SetInteger("SAIgnition_Anim", num);
				CancelTryIgnitionRpc(base.keyIsInIgnition, ignitionOn, integer2, num);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CancelTryIgnitionRpc(bool setKeyInSlot, bool isIgnitionOn, int playerAnimIndex, int ignitionAnimIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4062380867u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, playerAnimIndex);
				BytePacker.WriteValueBitPacked(val2, ignitionAnimIndex);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 4062380867u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			CancelIgnitionAnimation(ignitionOn: false, setIgnitionAnim: false);
			disableAnimations = true;
			inIgnitionAnimation = false;
			PlayerControllerB currentDriver = base.currentDriver;
			if (currentDriver != null)
			{
				currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", playerAnimIndex);
			}
			ignitionAnimator.SetInteger("SAIgnition_Anim", ignitionAnimIndex);
			if (setKeyInSlot && !base.keyIsInIgnition)
			{
				carKeyAudio.PlayOneShot(base.insertKey);
			}
			SetIgnitionValues(keyTwisting: false, keyInHand: false, setKeyInSlot);
			SetDashboardGaugesOn(isIgnitionOn);
			if (ignitionOn != isIgnitionOn)
			{
				ignitionOn = isIgnitionOn;
				SetFrontCabinLightOn(ignitionOn);
				if (dashboardSweepCoroutine == null && !hasSweepedDashboard)
				{
					dashboardSweepCoroutine = ((MonoBehaviour)this).StartCoroutine(DashboardSweepCoroutine());
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartIgnitionRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2218070621u, val3, val, (SendTo)5, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2218070621u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				disableAnimations = false;
				inIgnitionAnimation = false;
				PlayerControllerB currentDriver = base.currentDriver;
				if (currentDriver != null)
				{
					currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 1);
				}
				SetIgnitionValues(keyTwisting: false, keyInHand: false, keyInSlot: true);
				SetIgnition(setStarted: true, setCabinLight: true);
				SetFrontCabinLightOn(ignitionOn);
				SetDashboardGaugesOn(on: true);
				CancelIgnitionAnimation(ignitionOn: true, setIgnitionAnim: true);
			}
		}

		public void SetIgnition(bool setStarted, bool setCabinLight)
		{
			SetFrontCabinLightOn(setCabinLight);
			base.carEngine1AudioActive = setStarted;
			if (setStarted)
			{
				disableAnimations = false;
				inIgnitionAnimation = false;
				base.startKeyIgnitionTrigger.SetActive(false);
				base.removeKeyIgnitionTrigger.SetActive(true);
				if (setStarted != base.ignitionStarted)
				{
					base.ignitionStarted = true;
					base.carExhaustParticle.Play();
					base.engineAudio1.Stop();
					base.engineAudio1.PlayOneShot(base.engineStartSuccessful);
					base.engineAudio1.clip = base.engineRun;
				}
			}
			else
			{
				base.startKeyIgnitionTrigger.SetActive(true);
				base.removeKeyIgnitionTrigger.SetActive(false);
				base.ignitionStarted = false;
				base.carExhaustParticle.Stop(true, (ParticleSystemStopBehavior)1);
			}
		}

		public void RemoveKeyFromIgnition()
		{
			if (base.localPlayerInControl && base.ignitionStarted && !inIgnitionAnimation)
			{
				CancelIgnitionCoroutine();
				base.keyIgnitionCoroutine = ((MonoBehaviour)this).StartCoroutine(RemoveKey());
				base.chanceToStartIgnition = 10f;
				RemoveKeyFromIgnitionRpc();
			}
		}

		private IEnumerator RemoveKey()
		{
			disableAnimations = true;
			inIgnitionAnimation = false;
			PlayerControllerB currentDriver = base.currentDriver;
			if (currentDriver != null)
			{
				currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 6);
			}
			ignitionAnimator.SetInteger("SAIgnition_Anim", 6);
			yield return (object)new WaitForSeconds(0.28f);
			SetIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: false);
			carKeyAudio.PlayOneShot(base.removeKey);
			SetIgnition(setStarted: false, setCabinLight: false);
			ignitionOn = false;
			hasPlayedIgnitionChime = false;
			CancelDashboardSweep();
			SetDashboardGaugesOn(on: false);
			yield return (object)new WaitForSeconds(0.73f);
			SetIgnitionValues(keyTwisting: false, keyInHand: false, keyInSlot: false);
			base.keyIgnitionCoroutine = null;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void RemoveKeyFromIgnitionRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2004876350u, val3, val, (SendTo)5, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2004876350u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (base.ignitionStarted)
				{
					CancelIgnitionCoroutine();
					base.keyIgnitionCoroutine = ((MonoBehaviour)this).StartCoroutine(RemoveKey());
				}
			}
		}

		public void CancelIgnitionAnimation(bool ignitionOn, bool setIgnitionAnim)
		{
			CancelIgnitionCoroutine();
			base.carEngine1AudioActive = ignitionOn;
			twistingKey = false;
			base.keyIsInDriverHand = false;
			if (setIgnitionAnim)
			{
				ignitionAnimator.SetInteger("SAIgnition_Anim", ignitionOn ? 1 : 0);
			}
		}

		internal void CancelIgnitionCoroutine()
		{
			if (base.keyIgnitionCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(base.keyIgnitionCoroutine);
				base.keyIgnitionCoroutine = null;
			}
		}

		public void SetIgnitionValues(bool keyTwisting, bool keyInHand, bool keyInSlot)
		{
			twistingKey = keyTwisting;
			base.keyIsInDriverHand = keyInHand;
			base.keyIsInIgnition = keyInSlot;
		}

		public void SetTriggerHoverTip(InteractTrigger trigger, string tip)
		{
			trigger.hoverTip = tip;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CancelSetPlayerInVehicleRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2486552702u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2486552702u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerId];
				if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)val4))
				{
					InteractTriggerPatches.CancelVehicleSeatInteraction();
				}
			}
		}

		public void SetDriverInVehicle()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			SetDriverInVehicleServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetDriverInVehicleServerRpc(int playerId, RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2635849284u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2635849284u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId];
				if ((Object)(object)val3 == (Object)null || val3.isPlayerDead || !val3.isPlayerControlled || (Object)(object)base.currentDriver != (Object)null)
				{
					CancelSetPlayerInVehicleRpc(playerId);
					return;
				}
				base.currentDriver = val3;
				((NetworkBehaviour)this).NetworkObject.ChangeOwnership(rpcParams.Receive.SenderClientId);
				SetDriverInVehicleOwnerRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetDriverInVehicleOwnerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0085: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3992045072u, val3, val, (SendTo)0, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3992045072u, val3, val, (SendTo)0, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				((VehicleSeatAnimator)frontLeftSeat).SetLocalPlayerIntoSeat();
				disableAnimations = !base.ignitionStarted;
				inIgnitionAnimation = false;
				ActivateControl();
				SetTriggerHoverTip(base.driverSideDoorTrigger, DOOR_EXIT_HOVERTIP);
				startIgnitionTrigger.isBeingHeldByPlayer = false;
				stopIgnitionTrigger.isBeingHeldByPlayer = false;
				CancelIgnitionCoroutine();
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetFloat("animationSpeed", 0.5f);
				playerSteeringWheelAnimFloat = 0.5f;
				syncedPlayerSteeringAnim = 0.5f;
				if (base.ignitionStarted)
				{
					GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 1);
				}
				else
				{
					GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				}
				int integer = GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim");
				if (base.driverSideDoor.boolValue)
				{
					base.driverSideDoor.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
				if (!base.setControlTips)
				{
					base.setControlTips = true;
					HUDManager.Instance.ChangeControlTipMultiple(base.carTooltips, false, (Item)null);
				}
				SetDriverInVehicleNotOwnerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, ignitionOn, base.keyIsInIgnition, base.ignitionStarted, integer);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetDriverInVehicleNotOwnerRpc(int playerId, bool isIgnitionOn, bool setKeyInSlot, bool setStarted, int playerAnimIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00c5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1813739882u, val3, val, (SendTo)1, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setStarted, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, playerAnimIndex);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1813739882u, val3, val, (SendTo)1, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerId];
				if ((Object)(object)val4 == (Object)null)
				{
					Plugin.LogError("SetDriverInVehicleNotOwnerRpc failed to find player object reference from player client id!");
					return;
				}
				base.currentDriver = val4;
				disableAnimations = !setStarted;
				inIgnitionAnimation = false;
				((VehicleSeatAnimator)frontLeftSeat).SetPlayerAnimations(val4, false);
				startIgnitionTrigger.isBeingHeldByPlayer = false;
				stopIgnitionTrigger.isBeingHeldByPlayer = false;
				CancelIgnitionCoroutine();
				val4.playerBodyAnimator.SetFloat("animationSpeed", 0.5f);
				playerSteeringWheelAnimFloat = 0.5f;
				syncedPlayerSteeringAnim = 0.5f;
				SetDashboardGaugesOn(gaugesOn);
				ignitionOn = isIgnitionOn;
				SetFrontCabinLightOn(isIgnitionOn);
				base.keyIsInIgnition = setKeyInSlot;
				base.ignitionStarted = setStarted;
				val4.playerBodyAnimator.SetInteger("SA_CarAnim", playerAnimIndex);
			}
		}

		public void OnDriverExitVehicle()
		{
			//IL_00ee: 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_00ff: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsSpawned && !((Object)(object)((NetworkBehaviour)this).NetworkManager == (Object)null) && ((NetworkBehaviour)this).NetworkManager.IsListening && !((Object)(object)base.currentDriver != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				base.localPlayerInControl = false;
				SetTriggerHoverTip(base.driverSideDoorTrigger, DOOR_ENTER_HOVERTIP);
				disableAnimations = !base.ignitionStarted;
				inIgnitionAnimation = false;
				startIgnitionTrigger.isBeingHeldByPlayer = false;
				stopIgnitionTrigger.isBeingHeldByPlayer = false;
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				DisableControl();
				CancelIgnitionAnimation(base.ignitionStarted, setIgnitionAnim: true);
				SetIgnition(base.ignitionStarted, ignitionOn);
				base.chanceToStartIgnition = 10f;
				base.syncedPosition = ((Component)this).transform.position;
				base.syncedRotation = ((Component)this).transform.rotation;
				OnDriverExitVehicleServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, base.syncedPosition, base.syncedRotation, base.keyIsInIgnition, base.ignitionStarted, ignitionOn);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnDriverExitVehicleServerRpc(int playerId, Vector3 carLocation, Quaternion carRotation, bool setKeyInSlot, bool engineStarted, bool isIgnitionOn)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Invalid comparison between Unknown and I4
			//IL_0043: 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_0051: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00b6: 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_00d1: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3156768623u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref carLocation);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref carRotation);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref engineStarted, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val2, 3156768623u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					OnDriverExitVehicleRpc(playerId, carLocation, carRotation, setKeyInSlot, engineStarted, isIgnitionOn);
					((NetworkBehaviour)this).NetworkObject.ChangeOwnership(0uL);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnDriverExitVehicleRpc(int playerId, Vector3 carLocation, Quaternion carRotation, bool setKeyInSlot, bool setStarted, bool isIgnitionOn)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_00a9: 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_00c4: 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_00df: 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_00f9: 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_012b: 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)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2002477769u, val3, val, (SendTo)1, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref carLocation);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref carRotation);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setStarted, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIgnitionOn, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2002477769u, val3, val, (SendTo)1, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = StartOfRound.Instance.allPlayerScripts[playerId];
			if ((Object)(object)val4 == (Object)null)
			{
				Plugin.LogError("OnDriverExitVehicleRpc failed to find player object reference from player client id!");
				return;
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val4)
			{
				Plugin.LogDebug("OnDriverExitVehicleRpc player argument was the previous occupant!");
				return;
			}
			base.syncedPosition = carLocation;
			base.syncedRotation = carRotation;
			base.drivePedalPressed = false;
			base.brakePedalPressed = false;
			base.currentDriver = null;
			((VehicleSeatAnimator)frontLeftSeat).ReturnPlayerAnimations(val4, false);
			base.keyIsInIgnition = setKeyInSlot;
			base.ignitionStarted = setStarted;
			if (setStarted && !base.carExhaustParticle.isEmitting)
			{
				base.carExhaustParticle.Play();
			}
			else if (!setStarted && base.carExhaustParticle.isEmitting)
			{
				base.carExhaustParticle.Stop(true, (ParticleSystemStopBehavior)1);
			}
			disableAnimations = !setStarted;
			inIgnitionAnimation = false;
			startIgnitionTrigger.isBeingHeldByPlayer = false;
			stopIgnitionTrigger.isBeingHeldByPlayer = false;
			CancelIgnitionAnimation(setStarted, setIgnitionAnim: true);
			SetIgnition(setStarted, isIgnitionOn);
			SetDashboardGaugesOn(isIgnitionOn);
			base.chanceToStartIgnition = 10f;
		}

		public void ExitDriverSideSeat()
		{
			//IL_00b2: 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)
			if (base.localPlayerInControl)
			{
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				int num = CanExitVehicle(base.driverSideExitPoints);
				if (num == 0 && !base.driverSideDoor.boolValue)
				{
					base.driverSideDoor.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
				if (num != -1)
				{
					GameNetworkManager.Instance.localPlayerController.TeleportPlayer(base.driverSideExitPoints[num].position, false, 0f, false, true);
				}
				else
				{
					GameNetworkManager.Instance.localPlayerController.TeleportPlayer(base.driverSideExitPoints[1].position, false, 0f, false, true);
				}
			}
		}

		public void SetPassengerInVehicle()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			SetPassengerInVehicleServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetPassengerInVehicleServerRpc(int playerId, RpcParams rpcParams = default(RpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: 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_005f: Unknown result type (might be due to invalid IL or missing