Decompiled source of Company Hauler v2.1.1

BepInEx/plugins/hauler/glojam.CompanyHauler.dll

Decompiled 2 hours 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.Scripts;
using CompanyHauler.Utils;
using GameNetcodeStuff;
using HarmonyLib;
using LethalMin;
using Microsoft.CodeAnalysis;
using ScandalsTweaks.Compatibility;
using ScandalsTweaks.Patches;
using ScandalsTweaks.Scripts;
using ScandalsTweaks.Utils;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;
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("ImmersiveVisor")]
[assembly: IgnoresAccessChecksTo("NoteBoxz.LethalMin")]
[assembly: IgnoresAccessChecksTo("scandal.scandalstweaks")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("glojam.CompanyHauler")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1+001c725ecc2d58bf480f9aec93c97422a3ef273c")]
[assembly: AssemblyProduct("CompanyHauler")]
[assembly: AssemblyTitle("glojam.CompanyHauler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.1.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.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			UserConfig.InitConfig();
			Patch();
			Logger.LogInfo((object)"glojam.CompanyHauler v2.1.1 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");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			if (IsModPresent("NoteBoxz.LethalMin"))
			{
				LethalMinCompatibility.PatchAllCompatibilityMethods(Harmony);
			}
			if (IsModPresent("ImmersiveVisor"))
			{
				ImmersiveVisorCompatibility.PatchAllCompatibilityMethods(Harmony);
			}
			Logger.LogDebug((object)"Finished patching!");
		}

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

		internal static bool IsModPresent(string name)
		{
			return Chainloader.PluginInfos.ContainsKey(name);
		}
	}
	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();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "glojam.CompanyHauler";

		public const string PLUGIN_NAME = "CompanyHauler";

		public const string PLUGIN_VERSION = "2.1.1";
	}
}
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 PlayerUtils
	{
		internal static bool disableAnimationSync;

		internal static bool isSeatedInPickup;
	}
	internal static class References
	{
		internal static ItemDropship itemShip;

		internal static HaulerController pickupController;
	}
	public static class VehicleUtils
	{
		public static bool IsEnemyInPickup(EnemyAI enemyScript, HaulerController pickupController)
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (((Collider)pickupController.collisionTrigger.insideTruckNavMeshBounds).ClosestPoint(((Component)enemyScript).transform.position) == ((Component)enemyScript).transform.position || ((Collider)pickupController.collisionTrigger.insideTruckNavMeshBounds).ClosestPoint(enemyScript.agent.destination) == enemyScript.agent.destination)
			{
				return true;
			}
			return false;
		}

		public static bool IsPlayerSeatedInPickup()
		{
			return PlayerUtils.isSeatedInPickup;
		}

		public static bool IsPlayerInPickupBounds(HaulerController pickupController)
		{
			return pickupController.vehicleZone.playerInZone;
		}

		public static bool IsPlayerInPickupCab(HaulerController pickupController)
		{
			return pickupController.vehicleCabZone.playerInZone;
		}

		public static bool IsSeatedPlayerProtected(PlayerControllerB playerController, HaulerController pickupController, bool checkSunroof = false, bool checkWindows = false, bool windshieldCheck = false, bool velocityCheck = false, float velocityMagnitude = 0f)
		{
			float magnitude = ((Vector3)(ref ((VehicleController)pickupController).averageVelocity)).magnitude;
			if (velocityCheck && magnitude > velocityMagnitude)
			{
				return true;
			}
			bool windshieldBroken = ((VehicleController)pickupController).windshieldBroken;
			bool sunroofOpen = pickupController.sunroofOpen;
			bool flag = (Object)(object)playerController == (Object)(object)((VehicleController)pickupController).currentDriver || (Object)(object)playerController == (Object)(object)((VehicleController)pickupController).currentPassenger;
			if ((checkSunroof && sunroofOpen) || (flag && windshieldCheck && windshieldBroken))
			{
				return false;
			}
			bool flag2 = ((VehicleController)pickupController).driverSideDoor.boolValue || (checkWindows && pickupController.frontLeftWindow.isWindowOpen);
			bool flag3 = ((VehicleController)pickupController).passengerSideDoor.boolValue || (checkWindows && pickupController.frontRightWindow.isWindowOpen);
			bool flag4 = pickupController.backLeftDoor.boolValue || (checkWindows && pickupController.backLeftWindow.isWindowOpen);
			bool flag5 = pickupController.backRightDoor.boolValue || (checkWindows && pickupController.backRightWindow.isWindowOpen);
			if (((Object)(object)playerController == (Object)(object)((VehicleController)pickupController).currentDriver && flag2) || ((Object)(object)playerController == (Object)(object)((VehicleController)pickupController).currentPassenger && flag3))
			{
				return false;
			}
			if (((Object)(object)playerController == (Object)(object)pickupController.currentBackLeftPassenger && flag4) || ((Object)(object)playerController == (Object)(object)pickupController.currentMiddlePassenger && (flag4 || flag5)) || ((Object)(object)playerController == (Object)(object)pickupController.currentBackRightPassenger && flag5))
			{
				return false;
			}
			return true;
		}

		public static bool IsPlayerProtectedByPickup(PlayerControllerB playerController, HaulerController pickupController, bool checkSunroof = false, bool checkWindows = false, bool windshieldCheck = false, bool velocityCheck = false, float velocityMagnitude = 0f)
		{
			if (((VehicleController)pickupController).carDestroyed)
			{
				return false;
			}
			float magnitude = ((Vector3)(ref ((VehicleController)pickupController).averageVelocity)).magnitude;
			if (velocityCheck && magnitude > velocityMagnitude)
			{
				return true;
			}
			bool windshieldBroken = ((VehicleController)pickupController).windshieldBroken;
			bool sunroofOpen = pickupController.sunroofOpen;
			bool flag = ((VehicleController)pickupController).driverSideDoor.boolValue || ((VehicleController)pickupController).passengerSideDoor.boolValue || pickupController.backLeftDoor.boolValue || pickupController.backRightDoor.boolValue;
			bool flag2 = pickupController.frontLeftWindow.isWindowOpen || pickupController.frontRightWindow.isWindowOpen || pickupController.backLeftWindow.isWindowOpen || pickupController.backRightWindow.isWindowOpen;
			bool tailgateOpen = pickupController.tailgateOpen;
			if ((IsPlayerInPickupCab(pickupController) && flag) || (checkSunroof && sunroofOpen) || (checkWindows && flag2) || (windshieldCheck && windshieldBroken))
			{
				return false;
			}
			if (IsPlayerInPickupBounds(pickupController) && !IsPlayerInPickupCab(pickupController))
			{
				return false;
			}
			return true;
		}

		public static bool IsPlayerNearPickup(PlayerControllerB playerController, HaulerController pickupController)
		{
			//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)pickupController).mainRigidbody.position;
			Vector3 position2 = ((Component)playerController).transform.position;
			if (Vector3.Distance(position2, position) > 10f)
			{
				return false;
			}
			return true;
		}
	}
}
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 || !PlayerUtils.isSeatedInPickup)
			{
				((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")]
		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;

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

		public HaulerPlayerZone vehicleCabZone = null;

		public PlayerControllerB lastDriver = null;

		public PlayerControllerB playerWhoShifted = null;

		public PlayerControllerB? currentBackLeftPassenger = null;

		public PlayerControllerB? currentMiddlePassenger = 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;

		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";

		[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 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 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 dashboardSymbolCoroutine = 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 MeshRenderer windshieldMesh = null;

		public AnimatedObjectTrigger windowWipers = null;

		public PlayAudioAnimationEvent windowWipersEvent = null;

		public bool automaticWipersOn;

		private string[] carTooltips = new string[3] { "Gas pedal: [W]", "Brake pedal: [S]", "Boost: [Space]" };

		public bool tailgateOpen;

		public bool sunroofOpen;

		public bool cabLightToggled;

		public float playerSteeringWheelAnimFloat;

		public float syncedPlayerSteeringAnim;

		public float shiftSpeed = 25f;

		public bool gaugesOn;

		public bool headlampsOn;

		public bool disableAnimations;

		public bool inIgnitionAnimation;

		public bool accessoryMode;

		public bool twistingKey;

		[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()
		{
			References.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;
			SetTruckStats();
		}

		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(SetCarRainCollisions());
			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 SetCarRainCollisions()
		{
			yield return (object)new WaitForSeconds(4f);
			ParticleSystem[] particleTriggers = (ParticleSystem[])(object)new ParticleSystem[9]
			{
				GlobalReferences.rainParticles,
				GlobalReferences.rainHitParticles,
				GlobalReferences.stormyRainParticles,
				GlobalReferences.stormyRainHitParticles,
				GlobalReferences.wesleyHurricaneRainParticles,
				GlobalReferences.wesleyHurricaneRainHitParticles,
				GlobalReferences.wesleyHurricaneSandParticles,
				GlobalReferences.wesleyForsakenRainParticles,
				GlobalReferences.wesleyForsakenRainHitParticles
			};
			for (int i = 0; i < particleTriggers.Length; i++)
			{
				if ((Object)(object)particleTriggers[i] == (Object)null)
				{
					Plugin.Logger.LogDebug((object)"Hauler: 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 || !cabLightToggled)
			{
				base.frontCabinLightContainer.SetActive(setOn);
				((Renderer)base.frontCabinLightMesh).material = (setOn ? base.headlightsOnMat : base.headlightsOffMat);
			}
		}

		public void ToggleCabinLights()
		{
			cabLightToggled = !cabLightToggled;
			ToggleCabinLightsLocalClient(cabLightToggled, accessoryMode);
			ToggleCabinLightsRpc(cabLightToggled, accessoryMode);
		}

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

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ToggleCabinLightsRpc(bool setToggle, bool accessoriesOnThisFrame)
		{
			//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 accessoriesOnThisFrame, 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;
					cabLightToggled = setToggle;
					ToggleCabinLightsLocalClient(cabLightToggled, accessoriesOnThisFrame);
				}
			}
		}

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

		private IEnumerator TryIgnition(bool isLocalDriver)
		{
			if ((Object)(object)base.currentDriver == (Object)null)
			{
				base.keyIgnitionCoroutine = null;
				yield break;
			}
			if (base.keyIsInIgnition)
			{
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: true);
				if (base.currentDriver.playerBodyAnimator.GetInteger("SA_CarAnim") == 3 || base.currentDriver.playerBodyAnimator.GetInteger("SA_CarAnim") == 13)
				{
					base.currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 2);
				}
				else
				{
					base.currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 12);
				}
				int animIndex = base.currentDriver.playerBodyAnimator.GetInteger("SA_CarAnim");
				ignitionAnimator.SetInteger("SAIgnition_Anim", animIndex);
				yield return (object)new WaitForSeconds(0.02f);
				carKeyAudio.PlayOneShot(base.twistKey);
				SetKeyIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.1467f);
			}
			else
			{
				PlayerControllerB currentDriver = base.currentDriver;
				if (currentDriver != null)
				{
					currentDriver.playerBodyAnimator.SetInteger("SA_CarAnim", 2);
				}
				ignitionAnimator.SetInteger("SAIgnition_Anim", 2);
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: false);
				yield return (object)new WaitForSeconds(0.6f);
				carKeyAudio.PlayOneShot(base.insertKey);
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.2f);
				carKeyAudio.PlayOneShot(base.twistKey);
				SetKeyIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				yield return (object)new WaitForSeconds(0.18f);
			}
			SetKeyIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
			if (!isLocalDriver)
			{
				yield break;
			}
			bool shiftInterlock = (int)base.gear == 3;
			if (shiftInterlock)
			{
				PlayIgnitionAudio();
			}
			accessoryMode = true;
			if (!hasSweepedDashboard && dashboardSymbolCoroutine == null)
			{
				dashboardSymbolCoroutine = ((MonoBehaviour)this).StartCoroutine(TryDashboardSweep());
			}
			SetKeyIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
			SetFrontCabinLightOn(accessoryMode);
			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;
				accessoryMode = true;
				PlayerControllerB currentDriver2 = base.currentDriver;
				if (currentDriver2 != null)
				{
					currentDriver2.playerBodyAnimator.SetInteger("SA_CarAnim", 1);
				}
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: false, keyInSlot: true);
				SetIgnition(started: true, cabLightOn: true);
				SetFrontCabinLightOn(accessoryMode);
				SetDashboardGaugesOn(on: true);
				CancelIgnitionAnimation(ignitionOn: true, setIgnitionAnim: true);
				StartIgnitionRpc();
			}
			else
			{
				base.chanceToStartIgnition += 14f;
				base.chanceToStartIgnition = Mathf.Clamp(base.chanceToStartIgnition, 0f, 99f);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TryIgnitionRpc(bool setKeyInSlot, bool accessoriesActive)
		{
			//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 accessoriesActive, 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;
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: false, setKeyInSlot);
				if (accessoryMode != accessoriesActive)
				{
					accessoryMode = accessoriesActive;
					SetFrontCabinLightOn(accessoryMode);
				}
				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();
				}
				accessoryMode = true;
				if (!hasSweepedDashboard && dashboardSymbolCoroutine == null)
				{
					dashboardSymbolCoroutine = ((MonoBehaviour)this).StartCoroutine(TryDashboardSweep());
				}
				SetKeyIgnitionValues(keyTwisting: true, keyInHand: true, keyInSlot: true);
				SetFrontCabinLightOn(accessoryMode);
				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 && base.keyIgnitionCoroutine != null && (base.keyIgnitionCoroutine != null || !startIgnitionTrigger.isBeingHeldByPlayer))
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim") == 2 && base.keyIsInIgnition)
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 3);
				}
				else if (localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim") == 12 && base.keyIsInIgnition)
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 3);
				}
				else
				{
					localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				}
				CancelIgnitionAnimation(ignitionOn: false, setIgnitionAnim: false);
				disableAnimations = true;
				inIgnitionAnimation = false;
				int integer = localPlayerController.playerBodyAnimator.GetInteger("SA_CarAnim");
				int num = integer;
				if (integer == 13)
				{
					num = 3;
				}
				ignitionAnimator.SetInteger("SAIgnition_Anim", num);
				CancelTryIgnitionRpc(base.keyIsInIgnition, accessoryMode, integer, num);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CancelTryIgnitionRpc(bool setKeyInSlot, bool accessoriesActive, 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 accessoriesActive, 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)
			{
				((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);
				}
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: false, setKeyInSlot);
				SetDashboardGaugesOn(accessoriesActive);
				if (accessoryMode != accessoriesActive)
				{
					accessoryMode = accessoriesActive;
					SetFrontCabinLightOn(accessoryMode);
				}
			}
		}

		[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);
				}
				SetKeyIgnitionValues(keyTwisting: false, keyInHand: false, keyInSlot: true);
				SetIgnition(started: true, cabLightOn: true);
				SetFrontCabinLightOn(accessoryMode);
				SetDashboardGaugesOn(on: true);
				CancelIgnitionAnimation(ignitionOn: true, setIgnitionAnim: true);
			}
		}

		public void SetIgnition(bool started, bool cabLightOn)
		{
			SetFrontCabinLightOn(cabLightOn);
			base.carEngine1AudioActive = started;
			if (started)
			{
				disableAnimations = false;
				inIgnitionAnimation = false;
				base.startKeyIgnitionTrigger.SetActive(false);
				base.removeKeyIgnitionTrigger.SetActive(true);
				if (started != 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);
			SetKeyIgnitionValues(keyTwisting: false, keyInHand: true, keyInSlot: false);
			carKeyAudio.PlayOneShot(base.removeKey);
			SetIgnition(started: false, cabLightOn: false);
			accessoryMode = false;
			hasPlayedIgnitionChime = false;
			CancelDashboardSweep();
			SetDashboardGaugesOn(on: false);
			yield return (object)new WaitForSeconds(0.73f);
			SetKeyIgnitionValues(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 SetKeyIgnitionValues(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 CancelSetPlayerInVehicleClientRpc(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(2613342545u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2613342545u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerId)
				{
					HUDManager.Instance.DisplayTip("Kicked from vehicle", "You have been forcefully kicked to prevent a softlock!", false, false, "LC_Tip1");
				}
			}
		}

		public void SetDriverInCar()
		{
			//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)
			SetDriverInCarServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetDriverInCarServerRpc(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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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(3575576769u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3575576769u, 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))
				{
					base.currentDriver = val3;
					((NetworkBehaviour)this).NetworkObject.ChangeOwnership(rpcParams.Receive.SenderClientId);
					SetDriverInCarOwnerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val3));
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetDriverInCarOwnerRpc(NetworkBehaviourReference playerNetObjRef)
		{
			//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)
			//IL_0206: 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(2061638504u, val3, val, (SendTo)0, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2061638504u, val3, val, (SendTo)0, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerUtils.disableAnimationSync = true;
				((VehicleSeatAnimator)frontLeftSeat).SetLocalPlayerIntoSeat();
				ActivateControl();
				SetTriggerHoverTip(base.driverSideDoorTrigger, "Exit : [LMB]");
				startIgnitionTrigger.isBeingHeldByPlayer = false;
				stopIgnitionTrigger.isBeingHeldByPlayer = false;
				CancelIgnitionCoroutine();
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetFloat("animationSpeed", 0.5f);
				playerSteeringWheelAnimFloat = 0.5f;
				syncedPlayerSteeringAnim = 0.5f;
				if (base.keyIsInIgnition)
				{
					GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				}
				else 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);
				}
				SetDriverInCarNotOwnerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)GameNetworkManager.Instance.localPlayerController), accessoryMode, base.keyIsInIgnition, base.ignitionStarted, integer);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetDriverInCarNotOwnerRpc(NetworkBehaviourReference playerNetObjRef, bool accessoriesActive, bool setKeyInSlot, bool engineStarted, int currentAnimIndex)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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(388386796u, val3, val, (SendTo)1, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref accessoriesActive, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setKeyInSlot, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref engineStarted, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, currentAnimIndex);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 388386796u, val3, val, (SendTo)1, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val4 = default(PlayerControllerB);
				if (!((NetworkBehaviourReference)(ref playerNetObjRef)).TryGet<PlayerControllerB>(ref val4, (NetworkManager)null))
				{
					Plugin.Logger.LogError((object)"SetDriverIntoCarNotOwnerRpc failed to find player object reference from network behaviour!");
					return;
				}
				base.currentDriver = val4;
				((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);
				accessoryMode = accessoriesActive;
				SetFrontCabinLightOn(accessoriesActive);
				base.keyIsInIgnition = setKeyInSlot;
				base.ignitionStarted = engineStarted;
				val4.playerBodyAnimator.SetInteger("SA_CarAnim", currentAnimIndex);
			}
		}

		public void OnDriverExitCar()
		{
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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)
			{
				PlayerUtils.disableAnimationSync = false;
				base.localPlayerInControl = false;
				SetTriggerHoverTip(base.driverSideDoorTrigger, "Use door : [LMB]");
				disableAnimations = !base.ignitionStarted;
				inIgnitionAnimation = false;
				startIgnitionTrigger.isBeingHeldByPlayer = false;
				stopIgnitionTrigger.isBeingHeldByPlayer = false;
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				GlobalUtilities.ResetHUDToolTips(GameNetworkManager.Instance.localPlayerController);
				if ((Object)(object)base.currentDriver != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					HUDManager.Instance.DisplayTip("Err?", "This state should not occur! aborting!", false, false, "LC_Tip1");
					return;
				}
				DisableControl();
				CancelIgnitionAnimation(base.ignitionStarted, setIgnitionAnim: true);
				SetIgnition(base.ignitionStarted, accessoryMode);
				base.chanceToStartIgnition = 10f;
				base.syncedPosition = ((Component)this).transform.position;
				base.syncedRotation = ((Component)this).transform.rotation;
				OnDriverExitCarRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)GameNetworkManager.Instance.localPlayerController), base.syncedPosition, base.syncedRotation, base.keyIsInIgnition, base.ignitionStarted, accessoryMode);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnDriverExitCarRpc(NetworkBehaviourReference playerNetObjRef, Vector3 carLocation, Quaternion carRotation, bool setKeyInSlot, bool engineStarted, bool accessoriesActive)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_0186: 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)
			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(1845809747u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				((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 accessoriesActive, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1845809747u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsServer)
			{
				((NetworkBehaviour)this).NetworkObject.ChangeOwnership(0uL);
			}
			PlayerControllerB val4 = default(PlayerControllerB);
			if (!((NetworkBehaviourReference)(ref playerNetObjRef)).TryGet<PlayerControllerB>(ref val4, (NetworkManager)null))
			{
				Plugin.Logger.LogError((object)"OnDriverExitRpc failed to find player object reference from network behaviour!");
				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 = engineStarted;
			if (base.ignitionStarted && !base.carExhaustParticle.isEmitting)
			{
				base.carExhaustParticle.Play();
			}
			else if (!base.ignitionStarted && base.carExhaustParticle.isEmitting)
			{
				base.carExhaustParticle.Stop(true, (ParticleSystemStopBehavior)1);
			}
			disableAnimations = !base.ignitionStarted;
			inIgnitionAnimation = false;
			startIgnitionTrigger.isBeingHeldByPlayer = false;
			stopIgnitionTrigger.isBeingHeldByPlayer = false;
			CancelIgnitionAnimation(base.ignitionStarted, setIgnitionAnim: true);
			SetIgnition(base.ignitionStarted, accessoriesActive);
			SetDashboardGaugesOn(accessoriesActive);
			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 = CanExitCar(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 SetPassengerInCar()
		{
			//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)
			SetPassengerInCarServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetPassengerInCarServerRpc(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_010b: 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(1959727518u, rpcParams, val, (SendTo)2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1959727518u, 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.currentPassenger != (Object)null))
				{
					base.currentPassenger = val3;
					SetPassengerInCarRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val3));
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected void SetPassengerInCarRpc(NetworkBehaviourReference playerNetObjRef)
		{
			//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(1819189263u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1819189263u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = default(PlayerControllerB);
			if (!((NetworkBehaviourReference)(ref playerNetObjRef)).TryGet<PlayerControllerB>(ref val4, (NetworkManager)null))
			{
				Plugin.Logger.LogError((object)"SetPassengerInCarRpc failed to find player object reference from network behaviour!");
				return;
			}
			if ((Object)(object)val4 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				PlayerUtils.disableAnimationSync = true;
				((VehicleSeatAnimator)frontRightSeat).SetLocalPlayerIntoSeat();
				base.localPlayerInPassengerSeat = true;
				SetTriggerHoverTip(base.passengerSideDoorTrigger, "Exit : [LMB]");
				if (base.passengerSideDoor.boolValue)
				{
					base.passengerSideDoor.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
			}
			else
			{
				((VehicleSeatAnimator)frontRightSeat).SetPlayerAnimations(val4, false);
			}
			base.currentPassenger = val4;
			val4.playerBodyAnimator.SetFloat("animationSpeed", 0.5f);
		}

		public void OnPassengerExitCar()
		{
			//IL_007b: 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)
			if (((NetworkBehaviour)this).IsSpawned && !((Object)(object)((NetworkBehaviour)this).NetworkManager == (Object)null) && ((NetworkBehaviour)this).NetworkManager.IsListening)
			{
				PlayerUtils.disableAnimationSync = false;
				base.localPlayerInPassengerSeat = false;
				SetTriggerHoverTip(base.passengerSideDoorTrigger, "Use door : [LMB]");
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				base.currentPassenger = null;
				OnPassengerExitCarRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)GameNetworkManager.Instance.localPlayerController), ((Component)GameNetworkManager.Instance.localPlayerController).transform.position);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnPassengerExitCarRpc(NetworkBehaviourReference playerNetObjRef, Vector3 exitPoint)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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(575050736u, val3, val, (SendTo)5, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerNetObjRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref exitPoint);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 575050736u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				PlayerControllerB val4 = default(PlayerControllerB);
				if (!((NetworkBehaviourReference)(ref playerNetObjRef)).TryGet<PlayerControllerB>(ref val4, (NetworkManager)null))
				{
					Plugin.Logger.LogError((object)"OnPassengerExitCarRpc failed to find player object reference from network behaviour!");
					return;
				}
				((VehicleSeatAnimator)frontRightSeat).ReturnPlayerAnimations(val4, false);
				val4.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				val4.TeleportPlayer(exitPoint, false, 0f, false, true);
				base.currentPassenger = null;
			}
		}

		public void ExitPassengerSideSeat()
		{
			//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.localPlayerInPassengerSeat)
			{
				GameNetworkManager.Instance.localPlayerController.playerBodyAnimator.SetInteger("SA_CarAnim", 0);
				int num = CanExitCar(base.passengerSideExitPoints);
				if (num == 0 && !base.passengerSideDoor.boolValue)
				{
					base.passengerSideDoor.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
				if (num != -1)
				{
					GameNetworkManager.Instance.localPlayerController.TeleportPlayer(base.passengerSideExitPoints[num].position, false, 0f, false, true);
				}
				else
				{
					GameNetworkManager.I