Decompiled source of FuelCruiser v1.0.0

BepInEx/plugins/FuelCruiser.dll

Decompiled an hour ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("IronAxleWorks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Findable, fuel-powered drivable salvage car mod for R.E.P.O.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FuelCruiser")]
[assembly: AssemblyTitle("FuelCruiser")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
namespace FuelCruiser
{
	public class CargoBedStabilizer : MonoBehaviour
	{
		private Rigidbody _carRb;

		private readonly HashSet<PhysGrabObject> _insideObjects = new HashSet<PhysGrabObject>();

		private readonly List<PhysGrabObject> _pruneBuffer = new List<PhysGrabObject>();

		private float _statsTimer;

		public int TrackedItemCount { get; private set; }

		public int TrackedDollarValue { get; private set; }

		public void Initialize(Rigidbody carRb)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			_carRb = carRb;
			BoxCollider obj = ((Component)this).gameObject.AddComponent<BoxCollider>();
			((Collider)obj).isTrigger = true;
			obj.center = Vector3.zero;
			obj.size = new Vector3(0.92f, 0.42f, 0.58f);
		}

		private void OnTriggerEnter(Collider other)
		{
			TryTrack(other);
		}

		private void OnTriggerStay(Collider other)
		{
			TryTrack(other);
		}

		private void OnTriggerExit(Collider other)
		{
			if (!((Object)(object)other == (Object)null))
			{
				PhysGrabObject componentInParent = ((Component)other).GetComponentInParent<PhysGrabObject>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					_insideObjects.Remove(componentInParent);
				}
			}
		}

		private void TryTrack(Collider other)
		{
			if (!((Object)(object)other == (Object)null) && !other.isTrigger)
			{
				PhysGrabObject componentInParent = ((Component)other).GetComponentInParent<PhysGrabObject>();
				if (!((Object)(object)componentInParent == (Object)null) && !componentInParent.dead && !((Object)(object)((Component)componentInParent).GetComponent<PlayerTumble>() != (Object)null) && !((Object)(object)((Component)componentInParent).GetComponent<EnemyRigidbody>() != (Object)null) && !((Object)(object)componentInParent.rb == (Object)null) && !componentInParent.rb.isKinematic)
				{
					_insideObjects.Add(componentInParent);
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: 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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			if ((Object)(object)_carRb == (Object)null)
			{
				return;
			}
			bool value = ModConfig.EnableTrunkStabilizer.Value;
			bool value2 = ModConfig.TrunkFragilityProtection.Value;
			bool flag = !SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient();
			_pruneBuffer.Clear();
			Vector3 val3 = default(Vector3);
			Vector3 val4 = default(Vector3);
			foreach (PhysGrabObject insideObject in _insideObjects)
			{
				if ((Object)(object)insideObject == (Object)null || (Object)(object)insideObject.rb == (Object)null || insideObject.dead)
				{
					_pruneBuffer.Add(insideObject);
					continue;
				}
				Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)insideObject).transform.position);
				if (Mathf.Abs(val.x) > 0.62f || Mathf.Abs(val.z) > 0.45f || val.y < -0.3f || val.y > 0.72f)
				{
					_pruneBuffer.Add(insideObject);
				}
				else
				{
					if (!flag || insideObject.grabbed || insideObject.rb.isKinematic)
					{
						continue;
					}
					if (value2)
					{
						try
						{
							insideObject.OverrideFragility(0.12f);
						}
						catch
						{
						}
					}
					if (value)
					{
						Vector3 pointVelocity = _carRb.GetPointVelocity(insideObject.rb.worldCenterOfMass);
						Vector3 val2 = insideObject.rb.linearVelocity - pointVelocity;
						((Vector3)(ref val3))..ctor(val2.x, 0f, val2.z);
						insideObject.rb.AddForce(-val3 * 9.5f, (ForceMode)5);
						Rigidbody rb = insideObject.rb;
						rb.angularVelocity *= 0.86f;
						((Vector3)(ref val4))..ctor(Mathf.Clamp(val.x, -0.36f, 0.36f), Mathf.Clamp(val.y, -0.05f, 0.25f), Mathf.Clamp(val.z, -0.22f, 0.22f));
						Vector3 val5 = ((Component)this).transform.TransformPoint(val4) - ((Component)insideObject).transform.position;
						val5.y = Mathf.Min(0f, val5.y);
						insideObject.rb.AddForce(val5 * 14f, (ForceMode)5);
					}
				}
			}
			for (int i = 0; i < _pruneBuffer.Count; i++)
			{
				_insideObjects.Remove(_pruneBuffer[i]);
			}
		}

		private void Update()
		{
			_statsTimer += Time.deltaTime;
			if (_statsTimer < 0.25f)
			{
				return;
			}
			_statsTimer = 0f;
			int num = 0;
			int num2 = 0;
			foreach (PhysGrabObject insideObject in _insideObjects)
			{
				if (!((Object)(object)insideObject == (Object)null) && !insideObject.dead)
				{
					num++;
					ValuableObject component = ((Component)insideObject).GetComponent<ValuableObject>();
					if ((Object)(object)component != (Object)null)
					{
						num2 += RuntimeHelpers.GetValuableDollarValue(component);
					}
				}
			}
			TrackedItemCount = num;
			TrackedDollarValue = num2;
		}
	}
	public class CarVisualRefs
	{
		public Transform VisualRoot;

		public Transform DriverSeatAnchor;

		public Transform PassengerSeatAnchor;

		public Transform FirstPersonCamAnchor;

		public Transform SteeringWheelTransform;

		public Transform FuelCapTransform;

		public Transform CargoBedCenter;

		public Transform ExhaustTip;

		public Transform[] FrontSteerPivots = (Transform[])(object)new Transform[2];

		public Transform[] WheelSpinMeshes = (Transform[])(object)new Transform[4];

		public Light[] Headlights = (Light[])(object)new Light[2];

		public Material HeadlightLensMaterial;

		public Material TaillightMaterial;

		public Material ReverseLightMaterial;

		public Light RoofBeaconLight;

		public Transform RoofBeaconSpinner;

		public Material RoofBeaconMaterial;

		public Material FuelCapRingMaterial;

		public Material[] DashFuelSegments = (Material[])(object)new Material[8];

		public ParticleSystem ExhaustParticles;

		public ParticleSystem RefuelParticles;

		public ParticleSystem ImpactSparkParticles;
	}
	public static class CarModelBuilder
	{
		public static CarVisualRefs Build(GameObject root, PaintTheme theme, int colorSeed)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_0104: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_066e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_081f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0874: Unknown result type (might be due to invalid IL or missing references)
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_0915: Unknown result type (might be due to invalid IL or missing references)
			//IL_093e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0943: Unknown result type (might be due to invalid IL or missing references)
			//IL_0957: Unknown result type (might be due to invalid IL or missing references)
			//IL_0980: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0add: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c85: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d85: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df9: Expected O, but got Unknown
			//IL_0e23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ebb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ecf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee8: Expected O, but got Unknown
			//IL_0f12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f56: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1058: Unknown result type (might be due to invalid IL or missing references)
			//IL_106d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1081: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_10e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_1104: Unknown result type (might be due to invalid IL or missing references)
			//IL_110e: Unknown result type (might be due to invalid IL or missing references)
			//IL_116e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1182: Unknown result type (might be due to invalid IL or missing references)
			//IL_1196: Unknown result type (might be due to invalid IL or missing references)
			//IL_11cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_120f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1223: Unknown result type (might be due to invalid IL or missing references)
			//IL_1237: Unknown result type (might be due to invalid IL or missing references)
			//IL_1260: Unknown result type (might be due to invalid IL or missing references)
			//IL_1265: Unknown result type (might be due to invalid IL or missing references)
			//IL_1279: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_12b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_12dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_12e3: Expected O, but got Unknown
			//IL_130d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1329: Unknown result type (might be due to invalid IL or missing references)
			//IL_1330: Expected O, but got Unknown
			//IL_135a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1376: Unknown result type (might be due to invalid IL or missing references)
			//IL_137d: Expected O, but got Unknown
			//IL_13a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_13c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ca: Expected O, but got Unknown
			//IL_13f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1418: Unknown result type (might be due to invalid IL or missing references)
			//IL_142c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1440: Unknown result type (might be due to invalid IL or missing references)
			//IL_146d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1481: Unknown result type (might be due to invalid IL or missing references)
			//IL_1495: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_1503: Unknown result type (might be due to invalid IL or missing references)
			//IL_1538: Unknown result type (might be due to invalid IL or missing references)
			//IL_153d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1551: Unknown result type (might be due to invalid IL or missing references)
			//IL_1573: Unknown result type (might be due to invalid IL or missing references)
			//IL_1578: Unknown result type (might be due to invalid IL or missing references)
			//IL_158b: Unknown result type (might be due to invalid IL or missing references)
			//IL_15a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_15aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_1711: Unknown result type (might be due to invalid IL or missing references)
			//IL_1725: Unknown result type (might be due to invalid IL or missing references)
			//IL_1739: Unknown result type (might be due to invalid IL or missing references)
			//IL_174b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1752: Expected O, but got Unknown
			//IL_177c: Unknown result type (might be due to invalid IL or missing references)
			//IL_179c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1800: Unknown result type (might be due to invalid IL or missing references)
			//IL_1805: Unknown result type (might be due to invalid IL or missing references)
			//IL_181b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1820: Unknown result type (might be due to invalid IL or missing references)
			//IL_1836: Unknown result type (might be due to invalid IL or missing references)
			//IL_183b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1851: Unknown result type (might be due to invalid IL or missing references)
			//IL_1856: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1665: Unknown result type (might be due to invalid IL or missing references)
			//IL_166a: Unknown result type (might be due to invalid IL or missing references)
			//IL_167e: Unknown result type (might be due to invalid IL or missing references)
			//IL_16bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_16c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_16d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1876: Unknown result type (might be due to invalid IL or missing references)
			//IL_187d: Expected O, but got Unknown
			//IL_189c: Unknown result type (might be due to invalid IL or missing references)
			//IL_18cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_18d3: Expected O, but got Unknown
			//IL_1904: Unknown result type (might be due to invalid IL or missing references)
			//IL_1918: Unknown result type (might be due to invalid IL or missing references)
			//IL_192c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1946: Unknown result type (might be due to invalid IL or missing references)
			//IL_195a: Unknown result type (might be due to invalid IL or missing references)
			//IL_196e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1988: Unknown result type (might be due to invalid IL or missing references)
			//IL_198d: Unknown result type (might be due to invalid IL or missing references)
			//IL_19a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_19bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_19c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d4: Unknown result type (might be due to invalid IL or missing references)
			CarVisualRefs carVisualRefs = new CarVisualRefs();
			Color val = RuntimeHelpers.ResolvePaintColor(theme, colorSeed);
			Color color = val * 0.72f;
			color.a = 1f;
			Material mat = RuntimeHelpers.CreateMaterial(val, 0.35f, 0.55f, null, RuntimeHelpers.GetPaintGrainTexture());
			Material mat2 = RuntimeHelpers.CreateMaterial(color, 0.3f);
			Material mat3 = RuntimeHelpers.CreateMaterial(new Color(0.14f, 0.15f, 0.17f), 0.72f, 0.42f);
			Material mat4 = RuntimeHelpers.CreateMaterial(new Color(0.75f, 0.78f, 0.82f), 0.88f, 0.78f);
			Material mat5 = RuntimeHelpers.CreateMaterial(new Color(0.09f, 0.09f, 0.1f), 0.05f, 0.18f);
			Material mat6 = RuntimeHelpers.CreateMaterial(new Color(0.24f, 0.18f, 0.15f), 0.08f, 0.25f);
			Material mat7 = RuntimeHelpers.CreateMaterial(new Color(0.11f, 0.12f, 0.13f), 0.2f, 0.35f);
			Material mat8 = RuntimeHelpers.CreateMaterial(Color.white, 0.65f, 0.42f, null, RuntimeHelpers.GetDiamondPlateTexture());
			Material mat9 = RuntimeHelpers.CreateMaterial(Color.white, 0.25f, 0.45f, null, RuntimeHelpers.GetHazardStripeTexture());
			Material mat10 = RuntimeHelpers.CreateMaterial(new Color(0.42f, 0.65f, 0.74f, 0.34f), 0.1f, 0.92f, null, null, transparent: true);
			carVisualRefs.HeadlightLensMaterial = RuntimeHelpers.CreateMaterial(new Color(0.95f, 0.92f, 0.76f), 0.1f, 0.85f, Color.black);
			carVisualRefs.TaillightMaterial = RuntimeHelpers.CreateMaterial(new Color(0.55f, 0.07f, 0.06f), 0.1f, 0.75f, (Color?)new Color(0.25f, 0.02f, 0.02f), (Texture2D)null, transparent: false);
			carVisualRefs.ReverseLightMaterial = RuntimeHelpers.CreateMaterial(new Color(0.75f, 0.78f, 0.8f), 0.1f, 0.8f, Color.black);
			carVisualRefs.RoofBeaconMaterial = RuntimeHelpers.CreateMaterial(new Color(0.95f, 0.56f, 0.08f), 0.1f, 0.85f, (Color?)new Color(0.25f, 0.12f, 0.01f), (Texture2D)null, transparent: false);
			carVisualRefs.FuelCapRingMaterial = RuntimeHelpers.CreateMaterial(new Color(0.95f, 0.65f, 0.1f), 0.2f, 0.75f, (Color?)new Color(0.95f, 0.55f, 0.05f), (Texture2D)null, transparent: false);
			GameObject val2 = new GameObject("CarVisual");
			val2.transform.SetParent(root.transform, false);
			carVisualRefs.VisualRoot = val2.transform;
			Part((PrimitiveType)3, "ChassisUnderbody", val2.transform, new Vector3(0f, 0.26f, 0f), Vector3.zero, new Vector3(1.04f, 0.14f, 1.96f), mat3);
			Part((PrimitiveType)3, "LowerSideSkirtL", val2.transform, new Vector3(-0.56f, 0.33f, 0.02f), Vector3.zero, new Vector3(0.08f, 0.16f, 1.65f), mat2);
			Part((PrimitiveType)3, "LowerSideSkirtR", val2.transform, new Vector3(0.56f, 0.33f, 0.02f), Vector3.zero, new Vector3(0.08f, 0.16f, 1.65f), mat2);
			Part((PrimitiveType)3, "HoodBase", val2.transform, new Vector3(0f, 0.48f, 0.66f), new Vector3(5f, 0f, 0f), new Vector3(1.06f, 0.26f, 0.68f), mat);
			Part((PrimitiveType)3, "HoodScoop", val2.transform, new Vector3(0f, 0.63f, 0.63f), new Vector3(4f, 0f, 0f), new Vector3(0.42f, 0.06f, 0.38f), mat3);
			Part((PrimitiveType)3, "FrontGrille", val2.transform, new Vector3(0f, 0.43f, 1.005f), Vector3.zero, new Vector3(0.68f, 0.18f, 0.04f), mat3);
			for (int i = -1; i <= 1; i++)
			{
				Part((PrimitiveType)3, $"GrilleSlat_{i}", val2.transform, new Vector3(0f, 0.43f + (float)i * 0.048f, 1.028f), Vector3.zero, new Vector3(0.62f, 0.018f, 0.02f), mat4);
			}
			Part((PrimitiveType)3, "FrontBumper", val2.transform, new Vector3(0f, 0.29f, 1.05f), Vector3.zero, new Vector3(1.16f, 0.13f, 0.14f), mat3);
			Part((PrimitiveType)3, "FrontBumperHazard", val2.transform, new Vector3(0f, 0.29f, 1.125f), Vector3.zero, new Vector3(1.08f, 0.075f, 0.015f), mat9);
			Part((PrimitiveType)3, "BullBarL", val2.transform, new Vector3(-0.34f, 0.44f, 1.055f), Vector3.zero, new Vector3(0.045f, 0.26f, 0.045f), mat3);
			Part((PrimitiveType)3, "BullBarR", val2.transform, new Vector3(0.34f, 0.44f, 1.055f), Vector3.zero, new Vector3(0.045f, 0.26f, 0.045f), mat3);
			Part((PrimitiveType)3, "BullBarTop", val2.transform, new Vector3(0f, 0.56f, 1.055f), Vector3.zero, new Vector3(0.72f, 0.04f, 0.045f), mat3);
			Part((PrimitiveType)3, "RearBumper", val2.transform, new Vector3(0f, 0.29f, -1.04f), Vector3.zero, new Vector3(1.14f, 0.12f, 0.12f), mat3);
			Part((PrimitiveType)3, "RearBumperHazard", val2.transform, new Vector3(0f, 0.29f, -1.105f), Vector3.zero, new Vector3(1.04f, 0.065f, 0.015f), mat9);
			float[] array = new float[2] { -0.57f, 0.57f };
			float[] array2 = new float[2] { 0.65f, -0.62f };
			for (int j = 0; j < 2; j++)
			{
				for (int k = 0; k < 2; k++)
				{
					Part((PrimitiveType)3, $"Fender_{j}_{k}", val2.transform, new Vector3(array[j], 0.47f, array2[k]), Vector3.zero, new Vector3(0.11f, 0.06f, 0.46f), mat3);
				}
			}
			Part((PrimitiveType)3, "CabinDoorL", val2.transform, new Vector3(-0.54f, 0.48f, -0.02f), Vector3.zero, new Vector3(0.07f, 0.34f, 0.72f), mat);
			Part((PrimitiveType)3, "CabinDoorR", val2.transform, new Vector3(0.54f, 0.48f, -0.02f), Vector3.zero, new Vector3(0.07f, 0.34f, 0.72f), mat);
			Part((PrimitiveType)3, "CabinRearBulkhead", val2.transform, new Vector3(0f, 0.6f, -0.36f), Vector3.zero, new Vector3(1.04f, 0.56f, 0.08f), mat);
			Part((PrimitiveType)3, "APillarL", val2.transform, new Vector3(-0.48f, 0.85f, 0.26f), new Vector3(-24f, 0f, 0f), new Vector3(0.055f, 0.56f, 0.055f), mat3);
			Part((PrimitiveType)3, "APillarR", val2.transform, new Vector3(0.48f, 0.85f, 0.26f), new Vector3(-24f, 0f, 0f), new Vector3(0.055f, 0.56f, 0.055f), mat3);
			Part((PrimitiveType)3, "BPillarL", val2.transform, new Vector3(-0.48f, 0.86f, -0.34f), Vector3.zero, new Vector3(0.06f, 0.52f, 0.06f), mat3);
			Part((PrimitiveType)3, "BPillarR", val2.transform, new Vector3(0.48f, 0.86f, -0.34f), Vector3.zero, new Vector3(0.06f, 0.52f, 0.06f), mat3);
			Part((PrimitiveType)3, "Windshield", val2.transform, new Vector3(0f, 0.84f, 0.26f), new Vector3(-24f, 0f, 0f), new Vector3(0.9f, 0.44f, 0.025f), mat10);
			Part((PrimitiveType)3, "MirrorL", val2.transform, new Vector3(-0.62f, 0.66f, 0.29f), Vector3.zero, new Vector3(0.11f, 0.07f, 0.05f), mat3);
			Part((PrimitiveType)3, "MirrorR", val2.transform, new Vector3(0.62f, 0.66f, 0.29f), Vector3.zero, new Vector3(0.11f, 0.07f, 0.05f), mat3);
			Part((PrimitiveType)3, "RoofCap", val2.transform, new Vector3(0f, 1.11f, -0.1f), Vector3.zero, new Vector3(1.02f, 0.065f, 0.62f), mat);
			Part((PrimitiveType)3, "RoofRackRailL", val2.transform, new Vector3(-0.44f, 1.165f, -0.1f), Vector3.zero, new Vector3(0.035f, 0.045f, 0.56f), mat3);
			Part((PrimitiveType)3, "RoofRackRailR", val2.transform, new Vector3(0.44f, 1.165f, -0.1f), Vector3.zero, new Vector3(0.035f, 0.045f, 0.56f), mat3);
			Part((PrimitiveType)2, "BeaconBase", val2.transform, new Vector3(0f, 1.16f, -0.1f), Vector3.zero, new Vector3(0.14f, 0.025f, 0.14f), mat3);
			GameObject val3 = Part((PrimitiveType)2, "BeaconDome", val2.transform, new Vector3(0f, 1.215f, -0.1f), Vector3.zero, new Vector3(0.11f, 0.045f, 0.11f), carVisualRefs.RoofBeaconMaterial);
			carVisualRefs.RoofBeaconSpinner = val3.transform;
			GameObject val4 = new GameObject("RoofBeaconLight");
			val4.transform.SetParent(val2.transform, false);
			val4.transform.localPosition = new Vector3(0f, 1.28f, -0.1f);
			Light val5 = val4.AddComponent<Light>();
			val5.type = (LightType)2;
			val5.color = new Color(1f, 0.58f, 0.08f);
			val5.range = 4.2f;
			val5.intensity = 0f;
			val5.shadows = (LightShadows)0;
			carVisualRefs.RoofBeaconLight = val5;
			Part((PrimitiveType)3, "CargoFloor", val2.transform, new Vector3(0f, 0.365f, -0.7f), Vector3.zero, new Vector3(0.98f, 0.05f, 0.62f), mat8);
			Part((PrimitiveType)3, "CargoWallL", val2.transform, new Vector3(-0.52f, 0.52f, -0.7f), Vector3.zero, new Vector3(0.08f, 0.34f, 0.64f), mat);
			Part((PrimitiveType)3, "CargoWallR", val2.transform, new Vector3(0.52f, 0.52f, -0.7f), Vector3.zero, new Vector3(0.08f, 0.34f, 0.64f), mat);
			Part((PrimitiveType)3, "CargoTailgate", val2.transform, new Vector3(0f, 0.49f, -1f), Vector3.zero, new Vector3(1.04f, 0.28f, 0.06f), mat);
			Part((PrimitiveType)3, "CargoRailL", val2.transform, new Vector3(-0.52f, 0.72f, -0.7f), Vector3.zero, new Vector3(0.04f, 0.04f, 0.62f), mat3);
			Part((PrimitiveType)3, "CargoRailR", val2.transform, new Vector3(0.52f, 0.72f, -0.7f), Vector3.zero, new Vector3(0.04f, 0.04f, 0.62f), mat3);
			GameObject val6 = new GameObject("CargoBedCenter");
			val6.transform.SetParent(val2.transform, false);
			val6.transform.localPosition = new Vector3(0f, 0.55f, -0.7f);
			carVisualRefs.CargoBedCenter = val6.transform;
			Part((PrimitiveType)3, "Dashboard", val2.transform, new Vector3(0f, 0.59f, 0.29f), new Vector3(12f, 0f, 0f), new Vector3(0.96f, 0.16f, 0.22f), mat7);
			Part((PrimitiveType)2, "SteeringColumn", val2.transform, new Vector3(-0.24f, 0.63f, 0.22f), new Vector3(68f, 0f, 0f), new Vector3(0.045f, 0.13f, 0.045f), mat3);
			GameObject val7 = new GameObject("SteeringWheelRoot");
			val7.transform.SetParent(val2.transform, false);
			val7.transform.localPosition = new Vector3(-0.24f, 0.68f, 0.14f);
			val7.transform.localEulerAngles = new Vector3(22f, 0f, 0f);
			carVisualRefs.SteeringWheelTransform = val7.transform;
			Part((PrimitiveType)2, "SteeringHub", val7.transform, Vector3.zero, new Vector3(90f, 0f, 0f), new Vector3(0.08f, 0.025f, 0.08f), mat3);
			Part((PrimitiveType)3, "SteeringSpokeH", val7.transform, Vector3.zero, Vector3.zero, new Vector3(0.24f, 0.028f, 0.022f), mat3);
			Part((PrimitiveType)3, "SteeringSpokeV", val7.transform, new Vector3(0f, -0.055f, 0f), Vector3.zero, new Vector3(0.028f, 0.11f, 0.022f), mat3);
			Vector3 pos = default(Vector3);
			for (int l = 0; l < 8; l++)
			{
				float num = (float)l * 45f * (MathF.PI / 180f);
				((Vector3)(ref pos))..ctor(Mathf.Cos(num) * 0.125f, Mathf.Sin(num) * 0.125f, 0f);
				Part((PrimitiveType)3, $"WheelRim_{l}", val7.transform, pos, new Vector3(0f, 0f, (float)l * 45f), new Vector3(0.026f, 0.105f, 0.026f), mat5);
			}
			Part((PrimitiveType)3, "DashGaugeBezel", val2.transform, new Vector3(0.12f, 0.66f, 0.2f), new Vector3(-20f, 0f, 0f), new Vector3(0.32f, 0.075f, 0.03f), mat3);
			for (int m = 0; m < 8; m++)
			{
				Material val8 = RuntimeHelpers.CreateMaterial(Color.green, 0.05f, 0.8f, Color.green * 1.4f);
				carVisualRefs.DashFuelSegments[m] = val8;
				float num2 = 0f + ((float)m - 3.5f) * 0.034f + 0.12f;
				Part((PrimitiveType)3, $"FuelLed_{m}", val2.transform, new Vector3(num2, 0.665f, 0.184f), new Vector3(-20f, 0f, 0f), new Vector3(0.024f, 0.042f, 0.012f), val8);
			}
			Part((PrimitiveType)3, "DriverSeatBase", val2.transform, new Vector3(-0.24f, 0.37f, -0.06f), Vector3.zero, new Vector3(0.38f, 0.08f, 0.36f), mat6);
			Part((PrimitiveType)3, "DriverSeatBack", val2.transform, new Vector3(-0.24f, 0.56f, -0.23f), new Vector3(-8f, 0f, 0f), new Vector3(0.36f, 0.34f, 0.07f), mat6);
			Part((PrimitiveType)3, "PassengerSeatBase", val2.transform, new Vector3(0.24f, 0.37f, -0.06f), Vector3.zero, new Vector3(0.38f, 0.08f, 0.36f), mat6);
			Part((PrimitiveType)3, "PassengerSeatBack", val2.transform, new Vector3(0.24f, 0.56f, -0.23f), new Vector3(-8f, 0f, 0f), new Vector3(0.36f, 0.34f, 0.07f), mat6);
			GameObject val9 = new GameObject("DriverSeatAnchor");
			val9.transform.SetParent(val2.transform, false);
			val9.transform.localPosition = new Vector3(-0.24f, 0.42f, -0.04f);
			carVisualRefs.DriverSeatAnchor = val9.transform;
			GameObject val10 = new GameObject("PassengerSeatAnchor");
			val10.transform.SetParent(val2.transform, false);
			val10.transform.localPosition = new Vector3(0.24f, 0.42f, -0.04f);
			carVisualRefs.PassengerSeatAnchor = val10.transform;
			GameObject val11 = new GameObject("FirstPersonCamAnchor");
			val11.transform.SetParent(val2.transform, false);
			val11.transform.localPosition = new Vector3(-0.22f, 0.9f, -0.03f);
			carVisualRefs.FirstPersonCamAnchor = val11.transform;
			GameObject val12 = new GameObject("FuelFillerPort");
			val12.transform.SetParent(val2.transform, false);
			val12.transform.localPosition = new Vector3(-0.565f, 0.56f, -0.52f);
			carVisualRefs.FuelCapTransform = val12.transform;
			Part((PrimitiveType)2, "FuelCapRing", val12.transform, Vector3.zero, new Vector3(0f, 0f, 90f), new Vector3(0.11f, 0.018f, 0.11f), carVisualRefs.FuelCapRingMaterial);
			Part((PrimitiveType)2, "FuelCapPlug", val12.transform, new Vector3(-0.015f, 0f, 0f), new Vector3(0f, 0f, 90f), new Vector3(0.07f, 0.016f, 0.07f), mat3);
			float[] array3 = new float[2] { -0.39f, 0.39f };
			for (int n = 0; n < 2; n++)
			{
				Part((PrimitiveType)3, $"HeadlightBezel_{n}", val2.transform, new Vector3(array3[n], 0.46f, 1f), Vector3.zero, new Vector3(0.19f, 0.12f, 0.05f), mat3);
				Part((PrimitiveType)3, $"HeadlightLens_{n}", val2.transform, new Vector3(array3[n], 0.46f, 1.028f), Vector3.zero, new Vector3(0.15f, 0.085f, 0.016f), carVisualRefs.HeadlightLensMaterial);
				GameObject val13 = new GameObject($"HeadlightSpot_{n}");
				val13.transform.SetParent(val2.transform, false);
				val13.transform.localPosition = new Vector3(array3[n], 0.48f, 1.08f);
				val13.transform.localEulerAngles = new Vector3(6f, (n == 0) ? (-3f) : 3f, 0f);
				Light val14 = val13.AddComponent<Light>();
				val14.type = (LightType)0;
				val14.color = new Color(1f, 0.94f, 0.78f);
				val14.range = 24f;
				val14.spotAngle = 62f;
				val14.intensity = 3.2f;
				val14.shadows = (LightShadows)0;
				((Behaviour)val14).enabled = false;
				carVisualRefs.Headlights[n] = val14;
				Part((PrimitiveType)3, $"Taillight_{n}", val2.transform, new Vector3(array3[n], 0.48f, -1.035f), Vector3.zero, new Vector3(0.18f, 0.09f, 0.025f), carVisualRefs.TaillightMaterial);
				Part((PrimitiveType)3, $"ReverseLight_{n}", val2.transform, new Vector3(array3[n] * 0.65f, 0.4f, -1.035f), Vector3.zero, new Vector3(0.08f, 0.05f, 0.022f), carVisualRefs.ReverseLightMaterial);
			}
			Part((PrimitiveType)2, "ExhaustPipe", val2.transform, new Vector3(0.32f, 0.2f, -1.06f), new Vector3(90f, 0f, 0f), new Vector3(0.07f, 0.14f, 0.07f), mat4);
			GameObject val15 = new GameObject("ExhaustTip");
			val15.transform.SetParent(val2.transform, false);
			val15.transform.localPosition = new Vector3(0.32f, 0.2f, -1.2f);
			val15.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
			carVisualRefs.ExhaustTip = val15.transform;
			carVisualRefs.ExhaustParticles = CreateExhaustParticles(val15.transform);
			carVisualRefs.RefuelParticles = CreateRefuelParticles(val12.transform);
			carVisualRefs.ImpactSparkParticles = CreateImpactParticles(val2.transform);
			Vector3[] array4 = (Vector3[])(object)new Vector3[4]
			{
				new Vector3(-0.56f, 0.22f, 0.65f),
				new Vector3(0.56f, 0.22f, 0.65f),
				new Vector3(-0.56f, 0.22f, -0.62f),
				new Vector3(0.56f, 0.22f, -0.62f)
			};
			for (int num3 = 0; num3 < 4; num3++)
			{
				GameObject val16 = new GameObject($"WheelPivot_{num3}");
				val16.transform.SetParent(val2.transform, false);
				val16.transform.localPosition = array4[num3];
				if (num3 < 2)
				{
					carVisualRefs.FrontSteerPivots[num3] = val16.transform;
				}
				GameObject val17 = new GameObject($"WheelSpin_{num3}");
				val17.transform.SetParent(val16.transform, false);
				carVisualRefs.WheelSpinMeshes[num3] = val17.transform;
				Part((PrimitiveType)2, "Tire", val17.transform, Vector3.zero, new Vector3(0f, 0f, 90f), new Vector3(0.42f, 0.085f, 0.42f), mat5);
				Part((PrimitiveType)2, "Rim", val17.transform, Vector3.zero, new Vector3(0f, 0f, 90f), new Vector3(0.25f, 0.092f, 0.25f), mat4);
				Part((PrimitiveType)3, "SpokeA", val17.transform, Vector3.zero, Vector3.zero, new Vector3(0.195f, 0.21f, 0.045f), mat3);
				Part((PrimitiveType)3, "SpokeB", val17.transform, Vector3.zero, Vector3.zero, new Vector3(0.195f, 0.045f, 0.21f), mat3);
			}
			return carVisualRefs;
		}

		private static GameObject Part(PrimitiveType type, string name, Transform parent, Vector3 pos, Vector3 euler, Vector3 scale, Material mat)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive(type);
			((Object)obj).name = name;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = pos;
			obj.transform.localEulerAngles = euler;
			obj.transform.localScale = scale;
			Collider component = obj.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			Renderer component2 = obj.GetComponent<Renderer>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.sharedMaterial = mat;
			}
			return obj;
		}

		private static ParticleSystem CreateExhaustParticles(Transform parent)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_008d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ExhaustSmoke");
			val.transform.SetParent(parent, false);
			ParticleSystem obj = val.AddComponent<ParticleSystem>();
			MainModule main = obj.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.45f, 0.85f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(1.2f, 2.4f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.08f, 0.22f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.26f, 0.26f, 0.28f, 0.65f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.18f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 60;
			EmissionModule emission = obj.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = 14f;
			((ShapeModule)(ref shape)).radius = 0.03f;
			((Renderer)val.GetComponent<ParticleSystemRenderer>()).material = RuntimeHelpers.CreateMaterial(new Color(0.32f, 0.32f, 0.34f, 0.65f), 0f, 0f, null, null, transparent: true);
			obj.Stop(true, (ParticleSystemStopBehavior)0);
			return obj;
		}

		private static ParticleSystem CreateRefuelParticles(Transform parent)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0143: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("RefuelSparks");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = new Vector3(-0.08f, 0.04f, 0f);
			ParticleSystem obj = val.AddComponent<ParticleSystem>();
			MainModule main = obj.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.5f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.4f, 1.2f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.035f, 0.07f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.96f, 0.74f, 0.14f, 0.9f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.65f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 40;
			EmissionModule emission = obj.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(18f);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.05f;
			((Renderer)val.GetComponent<ParticleSystemRenderer>()).material = RuntimeHelpers.CreateMaterial(new Color(0.98f, 0.76f, 0.15f), 0f, 0.5f, (Color?)new Color(0.9f, 0.55f, 0.05f), (Texture2D)null, transparent: false);
			obj.Stop(true, (ParticleSystemStopBehavior)0);
			return obj;
		}

		private static ParticleSystem CreateImpactParticles(Transform parent)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ImpactSparks");
			val.transform.SetParent(parent, false);
			val.transform.localPosition = new Vector3(0f, 0.42f, 1.08f);
			ParticleSystem obj = val.AddComponent<ParticleSystem>();
			MainModule main = obj.main;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).loop = false;
			((MainModule)(ref main)).duration = 0.35f;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.2f, 0.55f);
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(2.5f, 6.5f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.04f, 0.09f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(1f, 0.72f, 0.18f, 1f));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.9f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 45;
			EmissionModule emission = obj.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)2;
			((ShapeModule)(ref shape)).radius = 0.25f;
			((Renderer)val.GetComponent<ParticleSystemRenderer>()).material = RuntimeHelpers.CreateMaterial(new Color(1f, 0.78f, 0.2f), 0f, 0.5f, new Color(1f, 0.65f, 0.1f) * 2f);
			obj.Stop(true, (ParticleSystemStopBehavior)0);
			return obj;
		}
	}
	public class CruiserLevelManager : MonoBehaviour
	{
		private static CruiserLevelManager _instance;

		private bool _spawnedForCurrentLevel;

		private bool _requestedClientSync;

		private float _levelReadyDelay;

		private int _nextCarId = 1;

		private int _nextCanId = 1;

		private float _interactionDebounce;

		private readonly Dictionary<int, PaintTheme> _carThemes = new Dictionary<int, PaintTheme>();

		private readonly Dictionary<int, int> _carSeeds = new Dictionary<int, int>();

		public static void EnsureCreated()
		{
			//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_001e: Expected O, but got Unknown
			if (!((Object)(object)_instance != (Object)null))
			{
				GameObject val = new GameObject("FuelCruiser_LevelManager");
				Object.DontDestroyOnLoad((Object)val);
				_instance = val.AddComponent<CruiserLevelManager>();
			}
		}

		public static void OnLevelChanging()
		{
			if ((Object)(object)_instance != (Object)null)
			{
				_instance.CleanupLevelObjects();
			}
		}

		public static void SendCurrentLevelSnapshotTo(int targetActor)
		{
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_instance == (Object)null)
			{
				return;
			}
			for (int i = 0; i < FuelCruiserVehicle.AllCars.Count; i++)
			{
				FuelCruiserVehicle fuelCruiserVehicle = FuelCruiserVehicle.AllCars[i];
				if (!((Object)(object)fuelCruiserVehicle == (Object)null))
				{
					PaintTheme value;
					PaintTheme theme = (_instance._carThemes.TryGetValue(fuelCruiserVehicle.CarId, out value) ? value : ModConfig.PaintStyle.Value);
					int value2;
					int colorSeed = (_instance._carSeeds.TryGetValue(fuelCruiserVehicle.CarId, out value2) ? value2 : fuelCruiserVehicle.CarId);
					NetworkSync.BroadcastSpawnCar(fuelCruiserVehicle.CarId, ((Component)fuelCruiserVehicle).transform.position, ((Component)fuelCruiserVehicle).transform.rotation, fuelCruiserVehicle.CurrentFuel, theme, colorSeed, targetActor);
					if (fuelCruiserVehicle.DriverActorId > 0)
					{
						NetworkSync.BroadcastSeatChange(fuelCruiserVehicle.CarId, 0, fuelCruiserVehicle.DriverActorId);
					}
					if (fuelCruiserVehicle.PassengerActorId > 0)
					{
						NetworkSync.BroadcastSeatChange(fuelCruiserVehicle.CarId, 1, fuelCruiserVehicle.PassengerActorId);
					}
				}
			}
			for (int j = 0; j < FuelCanItem.AllCans.Count; j++)
			{
				FuelCanItem fuelCanItem = FuelCanItem.AllCans[j];
				if (!((Object)(object)fuelCanItem == (Object)null))
				{
					NetworkSync.BroadcastSpawnCan(fuelCanItem.CanId, ((Component)fuelCanItem).transform.position, ((Component)fuelCanItem).transform.rotation, fuelCanItem.RemainingFuel, targetActor);
					if (fuelCanItem.IsCarried || fuelCanItem.StowedInCarId >= 0)
					{
						NetworkSync.BroadcastCanState(fuelCanItem.CanId, fuelCanItem.CarrierActorId, fuelCanItem.StowedInCarId, fuelCanItem.RemainingFuel, ((Component)fuelCanItem).transform.position, ((Component)fuelCanItem).transform.rotation);
					}
				}
			}
		}

		private void OnEnable()
		{
			SceneManager.sceneUnloaded += HandleSceneUnloaded;
		}

		private void OnDisable()
		{
			SceneManager.sceneUnloaded -= HandleSceneUnloaded;
		}

		private void HandleSceneUnloaded(Scene scene)
		{
			CleanupLevelObjects();
		}

		private void CleanupLevelObjects()
		{
			if ((Object)(object)FuelCruiserVehicle.LocalSeatedCar != (Object)null)
			{
				FuelCruiserVehicle.LocalSeatedCar.ForceEjectLocalPlayer();
			}
			for (int num = FuelCruiserVehicle.AllCars.Count - 1; num >= 0; num--)
			{
				if ((Object)(object)FuelCruiserVehicle.AllCars[num] != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)FuelCruiserVehicle.AllCars[num]).gameObject);
				}
			}
			FuelCruiserVehicle.AllCars.Clear();
			for (int num2 = FuelCanItem.AllCans.Count - 1; num2 >= 0; num2--)
			{
				if ((Object)(object)FuelCanItem.AllCans[num2] != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)FuelCanItem.AllCans[num2]).gameObject);
				}
			}
			FuelCanItem.AllCans.Clear();
			_carThemes.Clear();
			_carSeeds.Clear();
			_spawnedForCurrentLevel = false;
			_requestedClientSync = false;
			_levelReadyDelay = 0f;
			_nextCarId = 1;
			_nextCanId = 1;
		}

		private void Update()
		{
			if (_interactionDebounce > 0f)
			{
				_interactionDebounce -= Time.deltaTime;
			}
			UpdateLevelSpawning();
			UpdateFootInteraction();
		}

		private bool IsEligibleLevel()
		{
			try
			{
				if (SemiFunc.IsMainMenu() || SemiFunc.RunIsLobby() || SemiFunc.RunIsLobbyMenu() || SemiFunc.RunIsArena() || SemiFunc.RunIsTutorial())
				{
					return false;
				}
				if (SemiFunc.RunIsLevel())
				{
					return true;
				}
				if (ModConfig.SpawnInShop.Value && SemiFunc.RunIsShop())
				{
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		private void UpdateLevelSpawning()
		{
			bool flag = false;
			try
			{
				flag = SemiFunc.LevelGenDone();
			}
			catch
			{
			}
			if (!flag || !IsEligibleLevel())
			{
				if ((_spawnedForCurrentLevel || _requestedClientSync) && !flag)
				{
					CleanupLevelObjects();
				}
			}
			else
			{
				if (_spawnedForCurrentLevel)
				{
					return;
				}
				_levelReadyDelay += Time.deltaTime;
				if (!(_levelReadyDelay < 1.25f))
				{
					bool flag2 = true;
					try
					{
						flag2 = SemiFunc.IsMasterClientOrSingleplayer();
					}
					catch
					{
					}
					if (flag2)
					{
						_spawnedForCurrentLevel = true;
						SpawnForCurrentLevel();
					}
					else if (!_requestedClientSync)
					{
						_requestedClientSync = true;
						NetworkSync.RequestFullSyncFromMaster();
					}
				}
			}
		}

		private void SpawnForCurrentLevel()
		{
			//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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			try
			{
				flag = SemiFunc.RunIsShop();
			}
			catch
			{
			}
			if (!flag && Random.value > ModConfig.SpawnChance.Value)
			{
				ManualLogSource log = FuelCruiserPlugin.Log;
				if (log != null)
				{
					log.LogInfo((object)"Spawn chance roll skipped Fuel Cruiser for this level.");
				}
				return;
			}
			List<LevelPoint> list = null;
			try
			{
				list = SemiFunc.LevelPointsGetAll();
			}
			catch
			{
			}
			if (list == null || list.Count == 0)
			{
				ManualLogSource log2 = FuelCruiserPlugin.Log;
				if (log2 != null)
				{
					log2.LogWarning((object)"No LevelPoints found; skipping Fuel Cruiser spawn.");
				}
				return;
			}
			Vector3 truckPos = Vector3.zero;
			bool flag2 = false;
			for (int i = 0; i < list.Count; i++)
			{
				if ((Object)(object)list[i] != (Object)null && (list[i].Truck || ((Object)(object)list[i].Room != (Object)null && list[i].Room.Truck)))
				{
					truckPos = ((Component)list[i]).transform.position;
					flag2 = true;
					break;
				}
			}
			if (!flag2 && (Object)(object)PlayerController.instance != (Object)null)
			{
				truckPos = ((Component)PlayerController.instance).transform.position;
			}
			List<LevelPoint> list2 = new List<LevelPoint>();
			for (int j = 0; j < list.Count; j++)
			{
				LevelPoint val = list[j];
				if (!((Object)(object)val == (Object)null) && !val.Truck && (!((Object)(object)val.Room != (Object)null) || (!val.Room.Truck && !val.Room.Extraction)))
				{
					list2.Add(val);
				}
			}
			if (list2.Count == 0)
			{
				list2.AddRange(list);
			}
			int num = (flag ? 1 : Mathf.Clamp(ModConfig.CarsPerLevel.Value, 1, 3));
			List<Vector3> list3 = new List<Vector3>();
			int num2 = 0;
			for (int k = 0; k < num; k++)
			{
				if (TryFindClearCarSpot(list2, truckPos, list3, out var bestPos, out var bestRot))
				{
					int num3 = _nextCarId++;
					float num4 = Mathf.Min(ModConfig.StartingFuelMin.Value, ModConfig.StartingFuelMax.Value);
					float num5 = Mathf.Max(ModConfig.StartingFuelMin.Value, ModConfig.StartingFuelMax.Value);
					float num6 = (flag ? (ModConfig.MaxFuel.Value * 0.55f) : Random.Range(num4, num5));
					int num7 = Environment.TickCount ^ (num3 * 7919) ^ Mathf.RoundToInt(bestPos.x * 13f + bestPos.z * 31f);
					PaintTheme value = ModConfig.PaintStyle.Value;
					_carThemes[num3] = value;
					_carSeeds[num3] = num7;
					FuelCruiserVehicle.Spawn(num3, bestPos, bestRot, num6, value, num7);
					NetworkSync.BroadcastSpawnCar(num3, bestPos, bestRot, num6, value, num7);
					list3.Add(bestPos);
					num2++;
					ManualLogSource log3 = FuelCruiserPlugin.Log;
					if (log3 != null)
					{
						log3.LogInfo((object)$"Spawned Fuel Cruiser #{num3} at {bestPos} with {num6:0.0}L fuel.");
					}
				}
			}
			if (num2 != 0)
			{
				int count = (flag ? 2 : Mathf.Clamp(ModConfig.FuelCansPerCar.Value * num2, 1, 18));
				List<Vector3> list4 = PickSpreadOutCanSpots(list2, list3, count);
				for (int l = 0; l < list4.Count; l++)
				{
					Vector3 val2 = SnapToFloor(list4[l], 0.03f);
					Quaternion val3 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
					int canId = _nextCanId++;
					float value2 = ModConfig.FuelPerCan.Value;
					FuelCanItem.Spawn(canId, val2, val3, value2);
					NetworkSync.BroadcastSpawnCan(canId, val2, val3, value2);
				}
				ManualLogSource log4 = FuelCruiserPlugin.Log;
				if (log4 != null)
				{
					log4.LogInfo((object)$"Spawned {list4.Count} Jerry Can(s) for {num2} Fuel Cruiser(s).");
				}
			}
		}

		private bool TryFindClearCarSpot(List<LevelPoint> candidates, Vector3 truckPos, List<Vector3> usedPositions, out Vector3 bestPos, out Quaternion bestRot)
		{
			//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_000e: 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_0097: 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_00a2: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			bestPos = Vector3.zero;
			bestRot = Quaternion.identity;
			List<LevelPoint> list = new List<LevelPoint>(candidates);
			for (int num = list.Count - 1; num > 0; num--)
			{
				int index = Random.Range(0, num + 1);
				LevelPoint value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
			float num2 = float.NegativeInfinity;
			bool flag = false;
			float num3 = Mathf.Clamp(ModConfig.CarScale.Value, 0.75f, 1.25f);
			Vector3 val = new Vector3(0.66f, 0.52f, 1.12f) * num3;
			int num4 = LayerMask.GetMask(new string[2] { "Default", "PhysGrabObjectHinge" });
			if (num4 == 0)
			{
				num4 = 1;
			}
			int num5 = Mathf.Min(list.Count, 80);
			for (int i = 0; i < num5; i++)
			{
				LevelPoint val2 = list[i];
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				Vector3 val3 = SnapToFloor(((Component)val2).transform.position, 0.08f);
				bool flag2 = false;
				for (int j = 0; j < usedPositions.Count; j++)
				{
					Vector3 val4 = val3 - usedPositions[j];
					if (((Vector3)(ref val4)).sqrMagnitude < 64f)
					{
						flag2 = true;
						break;
					}
				}
				if (flag2)
				{
					continue;
				}
				for (int k = 0; k < 4; k++)
				{
					Quaternion val5 = Quaternion.Euler(0f, (float)k * 90f, 0f);
					if (!Physics.CheckBox(val3 + Vector3.up * (0.64f * num3), val, val5, num4, (QueryTriggerInteraction)1))
					{
						float num6 = (0f - Mathf.Abs(Vector3.Distance(val3, truckPos) - 22f)) * 0.5f;
						float num7 = (RuntimeHelpers.IsLevelPointInStartRoom(val2) ? (-14f) : 4f);
						float num8 = num6 + num7 + Random.Range(-2f, 2f);
						if (num8 > num2)
						{
							num2 = num8;
							bestPos = val3;
							bestRot = val5;
							flag = true;
						}
						break;
					}
				}
			}
			if (!flag && list.Count > 0)
			{
				bestPos = SnapToFloor(((Component)list[0]).transform.position, 0.12f);
				bestRot = Quaternion.Euler(0f, (float)Random.Range(0, 4) * 90f, 0f);
				return true;
			}
			return flag;
		}

		private List<Vector3> PickSpreadOutCanSpots(List<LevelPoint> candidates, List<Vector3> carPositions, int count)
		{
			//IL_0022: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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)
			List<Vector3> list = new List<Vector3>();
			if (candidates.Count == 0 || count <= 0)
			{
				return list;
			}
			List<Vector3> list2 = new List<Vector3>(carPositions);
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < count; i++)
			{
				Vector3 val = Vector3.zero;
				float num = float.NegativeInfinity;
				bool flag = false;
				for (int j = 0; j < candidates.Count; j++)
				{
					LevelPoint val2 = candidates[j];
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					Vector3 position = ((Component)val2).transform.position;
					float num2 = float.MaxValue;
					for (int k = 0; k < list2.Count; k++)
					{
						float num3 = Vector3.Distance(position, list2[k]);
						if (num3 < num2)
						{
							num2 = num3;
						}
					}
					float num4 = ((i != 0 || carPositions.Count <= 0) ? (Mathf.Min(num2, 32f) + Random.Range(-3f, 3f)) : (0f - Mathf.Abs(Vector3.Distance(position, carPositions[0]) - 14f) + Random.Range(-2f, 2f)));
					if (num4 > num)
					{
						num = num4;
						val = position;
						flag = true;
					}
				}
				if (flag)
				{
					((Vector3)(ref val3))..ctor(Random.Range(-0.45f, 0.45f), 0f, Random.Range(-0.45f, 0.45f));
					list.Add(val + val3);
					list2.Add(val);
				}
			}
			return list;
		}

		private Vector3 SnapToFloor(Vector3 origin, float lift)
		{
			//IL_0021: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			int num = LayerMask.GetMask(new string[2] { "Default", "PhysGrabObjectHinge" });
			if (num == 0)
			{
				num = -1;
			}
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(origin + Vector3.up * 1.1f, Vector3.down, ref val, 4.5f, num, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val)).point + Vector3.up * lift;
			}
			return origin + Vector3.up * lift;
		}

		private void UpdateFootInteraction()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: 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)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)FuelCruiserVehicle.LocalSeatedCar != (Object)null || RuntimeHelpers.IsMenuOrChatBlockingInput() || RuntimeHelpers.IsPlayerDeadOrDisabled(RuntimeHelpers.GetLocalPlayerAvatar()))
			{
				return;
			}
			Camera val = SemiFunc.MainCamera();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			FuelCanItem locallyCarriedCan = FuelCanItem.GetLocallyCarriedCan();
			string text = RuntimeHelpers.KeyLabel(ModConfig.InteractKey.Value);
			if ((Object)(object)locallyCarriedCan != (Object)null)
			{
				FuelCruiserVehicle fuelCruiserVehicle = FindLookedAtOrNearestCar(val, 3.3f);
				if ((Object)(object)fuelCruiserVehicle != (Object)null)
				{
					if (!locallyCarriedCan.IsEmpty && fuelCruiserVehicle.CurrentFuel < fuelCruiserVehicle.MaxFuel - 0.05f)
					{
						int num = Mathf.RoundToInt(fuelCruiserVehicle.FuelPercent * 100f);
						ShowPrompt($"[Hold {text}] Refuel Cruiser  (Can: {locallyCarriedCan.RemainingFuel:0.0}L  |  Tank: {num}%)", new Color(1f, 0.84f, 0.22f));
						if (RuntimeHelpers.KeyIsHeld(ModConfig.InteractKey.Value))
						{
							locallyCarriedCan.SetPouringVisual(pouring: true);
							float num2 = ModConfig.RefuelRatePerSecond.Value * Time.deltaTime;
							float num3 = fuelCruiserVehicle.MaxFuel - fuelCruiserVehicle.CurrentFuel;
							float num4 = locallyCarriedCan.DrainFuel(Mathf.Min(num2, num3));
							if (num4 > 0f)
							{
								fuelCruiserVehicle.AddFuelFromPour(num4, fromLocalPlayer: true);
								if (fuelCruiserVehicle.CurrentFuel >= fuelCruiserVehicle.MaxFuel - 0.05f)
								{
									FuelCruiserVehicle.ShowFocusMessage("TANK FULL (100%)!", new Color(0.24f, 0.96f, 0.42f), Color.white, 2f);
									NetworkSync.BroadcastCanState(locallyCarriedCan.CanId, locallyCarriedCan.CarrierActorId, -1, locallyCarriedCan.RemainingFuel, ((Component)locallyCarriedCan).transform.position, ((Component)locallyCarriedCan).transform.rotation);
								}
								else if (locallyCarriedCan.IsEmpty)
								{
									FuelCruiserVehicle.ShowFocusMessage("JERRY CAN EMPTY!", new Color(1f, 0.58f, 0.16f), Color.white, 1.8f);
									NetworkSync.BroadcastCanState(locallyCarriedCan.CanId, locallyCarriedCan.CarrierActorId, -1, 0f, ((Component)locallyCarriedCan).transform.position, ((Component)locallyCarriedCan).transform.rotation);
								}
							}
						}
						else
						{
							locallyCarriedCan.SetPouringVisual(pouring: false);
						}
						return;
					}
					locallyCarriedCan.SetPouringVisual(pouring: false);
					ShowPrompt(locallyCarriedCan.IsEmpty ? ("[" + text + "] Drop Empty Jerry Can") : $"[{text}] Stow Spare Fuel Can in Trunk ({locallyCarriedCan.RemainingFuel:0}L)", new Color(0.75f, 0.92f, 1f));
					if (_interactionDebounce <= 0f && RuntimeHelpers.KeyWasPressed(ModConfig.InteractKey.Value))
					{
						_interactionDebounce = 0.28f;
						if (!locallyCarriedCan.IsEmpty)
						{
							locallyCarriedCan.StowInCarLocal(fuelCruiserVehicle);
						}
						else
						{
							DropHeldCan(locallyCarriedCan, val);
						}
					}
				}
				else
				{
					locallyCarriedCan.SetPouringVisual(pouring: false);
					ShowPrompt(locallyCarriedCan.IsEmpty ? ("[" + text + "] Drop Empty Jerry Can") : $"[{text}] Drop Fuel Can ({locallyCarriedCan.RemainingFuel:0.0}L)", new Color(0.95f, 0.45f, 0.32f));
					if (_interactionDebounce <= 0f && RuntimeHelpers.KeyWasPressed(ModConfig.InteractKey.Value))
					{
						_interactionDebounce = 0.25f;
						DropHeldCan(locallyCarriedCan, val);
					}
				}
				return;
			}
			FuelCanItem fuelCanItem = FindLookedAtCan(val, 3.1f);
			if ((Object)(object)fuelCanItem != (Object)null)
			{
				ShowPrompt(fuelCanItem.IsEmpty ? ("[" + text + "] Pick Up Empty Jerry Can") : $"[{text}] Carry Fuel Can ({fuelCanItem.RemainingFuel:0.0}L / {Mathf.RoundToInt(fuelCanItem.FuelPercent * 100f)}%)", new Color(1f, 0.36f, 0.26f));
				if (_interactionDebounce <= 0f && RuntimeHelpers.KeyWasPressed(ModConfig.InteractKey.Value))
				{
					_interactionDebounce = 0.28f;
					fuelCanItem.PickupLocal();
				}
				return;
			}
			FuelCruiserVehicle fuelCruiserVehicle2 = FindLookedAtOrNearestCar(val, 3.3f);
			if ((Object)(object)fuelCruiserVehicle2 != (Object)null)
			{
				int num5 = Mathf.RoundToInt(fuelCruiserVehicle2.FuelPercent * 100f);
				string text2 = ((fuelCruiserVehicle2.DriverActorId <= 0) ? "Drive Fuel Cruiser" : ((ModConfig.AllowPassengerSeat.Value && fuelCruiserVehicle2.PassengerActorId <= 0) ? "Ride Passenger" : "Cruiser Full"));
				string text3 = (fuelCruiserVehicle2.IsOutOfFuel ? "OUT OF FUEL" : $"Fuel: {num5}%");
				Color color = (fuelCruiserVehicle2.IsOutOfFuel ? new Color(1f, 0.35f, 0.22f) : new Color(1f, 0.84f, 0.24f));
				ShowPrompt("[" + text + "] " + text2 + "  (" + text3 + ")", color);
				if (_interactionDebounce <= 0f && RuntimeHelpers.KeyWasPressed(ModConfig.InteractKey.Value))
				{
					_interactionDebounce = 0.32f;
					fuelCruiserVehicle2.TryEnterLocal();
				}
			}
		}

		private void DropHeldCan(FuelCanItem can, Camera cam)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			Vector3 dropPos = ((Component)cam).transform.position + ((Component)cam).transform.forward * 0.95f - Vector3.up * 0.15f;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)cam).transform.position, ((Component)cam).transform.forward, ref val, 1.1f, -1, (QueryTriggerInteraction)1))
			{
				dropPos = ((RaycastHit)(ref val)).point - ((Component)cam).transform.forward * 0.22f;
			}
			Quaternion dropRot = Quaternion.Euler(0f, ((Component)cam).transform.eulerAngles.y, 0f);
			can.DropLocal(dropPos, dropRot, ((Component)cam).transform.forward * 1.4f);
		}

		private FuelCanItem FindLookedAtCan(Camera cam, float maxDist)
		{
			//IL_000e: 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_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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			FuelCanItem result = null;
			float num = float.MaxValue;
			Vector3 position = ((Component)cam).transform.position;
			Vector3 forward = ((Component)cam).transform.forward;
			for (int i = 0; i < FuelCanItem.AllCans.Count; i++)
			{
				FuelCanItem fuelCanItem = FuelCanItem.AllCans[i];
				if ((Object)(object)fuelCanItem == (Object)null || fuelCanItem.IsCarried)
				{
					continue;
				}
				Vector3 val = ((Component)fuelCanItem).transform.position + Vector3.up * 0.24f - position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude > maxDist || magnitude < 0.1f)
				{
					continue;
				}
				float num2 = Vector3.Dot(forward, val / magnitude);
				if (!(num2 < 0.84f))
				{
					float num3 = magnitude * (1.2f - num2);
					if (num3 < num)
					{
						num = num3;
						result = fuelCanItem;
					}
				}
			}
			return result;
		}

		private FuelCruiserVehicle FindLookedAtOrNearestCar(Camera cam, float maxDist)
		{
			//IL_000e: 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_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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			FuelCruiserVehicle result = null;
			float num = float.MaxValue;
			Vector3 position = ((Component)cam).transform.position;
			Vector3 forward = ((Component)cam).transform.forward;
			for (int i = 0; i < FuelCruiserVehicle.AllCars.Count; i++)
			{
				FuelCruiserVehicle fuelCruiserVehicle = FuelCruiserVehicle.AllCars[i];
				if ((Object)(object)fuelCruiserVehicle == (Object)null)
				{
					continue;
				}
				Vector3 val = ((Component)fuelCruiserVehicle).transform.position + Vector3.up * 0.55f - position;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude > maxDist)
				{
					continue;
				}
				float num2 = Vector3.Dot(forward, val / Mathf.Max(0.01f, magnitude));
				if (!(num2 < 0.58f))
				{
					float num3 = magnitude * (1.35f - num2);
					if (num3 < num)
					{
						num = num3;
						result = fuelCruiserVehicle;
					}
				}
			}
			return result;
		}

		private static void ShowPrompt(string message, Color color)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)ItemInfoExtraUI.instance != (Object)null)
				{
					ItemInfoExtraUI.instance.ItemInfoText(message, color);
				}
			}
			catch
			{
			}
		}
	}
	public class DrivingHudOverlay : MonoBehaviour
	{
		private static DrivingHudOverlay _instance;

		private Canvas _canvas;

		private GameObject _panelRoot;

		private Image _fuelFillImage;

		private Text _titleText;

		private Text _fuelText;

		private Text _statusText;

		private Text _trunkText;

		private Text _controlsText;

		private Font _uiFont;

		public static void EnsureCreated()
		{
			//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_001e: Expected O, but got Unknown
			if (!((Object)(object)_instance != (Object)null))
			{
				GameObject val = new GameObject("FuelCruiser_DrivingHUD");
				Object.DontDestroyOnLoad((Object)val);
				_instance = val.AddComponent<DrivingHudOverlay>();
			}
		}

		private void Awake()
		{
			BuildUi();
			if ((Object)(object)_panelRoot != (Object)null)
			{
				_panelRoot.SetActive(false);
			}
		}

		private void BuildUi()
		{
			//IL_0075: 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_00af: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			_uiFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
			if ((Object)(object)_uiFont == (Object)null)
			{
				_uiFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
			}
			_canvas = ((Component)this).gameObject.AddComponent<Canvas>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.sortingOrder = 120;
			CanvasScaler obj = ((Component)this).gameObject.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 0.5f;
			_panelRoot = CreateRect("DashboardPanel", ((Component)this).transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 24f), new Vector2(560f, 118f));
			((Graphic)_panelRoot.AddComponent<Image>()).color = new Color(0.06f, 0.07f, 0.09f, 0.84f);
			((Graphic)CreateRect("TopBorder", _panelRoot.transform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, 3f)).AddComponent<Image>()).color = new Color(0.96f, 0.72f, 0.14f, 0.95f);
			_titleText = CreateLabel("TitleLabel", _panelRoot.transform, new Vector2(0f, 1f), new Vector2(0.55f, 1f), new Vector2(0f, 1f), new Vector2(14f, -8f), new Vector2(-10f, 24f), 15, (FontStyle)1, (TextAnchor)3, new Color(1f, 0.82f, 0.24f));
			_statusText = CreateLabel("StatusLabel", _panelRoot.transform, new Vector2(0.45f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-14f, -8f), new Vector2(-10f, 24f), 13, (FontStyle)1, (TextAnchor)5, new Color(0.88f, 0.92f, 0.96f));
			GameObject val = CreateRect("FuelBarBg", _panelRoot.transform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -38f), new Vector2(-28f, 24f));
			((Graphic)val.AddComponent<Image>()).color = new Color(0.14f, 0.15f, 0.18f, 0.95f);
			GameObject val2 = CreateRect("FuelBarFill", val.transform, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0f, 0.5f), Vector2.zero, new Vector2(-4f, -4f));
			_fuelFillImage = val2.AddComponent<Image>();
			((Graphic)_fuelFillImage).color = new Color(0.24f, 0.92f, 0.36f, 1f);
			_fuelText = CreateLabel("FuelValueLabel", val.transform, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero, 14, (FontStyle)1, (TextAnchor)4, Color.white);
			_trunkText = CreateLabel("TrunkLabel", _panelRoot.transform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -66f), new Vector2(-28f, 22f), 13, (FontStyle)1, (TextAnchor)3, new Color(0.82f, 0.9f, 0.95f));
			_controlsText = CreateLabel("ControlsLabel", _panelRoot.transform, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 7f), new Vector2(-24f, 22f), 12, (FontStyle)0, (TextAnchor)4, new Color(0.72f, 0.76f, 0.82f));
		}

		private void Update()
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_panelRoot == (Object)null)
			{
				return;
			}
			FuelCruiserVehicle localSeatedCar = FuelCruiserVehicle.LocalSeatedCar;
			bool flag = (Object)(object)localSeatedCar != (Object)null && ModConfig.ShowDrivingHud.Value && !RuntimeHelpers.IsMenuOrChatBlockingInput();
			if (_panelRoot.activeSelf != flag)
			{
				_panelRoot.SetActive(flag);
			}
			if (!flag)
			{
				return;
			}
			bool localIsDriver = FuelCruiserVehicle.LocalIsDriver;
			float fuelPercent = localSeatedCar.FuelPercent;
			int num = Mathf.RoundToInt(fuelPercent * 100f);
			_titleText.text = (localIsDriver ? "FUEL CRUISER  [DRIVER]" : "FUEL CRUISER  [PASSENGER]");
			string text = (localSeatedCar.IsOutOfFuel ? "EMPTY" : (localSeatedCar.EngineRunning ? "ENGINE ON" : "ENGINE OFF"));
			string text2 = (localSeatedCar.HeadlightsOn ? "BEAMS ON" : "BEAMS OFF");
			string text3 = (localSeatedCar.IsThirdPersonCamera ? "3RD CAM" : "COCKPIT");
			string text4 = (localSeatedCar.IsTurboActive ? "  |  TURBO!" : "");
			_statusText.text = text + "  |  " + text2 + "  |  " + text3 + text4;
			if ((Object)(object)_fuelFillImage != (O