Decompiled source of WSP 9 v0.1.1

WSP_9.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace Danny.WSP_9
{
	[BepInPlugin("Danny.WSP_9", "WSP_9", "0.1.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
	[BepInDependency("nrgill28.Sodalite", "1.4.1")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class WSP_9Plugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Danny.WSP_9");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_wsp_9"));
			OtherLoader.RegisterDirectLoad(BasePath, "Danny.WSP_9", "", "", "modulwsp9", "");
		}
	}
}
namespace H3VRUtils.Vehicles
{
	public class ButtonIgnition : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public VehicleAudioSet audioSet;

		public float ignitionTime;

		private float m_it;

		public float failChance;

		public Random rand;

		public void Start()
		{
			rand = new Random();
		}

		public void BeginInteraction(FVRViveHand hand)
		{
			m_it = ignitionTime;
			if (!vehicle.isOn)
			{
				if (vehicle.isForciblyOff)
				{
				}
			}
			else
			{
				vehicle.TurnOffEngine(forcibly: false);
			}
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			m_it -= Time.fixedDeltaTime;
			if (m_it <= 0f)
			{
				float num = (float)rand.Next(0, 10000) / 100f;
				if (!(num <= failChance))
				{
					vehicle.TurnOnEngine(forcibly: false);
				}
			}
		}
	}
}
namespace H3VRUtils.Vehicles.Core
{
	public class DamagingArea : MonoBehaviour
	{
		public VehicleControl vehicle;

		public float damageMult = 15f;

		public float sharpyness = 50f;
	}
}
namespace H3VRUtils.Vehicles
{
	[Serializable]
	public class DriveShiftNode
	{
		public Vector3 localposition;

		public Vector3 rotation;

		public int left = -1;

		public int up = -1;

		public int right = -1;

		public int down = -1;

		public int gear = 0;
	}
	public class DriveShift : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public Text gearText;

		public int currentNode;

		public List<DriveShiftNode> driveShiftNodes;

		public VehicleAudioSet audioSet;

		public void Update()
		{
			if (vehicle.carSetting.automaticGear)
			{
				if (vehicle.currentGear > 0 && vehicle.speed > 1f)
				{
					gearText.text = vehicle.currentGear.ToString();
				}
				else if (vehicle.speed > 1f)
				{
					gearText.text = "R";
				}
				else
				{
					gearText.text = "N";
				}
			}
			else if (vehicle.NeutralGear)
			{
				gearText.text = "N";
			}
			else if (vehicle.currentGear != 0)
			{
				gearText.text = vehicle.currentGear.ToString();
			}
			else
			{
				gearText.text = "R";
			}
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].left != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].left;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].up != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].up;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].right != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].right;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f && driveShiftNodes[currentNode].down != -1)
			{
				flag = true;
				currentNode = driveShiftNodes[currentNode].down;
			}
			if (flag)
			{
				vehicle.ShiftTo(driveShiftNodes[currentNode].gear);
				((Component)this).transform.localPosition = driveShiftNodes[currentNode].localposition;
				((Component)this).transform.localEulerAngles = driveShiftNodes[currentNode].rotation;
			}
		}
	}
	internal class EngineDamagable : VehicleDamagable
	{
		public GameObject particleSystemCentre;

		public GameObject explosionCentre;

		public float SmokeParticleHPThreshold;

		public float explosionStrength = 200f;

		public GameObject particleSmokePrefab;

		public GameObject particleFirePrefab;

		public GameObject explosionPrefab;

		public GameObject fixedMesh;

		public GameObject damagedMesh;

		public GameObject destroyedMesh;

		private ParticleSystem particleSmoke;

		private ParticleSystem particleFire;

		public void Start()
		{
			GameObject val = Object.Instantiate<GameObject>(particleSmokePrefab, particleSystemCentre.transform);
			particleSmoke = val.GetComponent<ParticleSystem>();
			particleSmoke.Stop();
			GameObject val2 = Object.Instantiate<GameObject>(particleFirePrefab, particleSystemCentre.transform);
			particleFire = val2.GetComponent<ParticleSystem>();
			particleFire.Stop();
		}

		public override void onHealthChange()
		{
			if (HPLessThanPercent(SmokeParticleHPThreshold))
			{
				if (!particleSmoke.IsAlive())
				{
					particleSmoke.Play();
				}
			}
			else
			{
				particleSmoke.Stop();
			}
			if (health < 0f)
			{
				fixedMesh.SetActive(false);
				damagedMesh.SetActive(false);
				destroyedMesh.SetActive(true);
			}
			else if (HPLessThanPercent(SmokeParticleHPThreshold))
			{
				fixedMesh.SetActive(false);
				damagedMesh.SetActive(true);
				destroyedMesh.SetActive(false);
			}
			else
			{
				fixedMesh.SetActive(true);
				damagedMesh.SetActive(false);
				destroyedMesh.SetActive(false);
			}
		}

		public override void onDeath()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			particleFire.Play();
			if ((Object)(object)explosionPrefab != (Object)null)
			{
				Object.Instantiate<GameObject>(explosionPrefab, explosionCentre.transform.position, explosionCentre.transform.rotation);
			}
		}

		public override void whileDead()
		{
		}

		public override void whileUndead()
		{
		}

		public override void Heal(float heal)
		{
			base.Heal(heal);
		}

		public override void HealPercent(float percentHeal)
		{
			base.HealPercent(percentHeal);
		}

		public override void onUndeath()
		{
			particleFire.Stop();
		}

		public override void Damage()
		{
		}
	}
	internal class EnterVehicle : FVRInteractiveObject
	{
		public VehicleSeat vehicleSeat;
	}
	internal class ForkliftLift : FVRInteractiveObject
	{
		public Vector3 rotUpwards;

		public Vector3 rotRegular;

		public Vector3 rotDownwards;

		public GameObject lift;

		public float liftSpeed;

		public float minLiftY;

		public float maxLiftY;

		public void UpdateInteraction(FVRViveHand hand)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_008e: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = lift.transform.position;
			((Component)this).transform.localEulerAngles = rotRegular;
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f)
			{
				position.y += liftSpeed / 50f;
				((Component)this).transform.localEulerAngles = rotUpwards;
			}
			if (Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) <= 45f && hand.Input.TouchpadPressed && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.2f)
			{
				position.y -= liftSpeed / 50f;
				((Component)this).transform.localEulerAngles = rotDownwards;
			}
			if (position.y > maxLiftY)
			{
				position.y = maxLiftY;
			}
			else if (position.y < minLiftY)
			{
				position.y = minLiftY;
			}
			lift.transform.position = position;
		}
	}
	public class FuelNeedle : MonoBehaviour
	{
		public FuelTank tank;

		public GameObject needle;

		public bool isImperial;

		public Vector3 needleNoFuel;

		public Vector3 needleMaxFuel;

		public void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = tank.currentFuel;
			if (isImperial)
			{
				num *= 0.6213712f;
			}
			float num2 = Mathf.InverseLerp(0f, tank.maxFuel, num);
			needle.transform.localEulerAngles = Vector3.Lerp(needleNoFuel, needleMaxFuel, num2);
		}
	}
	public class FuelTank : VehicleDamagable
	{
		public float currentFuel;

		public float maxFuel;

		public float fuelUsagePer1000Rpm = 0.01f;

		public float leakMult;

		public GameObject explosionEffect;

		public bool BlowsOnDeath;

		public AudioSource leakSound;

		private new void FixedUpdate()
		{
			base.FixedUpdate();
			float num = vehicle.motorRPM / 1000f;
			float num2 = num * (fuelUsagePer1000Rpm / 3000f);
			currentFuel -= num2;
			float num3 = Mathf.InverseLerp(maxHealth, 0f, health);
			currentFuel -= num3 * leakMult / 50f;
			if ((Object)(object)leakSound != (Object)null)
			{
				leakSound.volume = num3;
			}
		}

		public override void onDeath()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			base.onDeath();
			if (BlowsOnDeath)
			{
				Object.Instantiate<GameObject>(explosionEffect, ((Component)this).transform.position, ((Component)this).transform.rotation);
			}
		}

		public float AddFuel(float fuelAdded)
		{
			currentFuel += fuelAdded;
			float num = maxFuel - currentFuel;
			if (num <= 0f)
			{
				return 0f;
			}
			return num;
		}
	}
}
namespace H3VRUtils
{
	internal class LockGun : MonoBehaviour
	{
		public FVRPhysicalObject Firearm;

		public GameObject LockPos;

		public void Update()
		{
		}
	}
}
namespace H3VRUtils.Vehicles
{
	public class ParkingBrakeClick : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public Vector3 positionOff;

		public Vector3 positionOn;

		public Vector3 rotationOff;

		public Vector3 rotationOn;

		public bool isOn;

		public VehicleAudioSet audioSet;
	}
	public class SpedometerNeedle : MonoBehaviour
	{
		public VehicleControl vehicle;

		public GameObject needle;

		public bool isImperial;

		public float maxSpeed;

		public Vector3 needleNoSpeed;

		public Vector3 needleMaxSpeed;

		public void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Abs(vehicle.speed);
			if (isImperial)
			{
				num *= 0.6213712f;
			}
			float num2 = Mathf.InverseLerp(0f, maxSpeed, num);
			needle.transform.localEulerAngles = Vector3.Lerp(needleNoSpeed, needleMaxSpeed, num2);
		}
	}
	internal class SteeringWheel : FVRInteractiveObject
	{
		public VehicleControl vehicle;

		public float resetLerpSpeed;

		public float maxRot;

		public bool isBraking;

		public bool reverseRot;

		[Header("Debug Values")]
		public Text rotText;

		public float rot;

		public float rh;

		public float lr;

		public float inlerp;

		public float lerp;

		public float rotAmt;

		public VehicleAudioSet audioSet;

		public void BeginInteraction(FVRViveHand hand)
		{
			//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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)this).transform.GetChild(0);
			child.parent = null;
			Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles;
			((Component)this).transform.LookAt(((Component)hand).transform);
			((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, ((Component)this).transform.localEulerAngles.y, localEulerAngles.z);
			child.parent = ((Component)this).transform;
		}

		public void EndInteraction(FVRViveHand hand)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Transform child = ((Component)this).transform.GetChild(0);
			child.parent = null;
			((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, 0f, ((Component)this).transform.localEulerAngles.z);
			child.parent = ((Component)this).transform;
		}

		public void UpdateInteraction(FVRViveHand hand)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: 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_00e2: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localEulerAngles = ((Component)this).transform.localEulerAngles;
			((Component)this).transform.LookAt(((Component)hand).transform);
			Vector3 localEulerAngles2 = ((Component)this).transform.localEulerAngles;
			rot = Mathf.DeltaAngle((float)Math.Round(localEulerAngles2.y), (float)Math.Round(localEulerAngles.y));
			rotAmt += rot;
			if (rotAmt >= maxRot)
			{
				rotAmt = maxRot;
				((Component)this).transform.localEulerAngles = localEulerAngles;
			}
			else if (rotAmt <= 0f - maxRot)
			{
				rotAmt = 0f - maxRot;
				((Component)this).transform.localEulerAngles = localEulerAngles;
			}
			else
			{
				((Component)this).transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles2.y, localEulerAngles.z);
			}
			rh = localEulerAngles2.y;
			lr = localEulerAngles.y;
			SetRot();
			if (Vector2.Angle(hand.Input.TouchpadAxes, -Vector2.up) <= 45f && hand.Input.TouchpadDown && ((Vector2)(ref hand.Input.TouchpadAxes)).magnitude > 0.3f)
			{
				isBraking = !isBraking;
			}
			float triggerFloat = hand.Input.TriggerFloat;
			if (isBraking)
			{
				vehicle.accel = 0f - triggerFloat;
			}
			else
			{
				vehicle.accel = triggerFloat;
			}
		}

		private void FixedUpdate()
		{
			//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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.m_hand != (Object)null)
			{
				float num = resetLerpSpeed;
				if (rotAmt > 0f)
				{
					num = 0f - num;
				}
				if (rotAmt > num || rotAmt < 0f - num)
				{
					rotAmt += num;
					((Component)this).transform.localEulerAngles = new Vector3(((Component)this).transform.localEulerAngles.x, ((Component)this).transform.localEulerAngles.y + num, ((Component)this).transform.localEulerAngles.z);
					vehicle.accel = 0f;
					SetRot();
				}
			}
		}

		private void SetRot()
		{
			if (rotAmt > 0f)
			{
				inlerp = Mathf.InverseLerp(0f, maxRot, rotAmt);
				lerp = 0f - Mathf.Lerp(0f, 1f, inlerp);
			}
			else
			{
				inlerp = Mathf.InverseLerp(0f, 0f - maxRot, rotAmt);
				lerp = Mathf.Lerp(0f, 1f, inlerp);
			}
			if (reverseRot)
			{
				lerp = 0f - lerp;
			}
			vehicle.steer = lerp;
		}
	}
	[CreateAssetMenu(fileName = "New Vehicle Audio Set", menuName = "Vehicles/AudioSet", order = 0)]
	public class VehicleAudioSet : ScriptableObject
	{
		private static AudioEvent defaultAE;

		public AudioEvent VehicleStart;

		public AudioEvent VehicleIdle;

		public AudioEvent VehicleStop;

		public AudioEvent HandbrakeUp;

		public AudioEvent HandbrakeDown;

		public AudioEvent ShiftDownGear;

		public AudioEvent RevLoop;

		public AudioEvent ShiftUpGear;

		public AudioEvent Brake;

		public AudioEvent BrakeLong;

		public AudioEvent PedalSwitchSound;

		static VehicleAudioSet()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			AudioEvent val = new AudioEvent();
			val.PitchRange = new Vector2(0.98f, 1.04f);
			val.VolumeRange = new Vector2(0.98f, 1.04f);
			val.ClipLengthRange = new Vector2(1f, 1f);
			defaultAE = val;
		}
	}
}
public enum ControlMode
{
	simple = 1,
	touch
}
public class VehicleControl : MonoBehaviour
{
	[Serializable]
	public class CarWheels
	{
		public ConnectWheel wheels;
	}

	[Serializable]
	public class ConnectWheel
	{
		public bool frontWheelDrive = true;

		public Transform frontRight;

		public Transform frontLeft;

		public WheelSetting frontSetting;

		public bool backWheelDrive = true;

		public Transform backRight;

		public Transform backLeft;

		public WheelSetting rearSetting;
	}

	[Serializable]
	public class WheelSetting
	{
		public float Radius = 0.4f;

		public float Weight = 1000f;

		public float Distance = 0.2f;
	}

	[Serializable]
	public class CarLights
	{
		public Light[] brakeLights;

		public Light[] reverseLights;
	}

	[Serializable]
	public class CarSounds
	{
		public AudioSource IdleEngine;

		public AudioSource LowEngine;

		public AudioSource HighEngine;

		public float minPitch = 1f;

		public float maxPitch = 10f;

		public AudioSource nitro;

		public AudioSource switchGear;
	}

	[Serializable]
	public class CarParticles
	{
		public GameObject brakeParticlePerfab;

		public ParticleSystem shiftParticle1;

		public ParticleSystem shiftParticle2;

		private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4];
	}

	[Serializable]
	public class CarSetting
	{
		public bool showNormalGizmos = false;

		public Transform carSteer;

		public HitGround[] hitGround;

		public List<Transform> cameraSwitchView;

		public float springs = 25000f;

		public float dampers = 1500f;

		public float carPower = 120f;

		public float shiftPower = 150f;

		public float brakePower = 8000f;

		public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f);

		public float maxSteerAngle = 25f;

		public float shiftDownRPM = 1500f;

		public float shiftUpRPM = 2500f;

		public float idleRPM = 500f;

		public float stiffness = 2f;

		public bool automaticGear = true;

		public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f };

		public float LimitBackwardSpeed = 60f;

		public float LimitForwardSpeed = 220f;
	}

	[Serializable]
	public class HitGround
	{
		public string tag = "street";

		public bool grounded = false;

		public AudioClip brakeSound;

		public AudioClip groundSound;

		public Color brakeColor;
	}

	private class WheelComponent
	{
		public Transform wheel;

		public WheelCollider collider;

		public Vector3 startPos;

		public float rotation = 0f;

		public float rotation2 = 0f;

		public float maxSteer;

		public bool drive;

		public float pos_y = 0f;

		public WheelSetting settings;
	}

	public ControlMode controlMode = ControlMode.simple;

	public bool activeControl = false;

	public CarWheels carWheels;

	public CarLights carLights;

	public CarSounds carSounds;

	public CarParticles carParticles;

	public CarSetting carSetting;

	[HideInInspector]
	public float steer = 0f;

	[HideInInspector]
	public float accel = 0f;

	[HideInInspector]
	public bool brake;

	private bool shifmotor;

	[HideInInspector]
	public float curTorque = 100f;

	[HideInInspector]
	public float powerShift = 100f;

	[HideInInspector]
	public bool shift;

	private float torque = 100f;

	[HideInInspector]
	public float speed = 0f;

	private float lastSpeed = -10f;

	private bool shifting = false;

	private float[] efficiencyTable = new float[22]
	{
		0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f,
		0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f,
		0.1f, 0.05f
	};

	private float efficiencyTableStep = 250f;

	private float Pitch;

	private float PitchDelay;

	private float shiftTime = 0f;

	private float shiftDelay = 0f;

	[HideInInspector]
	public int currentGear = 0;

	[HideInInspector]
	public bool NeutralGear = true;

	[HideInInspector]
	public float motorRPM = 0f;

	[HideInInspector]
	public bool Backward = false;

	[HideInInspector]
	public float accelFwd = 0f;

	[HideInInspector]
	public float accelBack = 0f;

	[HideInInspector]
	public float steerAmount = 0f;

	private float wantedRPM = 0f;

	private float w_rotate;

	private float slip;

	private float slip2 = 0f;

	private GameObject[] Particle = (GameObject[])(object)new GameObject[4];

	private Vector3 steerCurAngle;

	private Rigidbody myRigidbody;

	private WheelComponent[] wheels;

	public bool isOn = true;

	public bool isForciblyOff = false;

	private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_0035: 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_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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00b0: 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)
		WheelComponent wheelComponent = new WheelComponent();
		GameObject val = new GameObject(((Object)wheel).name + "WheelCollider");
		val.transform.parent = ((Component)this).transform;
		val.transform.position = wheel.position;
		val.transform.eulerAngles = ((Component)this).transform.eulerAngles;
		pos_y = val.transform.localPosition.y;
		WheelCollider val2 = (WheelCollider)val.AddComponent(typeof(WheelCollider));
		wheelComponent.wheel = wheel;
		wheelComponent.collider = val.GetComponent<WheelCollider>();
		wheelComponent.drive = drive;
		wheelComponent.pos_y = pos_y;
		wheelComponent.maxSteer = maxSteer;
		wheelComponent.startPos = val.transform.localPosition;
		wheelComponent.settings = setting;
		return wheelComponent;
	}

	private void Awake()
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_013e: 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_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: 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_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
		if (carSetting.automaticGear)
		{
			NeutralGear = false;
		}
		myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>();
		wheels = new WheelComponent[4];
		wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting);
		wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting);
		wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting);
		wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting);
		if (Object.op_Implicit((Object)(object)carSetting.carSteer))
		{
			steerCurAngle = carSetting.carSteer.localEulerAngles;
		}
		WheelComponent[] array = wheels;
		foreach (WheelComponent wheelComponent in array)
		{
			WheelCollider collider = wheelComponent.collider;
			collider.suspensionDistance = wheelComponent.settings.Distance;
			JointSpring suspensionSpring = collider.suspensionSpring;
			suspensionSpring.spring = carSetting.springs;
			suspensionSpring.damper = carSetting.dampers;
			collider.suspensionSpring = suspensionSpring;
			collider.radius = wheelComponent.settings.Radius;
			collider.mass = wheelComponent.settings.Weight;
			WheelFrictionCurve val = collider.forwardFriction;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f;
			((WheelFrictionCurve)(ref val)).extremumSlip = 2f;
			((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f;
			((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
			collider.forwardFriction = val;
			val = collider.sidewaysFriction;
			((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f;
			((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f;
			((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
			collider.sidewaysFriction = val;
		}
	}

	public void TurnOnEngine(bool forcibly)
	{
		if (!isForciblyOff)
		{
			isOn = true;
		}
		else if (forcibly)
		{
			isForciblyOff = false;
			isOn = true;
		}
	}

	public void TurnOffEngine(bool forcibly)
	{
		isForciblyOff = forcibly;
		isOn = false;
	}

	public void ShiftTo(int newGear)
	{
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		currentGear = newGear;
		if (currentGear == 0)
		{
			NeutralGear = true;
		}
		else
		{
			NeutralGear = false;
		}
		if (currentGear == -1)
		{
			currentGear = 0;
		}
	}

	public void ShiftUp(bool ignoreDelay)
	{
		float timeSinceLevelLoad = Time.timeSinceLevelLoad;
		if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1)
		{
			return;
		}
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		if (!carSetting.automaticGear)
		{
			if (currentGear == 0)
			{
				if (NeutralGear)
				{
					currentGear++;
					NeutralGear = false;
				}
				else
				{
					NeutralGear = true;
				}
			}
			else
			{
				currentGear++;
			}
		}
		else
		{
			currentGear++;
		}
		shiftDelay = timeSinceLevelLoad + 1f;
		shiftTime = 1.5f;
	}

	public void ShiftDown(bool ignoreDelay)
	{
		float timeSinceLevelLoad = Time.timeSinceLevelLoad;
		if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear))
		{
			return;
		}
		((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
		if (!carSetting.automaticGear)
		{
			if (currentGear == 1)
			{
				if (!NeutralGear)
				{
					currentGear--;
					NeutralGear = true;
				}
			}
			else if (currentGear == 0)
			{
				NeutralGear = false;
			}
			else
			{
				currentGear--;
			}
		}
		else
		{
			currentGear--;
		}
		shiftDelay = timeSinceLevelLoad + 0.1f;
		shiftTime = 2f;
	}

	private void OnCollisionEnter(Collision collision)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
		{
			VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>();
			Vector3 relativeVelocity = collision.relativeVelocity;
			component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f);
			myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f);
			myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z);
		}
	}

	private void OnCollisionStay(Collision collision)
	{
		if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
		{
			((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f;
		}
	}

	private void Update()
	{
	}

	private void FixedUpdate()
	{
		//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_00b6: 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_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_0709: Unknown result type (might be due to invalid IL or missing references)
		//IL_0751: Unknown result type (might be due to invalid IL or missing references)
		//IL_075a: Unknown result type (might be due to invalid IL or missing references)
		//IL_075f: Unknown result type (might be due to invalid IL or missing references)
		//IL_079b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ef2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f0c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f17: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f1c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f25: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d23: Unknown result type (might be due to invalid IL or missing references)
		if (!isOn)
		{
			accel = 0f;
		}
		Vector3 velocity = myRigidbody.velocity;
		speed = ((Vector3)(ref velocity)).magnitude * 2.7f;
		if (speed < lastSpeed - 10f && slip < 10f)
		{
			slip = lastSpeed / 15f;
		}
		lastSpeed = speed;
		if (slip2 != 0f)
		{
			slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f);
		}
		myRigidbody.centerOfMass = carSetting.shiftCentre;
		if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive)
		{
			accel = 0f;
		}
		if (Object.op_Implicit((Object)(object)carSetting.carSteer))
		{
			carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f);
		}
		if (carSetting.automaticGear && currentGear == 1 && accel < 0f)
		{
			if (speed < 5f)
			{
				ShiftDown(ignoreDelay: false);
			}
		}
		else if (carSetting.automaticGear && currentGear == 0 && accel > 0f)
		{
			if (speed < 5f)
			{
				ShiftUp(ignoreDelay: false);
			}
		}
		else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake)
		{
			ShiftUp(ignoreDelay: false);
		}
		else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1)
		{
			ShiftDown(ignoreDelay: false);
		}
		if (speed < 1f)
		{
			Backward = true;
		}
		if (currentGear != 0 || !Backward)
		{
			Backward = false;
		}
		Light[] brakeLights = carLights.brakeLights;
		foreach (Light val in brakeLights)
		{
			if (brake || accel < 0f || speed < 1f)
			{
				val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f);
			}
			else
			{
				val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f);
			}
			((Behaviour)val).enabled = val.intensity != 0f;
		}
		Light[] reverseLights = carLights.reverseLights;
		foreach (Light val2 in reverseLights)
		{
			if (speed > 2f && currentGear == 0)
			{
				val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f);
			}
			else
			{
				val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f);
			}
			((Behaviour)val2).enabled = val2.intensity != 0f;
		}
		wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f;
		float num = 0f;
		int num2 = 0;
		bool flag = false;
		int num3 = 0;
		WheelComponent[] array = wheels;
		WheelHit val4 = default(WheelHit);
		foreach (WheelComponent wheelComponent in array)
		{
			WheelCollider collider = wheelComponent.collider;
			if (wheelComponent.drive)
			{
				num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm)));
				num2++;
			}
			if (brake || accel < 0f)
			{
				if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3])))
				{
					if (brake && accel > 0f)
					{
						slip = Mathf.Lerp(slip, 5f, accel * 0.01f);
					}
					else if (speed > 1f)
					{
						slip = Mathf.Lerp(slip, 1f, 0.002f);
					}
					else
					{
						slip = Mathf.Lerp(slip, 1f, 0.02f);
					}
					wantedRPM = 0f;
					collider.brakeTorque = carSetting.brakePower;
					wheelComponent.rotation = w_rotate;
				}
			}
			else
			{
				float brakeTorque;
				if (accel == 0f || NeutralGear)
				{
					float num5 = (collider.brakeTorque = 1000f);
					brakeTorque = num5;
				}
				else
				{
					float num5 = (collider.brakeTorque = 0f);
					brakeTorque = num5;
				}
				collider.brakeTorque = brakeTorque;
				slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((!(speed > 100f)) ? (slip = Mathf.Lerp(slip, 1.5f, 0.02f)) : (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f))));
				w_rotate = wheelComponent.rotation;
			}
			WheelFrictionCurve val3 = collider.forwardFriction;
			((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f;
			((WheelFrictionCurve)(ref val3)).extremumSlip = 2f;
			((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f;
			((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
			collider.forwardFriction = val3;
			val3 = collider.sidewaysFriction;
			((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
			((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer);
			collider.sidewaysFriction = val3;
			if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f)
			{
				if (powerShift == 0f)
				{
					shifmotor = false;
				}
				powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f);
				carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f);
				if (!carSounds.nitro.isPlaying)
				{
					((Component)carSounds.nitro).GetComponent<AudioSource>().Play();
				}
				curTorque = ((!(powerShift > 0f)) ? carSetting.carPower : carSetting.shiftPower);
				carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
				carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
			}
			else
			{
				if (powerShift > 20f)
				{
					shifmotor = true;
				}
				carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f);
				if (carSounds.nitro.volume == 0f)
				{
					carSounds.nitro.Stop();
				}
				powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f);
				curTorque = carSetting.carPower;
				carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f);
				carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f);
			}
			wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f);
			wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f);
			wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f);
			Vector3 localPosition = wheelComponent.wheel.localPosition;
			if (collider.GetGroundHit(ref val4))
			{
				if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab))
				{
					if ((Object)(object)Particle[num3] == (Object)null)
					{
						Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity);
						((Object)Particle[num3]).name = "WheelParticle";
						Particle[num3].transform.parent = ((Component)this).transform;
						Particle[num3].AddComponent<AudioSource>();
						Particle[num3].GetComponent<AudioSource>().maxDistance = 50f;
						Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f;
						Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f;
						Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2;
					}
					ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>();
					bool flag2 = false;
					for (int l = 0; l < carSetting.hitGround.Length; l++)
					{
						if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[l].tag))
						{
							flag2 = carSetting.hitGround[l].grounded;
							if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f)
							{
								Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].brakeSound;
							}
							else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying)
							{
								Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].groundSound;
							}
							Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[l].brakeColor;
						}
					}
					if (flag2 && speed > 5f && !brake)
					{
						component.enableEmission = true;
						Particle[num3].GetComponent<AudioSource>().volume = 0.5f;
						if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
						{
							Particle[num3].GetComponent<AudioSource>().Play();
						}
					}
					else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f)
					{
						if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3])))
						{
							if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
							{
								Particle[num3].GetComponent<AudioSource>().Play();
							}
							component.enableEmission = true;
							Particle[num3].GetComponent<AudioSource>().volume = 10f;
						}
					}
					else
					{
						component.enableEmission = false;
						Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().volume, 0f, Time.deltaTime * 10f);
					}
				}
				localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius;
				localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y);
				flag = flag || wheelComponent.drive;
			}
			else
			{
				if ((Object)(object)Particle[num3] != (Object)null)
				{
					ParticleSystem component2 = Particle[num3].GetComponent<ParticleSystem>();
					component2.enableEmission = false;
				}
				localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance;
				myRigidbody.AddForce(Vector3.down * 5000f);
			}
			num3++;
			wheelComponent.wheel.localPosition = localPosition;
		}
		if (num2 > 1)
		{
			num /= (float)num2;
		}
		motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]);
		if (motorRPM > 5500f)
		{
			motorRPM = 5200f;
		}
		int num7 = (int)(motorRPM / efficiencyTableStep);
		if (num7 >= efficiencyTable.Length)
		{
			num7 = efficiencyTable.Length - 1;
		}
		if (num7 < 0)
		{
			num7 = 0;
		}
		float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7];
		WheelComponent[] array2 = wheels;
		foreach (WheelComponent wheelComponent2 in array2)
		{
			WheelCollider collider2 = wheelComponent2.collider;
			if (wheelComponent2.drive)
			{
				if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM))
				{
					collider2.motorTorque = 0f;
				}
				else
				{
					float motorTorque = collider2.motorTorque;
					if (!brake && accel != 0f && !NeutralGear)
					{
						if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0))
						{
							collider2.motorTorque = motorTorque * 0.9f + num8 * 1f;
						}
						else
						{
							collider2.motorTorque = 0f;
							collider2.brakeTorque = 2000f;
						}
					}
					else
					{
						collider2.motorTorque = 0f;
					}
				}
			}
			if (brake || slip2 > 2f)
			{
				collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f);
				continue;
			}
			float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle);
			collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9);
		}
		Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), 1f, 10f);
		shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f);
		if (Pitch == 1f)
		{
			carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f);
			carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f);
			carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f);
		}
		else
		{
			carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f);
			if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f)
			{
				carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f);
				carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f);
			}
			else
			{
				carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f);
				carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f);
			}
			carSounds.HighEngine.pitch = Pitch;
			carSounds.LowEngine.pitch = Pitch;
			PitchDelay = Pitch;
		}
		if (!isOn)
		{
			carSounds.IdleEngine.volume = 0f;
			carSounds.LowEngine.volume = 0f;
			carSounds.HighEngine.volume = 0f;
		}
	}

	private void OnDrawGizmos()
	{
		//IL_0026: 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_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (carSetting.showNormalGizmos && !Application.isPlaying)
		{
			Matrix4x4 matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale);
			Gizmos.matrix = matrix;
			Gizmos.color = new Color(1f, 0f, 0f, 0.5f);
			Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f));
			Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f);
		}
	}
}
namespace H3VRUtils.Vehicles
{
	[Serializable]
	public class VehicleDamagableMult
	{
		public float projectileMult = 1f;

		public float meleeMult = 1f;

		public float explosionMult = 1f;

		public float piercingMult = 1f;

		public float cuttingMult = 1f;

		public float thermalMult = 1f;

		public float bluntMult = 1f;

		public float totalKineticMult = 1f;
	}
	public class VehicleDamagable : MonoBehaviour
	{
		public float health;

		public float maxHealth;

		public float minHealth;

		public VehicleDamagableMult dmgMult;

		public VehicleControl vehicle;

		public bool dead;

		private float prevhealth;

		public virtual void FixedUpdate()
		{
			if (health < 0f)
			{
				if (!dead)
				{
					onDeath();
					dead = true;
				}
				whileDead();
			}
			else
			{
				if (dead)
				{
					onUndeath();
					dead = false;
				}
				whileUndead();
			}
			if (health < minHealth)
			{
				health = minHealth;
			}
			if (health != prevhealth)
			{
				onHealthChange();
			}
			prevhealth = health;
		}

		public virtual void onHealthChange()
		{
		}

		public bool HPLessThan(float num)
		{
			if (health < num)
			{
				return true;
			}
			return false;
		}

		public bool HPLessThanPercent(float num)
		{
			if (health < num * maxHealth)
			{
				return true;
			}
			return false;
		}

		public virtual void onDeath()
		{
		}

		public virtual void whileDead()
		{
		}

		public virtual void whileUndead()
		{
		}

		public virtual void onUndeath()
		{
		}

		public virtual void HealPercent(float percentHeal)
		{
			Heal(percentHeal * maxHealth);
			Debug.Log((object)("percenthealing for " + percentHeal));
		}

		public virtual void Heal(float heal)
		{
			health += heal;
			Debug.Log((object)("Healed for " + heal));
		}

		public virtual void Damage()
		{
		}

		public float getDamage()
		{
			return 0f;
		}
	}
	public class VehicleRepairTool : MonoBehaviour
	{
		public float percentHeal;

		private void OnCollisionEnter(Collision collision)
		{
			//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)
			Vector3 relativeVelocity = collision.relativeVelocity;
			if (!(((Vector3)(ref relativeVelocity)).magnitude < 2f))
			{
				VehicleDamagable component = collision.gameObject.GetComponent<VehicleDamagable>();
				if ((Object)(object)component != (Object)null)
				{
					component.HealPercent(percentHeal);
				}
			}
		}
	}
	internal class VehicleSeat : MonoBehaviour
	{
		public FVRViveHand hand;

		public GameObject SitPos;

		public GameObject EjectPos;

		public void Update()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hand != (Object)null)
			{
				((Component)hand.MovementManager).transform.position = SitPos.transform.position;
			}
		}
	}
}
namespace Plugin.src
{
	internal class thermiteFire : MonoBehaviour
	{
		public Vector2 angleX;

		public Vector2 angleY;

		public Vector2 velocity;

		public Vector2 durration;

		public Vector2 delay;

		public BallisticProjectile projToFire;

		private int fixedDurration;

		private int fixedDelay;

		private int fixedAngleX;

		private int fixedAngleY;

		private int fixedVelocity;
	}
}
namespace H3VRUtils
{
	public class FVRInteractableObjectProxy : MonoBehaviour
	{
	}
	public class HandgunEjectionTrigger : FVRInteractiveObject
	{
		public Handgun hgReceiver;
	}
}
namespace H3VRUtils.Proxy
{
	public class attachmentYFoldingStockProxy : FVRInteractableObjectProxy
	{
	}
}
namespace H3VRUtils.ProxyLoader
{
	public class attachmentYFoldingStockProxyLoader : MonoBehaviour
	{
	}
}
namespace FistVR
{
	internal class AR15HandleFlipperSounds : FVRInteractiveObject
	{
		public enum Axis
		{
			X,
			Y,
			Z
		}

		private bool m_isLargeAperture = true;

		public Transform Flipsight;

		public float m_flipsightStartRotX;

		public float m_flipsightEndRotX = -90f;

		private float m_flipsightCurRotX;

		public Axis RotAxis;

		private float m_curFlipLerp;

		private float m_tarFlipLerp;

		private float m_lastFlipLerp;

		public AudioEvent AudClipOpen;

		public AudioEvent AudClipClose;
	}
}
namespace H3VRUtils
{
	internal class ActivateSeveralFVRInteractiveAtOnce : FVRInteractiveObject
	{
		public List<FVRInteractiveObject> InteractiveObjects;
	}
}
namespace H3VRUtils.AlternatingMags
{
	internal class AlternatingMagMount
	{
		public GameObject MagMountWhenActive;

		public GameObject MagMountWhenInactive;

		[HideInInspector]
		public FVRFireArmMagazine curmag;

		public FVRFireArm firearm;

		[HideInInspector]
		public bool IsActive;
	}
	internal class AlternatingMagSingleSwitch : FVRInteractiveObject
	{
		public GameObject transformOnInactive;

		public GameObject transformOnActive;

		public AlternatingMagsHandler MagHandler;

		[Tooltip("Use the relevant number in the MagHandler's list of MagMounts.")]
		public int ConnectedMagMount;

		public AudioEvent ClickAudio;

		public void FixedUpdate()
		{
		}
	}
	internal class AlternatingMagsHandler
	{
		public bool AlternateOnEachShot;

		public List<AlternatingMagMount> MagMounts;

		public FVRFireArm firearm;

		[HideInInspector]
		public int activeMagMount;
	}
}
namespace H3VRUtils.FVRInteractiveObjects
{
	public class AttachableChargingHandle : MultipleChargingHandleClosedBolt
	{
		public FVRFireArmAttachment attachment;

		private ClosedBoltWeapon weapon;
	}
	internal class AutoRackOnMagLoad : MonoBehaviour
	{
		public FVRFireArm weapon;

		private Handgun hg;

		private ClosedBoltWeapon cbw;

		private OpenBoltReceiver obr;

		private bool WasLoaded;

		public void Start()
		{
			if (weapon is Handgun)
			{
				ref Handgun reference = ref hg;
				FVRFireArm obj = weapon;
				reference = (Handgun)(object)((obj is Handgun) ? obj : null);
			}
			if (weapon is ClosedBoltWeapon)
			{
				ref ClosedBoltWeapon reference2 = ref cbw;
				FVRFireArm obj2 = weapon;
				reference2 = (ClosedBoltWeapon)(object)((obj2 is ClosedBoltWeapon) ? obj2 : null);
			}
			if (weapon is Handgun)
			{
				ref OpenBoltReceiver reference3 = ref obr;
				FVRFireArm obj3 = weapon;
				reference3 = (OpenBoltReceiver)(object)((obj3 is OpenBoltReceiver) ? obj3 : null);
			}
		}

		public void FixedUpdate()
		{
			if ((Object)(object)weapon.Magazine != (Object)null)
			{
				if (!WasLoaded)
				{
					if ((Object)(object)hg != (Object)null)
					{
					}
					if ((Object)(object)cbw != (Object)null)
					{
					}
					if (!((Object)(object)obr != (Object)null))
					{
					}
				}
				WasLoaded = true;
			}
			else
			{
				WasLoaded = false;
			}
		}
	}
}
namespace H3VRUtils
{
	internal class BetterMagReleaseLatch : MonoBehaviour
	{
		[FormerlySerializedAs("FireArm")]
		public FVRFireArm fireArm;

		[FormerlySerializedAs("Joint")]
		public HingeJoint joint;

		private float _timeSinceLastCollision = 6f;

		[Tooltip("Greatly reduce what you think it may be. I recommend 2 for Sensitivity.")]
		public float jointReleaseSensitivity = 2f;

		[HideInInspector]
		public float jointAngle;

		[FormerlySerializedAs("_jointReleaseSensitivityAbove")]
		[HideInInspector]
		public float jointReleaseSensitivityAbove;

		[FormerlySerializedAs("_jointReleaseSensitivityBelow")]
		[HideInInspector]
		public float jointReleaseSensitivityBelow;

		private bool _isMagazineNotNull;

		[HideInInspector]
		public float basex;
	}
	public class BreakOpenFlareGun : FVRFireArm
	{
		[Header("Flaregun Params")]
		public Renderer[] GunUndamaged;

		public Renderer[] GunDamaged;

		public FVRFireArmChamber Chamber;

		public Axis HingeAxis;

		public Transform Hinge;

		public float RotOut = 35f;

		public bool CanUnlatch = true;

		public bool IsHighPressureTolerant;

		private bool m_isHammerCocked;

		private bool m_isTriggerReset = true;

		private bool m_isLatched = true;

		private bool m_isDestroyed;

		private float TriggerFloat;

		public Transform Hammer;

		public bool HasVisibleHammer = true;

		public bool CanCockHammer = true;

		public bool CocksOnOpen;

		private float m_hammerXRot;

		public Axis HammerAxis;

		public InterpStyle HammerInterp = (InterpStyle)1;

		public float HammerMinRot;

		public float HammerMaxRot = -70f;

		public Transform Trigger;

		public Vector2 TriggerForwardBackRots;

		public Transform Muzzle;

		public ParticleSystem SmokePSystem;

		public ParticleSystem DestroyPSystem;

		public bool DeletesCartridgeOnFire;
	}
}
namespace H3VRUtils.FVRInteractiveObjects
{
	internal class GoToNearestSosig : MonoBehaviour
	{
		public float speed;

		public Rigidbody rigidbody;

		[Tooltip("Change this if you want the object to throw itself to a different tag")]
		public string TagOverride;

		public void Start()
		{
			//IL_004b: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(TagOverride))
			{
				TagOverride = "AgentBody";
			}
			GameObject[] array = GameObject.FindGameObjectsWithTag(TagOverride);
			if (array.Length == 0)
			{
				return;
			}
			GameObject val = null;
			float num = 999999f;
			for (int i = 0; i < array.Length; i++)
			{
				float num2 = Vector3.Distance(((Component)this).transform.position, array[i].transform.position);
				if (num2 < num)
				{
					val = array[i];
					num = num2;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"The nearest sosig is over a full 1,000 kms away, what the fuck are you doing?");
				return;
			}
			((Component)this).transform.LookAt(val.transform);
			rigidbody.velocity = new Vector3(0f, 0f, speed);
		}
	}
	public class GrenadeOneHandArm : MonoBehaviour
	{
		public PinnedGrenade grenade;

		[Tooltip("Trigger is a terrible idea for this. Please don't use trigger. I mean, i can't stop you, but i dont recommend it.")]
		public H3VRUtilsMagRelease.TouchpadDirType dirType;

		private Vector2 dir;

		public bool kickOutLever;
	}
}
namespace H3VRUtils
{
	public class H3VRUtilsMagRelease : FVRInteractiveObject
	{
		public enum TouchpadDirType
		{
			Up,
			Down,
			Left,
			Right,
			Trigger,
			NoDirection
		}

		public ClosedBoltWeapon ClosedBoltReceiver;

		public OpenBoltReceiver OpenBoltWeapon;

		public Handgun HandgunReceiver;

		public BoltActionRifle BoltActionWeapon;

		[HideInInspector]
		public int WepType;

		[HideInInspector]
		public bool DisallowEjection;

		private Collider col;

		public bool PressDownToRelease;

		public TouchpadDirType TouchpadDir;

		[HideInInspector]
		public Vector2 dir;
	}
	internal class H3VRUtilsPhysBoltRelease : FVRInteractiveObject
	{
		public enum TouchpadDirType
		{
			Up,
			Down,
			Left,
			Right,
			Trigger
		}

		public ClosedBoltWeapon ClosedBoltReceiver;

		[HideInInspector]
		public OpenBoltReceiver OpenBoltWeapon;

		[HideInInspector]
		public Handgun HandgunReceiver;

		public bool ButtonPressToRelease;

		public TouchpadDirType TouchpadDir;

		[HideInInspector]
		public int WepType = 0;
	}
	internal class HandgunSecondarySwitch : FVRInteractiveObject
	{
		public Handgun Weapon;

		public int CurModeIndex;

		public int ModeIndexToSub = 1;

		public Transform SelctorSwitch;

		public Axis Axis;

		public InterpStyle InterpStyle;

		public FireSelectorMode[] Modes;
	}
}
namespace H3VRUtils.FVRInteractiveObjects
{
	public class MultipleChargingHandleClosedBolt : ClosedBoltHandle
	{
		public void BeginInteraction(FVRViveHand hand)
		{
			if (!((Object)(object)((FVRInteractiveObject)base.Weapon.Handle).m_hand != (Object)null))
			{
				base.Weapon.Handle = (ClosedBoltHandle)(object)this;
			}
		}
	}
}
namespace H3VRUtils.Weapons.NadeCup
{
	internal class NadeCupLauncher : MonoBehaviour
	{
		public FVRFireArmChamber mainChamber;

		public FVRFireArmChamber nadeCup;

		public bool alreadyFired;
	}
}
namespace H3VRUtils
{
	internal class OpenBoltBurstFire : MonoBehaviour
	{
		public OpenBoltReceiver Receiver;

		[Tooltip("Selector setting position that will be burst. Remember, selectors go pos: 0, 1 ,2, not 1, 2, 3")]
		public int SelectorSetting;

		public int BurstAmt;

		private int BurstSoFar;

		private bool wasLoaded;

		public void Start()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2;
		}

		public void Update()
		{
		}

		public void lockUp()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)0;
		}

		public void unLock()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			BurstSoFar = 0;
			Receiver.FireSelector_Modes[SelectorSetting].ModeType = (FireSelectorModeType)2;
		}
	}
	internal class AttachmentModifyFirearm : MonoBehaviour
	{
		public enum actionType
		{
			attach,
			detach
		}

		public enum CapType
		{
			AddTo,
			SetTo
		}

		private FVRFireArmAttachment attachment;

		private FVRFireArm weapon;

		[Header("Recoil Modifier")]
		public bool ChangesRecoil;

		private FVRFireArmRecoilProfile originalRecoil;

		public FVRFireArmRecoilProfile modifiedRecoil;

		[Header("Magazine Modifer")]
		public bool ChangesMagCapacity;

		private int prevCapacity;

		public CapType CapacityModifierType;

		[Tooltip("Keep it off unless you're sure it should apply to non-internal mags.")]
		public bool applyToNonInternalMags;

		public int setCapacityTo;

		[Header("Bolt Speed Modifier")]
		public bool ChangesBoltSpeed;

		public bool ChangesBoltSpeedForward;

		public bool ChangesBoltSpeedRearward;

		public bool ChangesBoltSpeedStiffness;

		public CapType BoltSpeedModifierType;

		public float BoltSpeedForward;

		private float prevBoltSpeedForward;

		public float BoltSpeedBackwards;

		private float prevBoltSpeedBackwards;

		public float BoltSpringStiffness;

		private float prevBoltSpringStiffness;

		[HideInInspector]
		public bool ChangesSpread;

		[HideInInspector]
		public float spreadmult;

		[Header("GrabPos Modifier")]
		public bool ChangesGrabPos;

		public Transform NewPoseOverride;

		private Transform oldPoseOverride;

		public Transform NewPoseOverrideTouch;

		private Transform oldPoseOverrideTouch;
	}
	internal class DisplayOnAttached : MonoBehaviour
	{
		public GameObject displayOnAttach;

		public FVRFireArmAttachmentMount AttachmentMount;
	}
	internal class attachmentXFoldingStock : FVRFoldingStockXAxis
	{
		public FVRFireArmAttachment attachment;
	}
	public class attachmentYFoldingStock : FVRInteractiveObject
	{
		public enum StockPos
		{
			Closed,
			Mid,
			Open
		}

		[FormerlySerializedAs("Root")]
		public Transform root;

		[FormerlySerializedAs("Stock")]
		public Transform stock;

		public float minRot;

		public float maxRot;

		[Tooltip("Default 5; this is the angle diff at which point the stock clamps to closed/open. (AKA: if angle is 4, and minRot is 0, the difference is less than 5, so it just clamps to 0.)")]
		public float clampStrength = 5f;

		[FormerlySerializedAs("m_curPos")]
		public StockPos mCurPos;

		[FormerlySerializedAs("m_lastPos")]
		public StockPos mLastPos;

		public bool isMinClosed = true;

		[FormerlySerializedAs("FireArm")]
		[Tooltip("Leave as null if attachment.")]
		public FVRFireArm fireArm;

		public FVRFireArmAttachment attachment;

		[Header("Alternate Use Settings")]
		[Tooltip("If true, it will not affect the stock point.")]
		public bool isNotAttachment;

		public bool forBreakOpenFlareGun;

		public BreakOpenFlareGun flareGun;

		public float _rotAngle;

		[HideInInspector]
		public Vector3 lhs;

		public GameObject hand;

		public void Update()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0060: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = hand.transform.position - root.position;
			Vector3 val2 = Vector3.ProjectOnPlane(val, root.up);
			val = ((Vector3)(ref val2)).normalized;
			Vector3 val3 = -((Component)root).transform.forward;
			_rotAngle = Mathf.Atan2(Vector3.Dot(root.up, Vector3.Cross(val3, val)), Vector3.Dot(val3, val)) * 57.29578f;
			if (Mathf.Abs(_rotAngle - minRot) < 5f && Mathf.Abs(_rotAngle - minRot) < 5f)
			{
				_rotAngle = minRot;
			}
			if (Mathf.Abs(_rotAngle - maxRot) < 5f)
			{
				_rotAngle = maxRot;
			}
			if (!(_rotAngle >= minRot) || !(_rotAngle <= maxRot))
			{
				return;
			}
			stock.localEulerAngles = new Vector3(0f, _rotAngle, 0f);
			float num = Mathf.InverseLerp(minRot, maxRot, _rotAngle);
			if (!((Object)(object)fireArm != (Object)null))
			{
				return;
			}
			if (isMinClosed)
			{
				if (num < 0.02f)
				{
					mCurPos = (StockPos)0;
					if (isNotAttachment)
					{
						fireArm.HasActiveShoulderStock = false;
					}
				}
				else if (num > 0.9f)
				{
					mCurPos = (StockPos)2;
					if (isNotAttachment)
					{
						fireArm.HasActiveShoulderStock = true;
					}
				}
				else
				{
					mCurPos = (StockPos)1;
					if (isNotAttachment)
					{
						fireArm.HasActiveShoulderStock = false;
					}
				}
			}
			else if (num < 0.1f)
			{
				mCurPos = (StockPos)2;
				if (isNotAttachment)
				{
					fireArm.HasActiveShoulderStock = true;
				}
			}
			else if (num > 0.98f)
			{
				mCurPos = (StockPos)0;
				if (isNotAttachment)
				{
					fireArm.HasActiveShoulderStock = false;
				}
			}
			else
			{
				mCurPos = (StockPos)1;
				if (isNotAttachment)
				{
					fireArm.HasActiveShoulderStock = false;
				}
			}
			mLastPos = mCurPos;
		}

		private void OnDrawGizmosSelected()
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_016b: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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_01f1: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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)
			if (Application.isPlaying)
			{
				Gizmos.color = new Color(0.1f, 0.3f, 0.9f);
				Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * 0.025f);
				Gizmos.color = new Color(0.1f, 0.3f, 0.9f, 0.5f);
				Gizmos.DrawCube(((Component)stock).transform.position, Vector3.one * 0.025f);
				float timeSinceLevelLoad = Time.timeSinceLevelLoad;
				Gizmos.color = new Color(0.1f, 0.7f, 0.9f, Mathf.Clamp01((0.5f - timeSinceLevelLoad) * 2f));
				Gizmos.DrawWireCube(((Component)stock).transform.position, Vector3.one * (0.1f * (timeSinceLevelLoad + 0.5f)));
			}
			Vector3 val = ((Component)stock).transform.position + -((Component)stock).transform.forward;
			Gizmos.color = new Color(0.7f, 0.9f, 0.1f);
			Gizmos.DrawWireCube(val, Vector3.one * 0.02f);
			Gizmos.color = new Color(0.7f, 0.9f, 0.1f, 0.5f);
			Gizmos.DrawCube(val, Vector3.one * 0.02f);
			Gizmos.color = new Color(0.9f, 0.7f, 0.1f);
			Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(minRot, ((Component)this).transform.right) * ((Component)this).transform.up);
			Gizmos.DrawRay(((Component)this).transform.position, Quaternion.AngleAxis(0f - maxRot, ((Component)this).transform.right) * ((Component)this).transform.up);
		}
	}
}
namespace H3VRUtils.customItems.shotClock
{
	internal class shotClock : MonoBehaviour
	{
		public enum screen
		{
			shot,
			register,
			delay
		}

		public string stopclocktextstring;

		public Vector2 startingTimeWindow = new Vector2(2f, 5f);

		public float stopclock;

		public int shotsfired;

		public float regmaxdist = 0.5f;

		public GameObject startbutton;

		public GameObject stopbutton;

		public bool isClockOn;

		public bool isInDelayProcess;

		public Text stopclocktext;

		public Text lastshottext;

		public Text shotsfiredtext;

		public Text delaymintext;

		public Text delaymaxtext;

		private float waittime;

		public FVRFireArmChamber[] registery;

		private bool[] registerySpent;

		public Text[] weptext;

		public BoxCollider registertrigger;

		public GameObject[] chambersInScene;

		private bool alreadyInRegisteryFlag;

		public float[] distfromshotclock;

		public screen currentScreen;

		public void Awake()
		{
			registerySpent = new bool[11];
		}

		public void startClockProcess()
		{
			waittime = Random.Range(startingTimeWindow.x, startingTimeWindow.y);
			isInDelayProcess = true;
		}

		private void Update()
		{
			if (isClockOn)
			{
				stopclock += Time.deltaTime;
				stopclocktext.text = updateStopClockTextString();
			}
			if (isInDelayProcess)
			{
				stopclock += Time.deltaTime;
				if (stopclock > waittime)
				{
					isInDelayProcess = false;
					StartClock();
				}
			}
			if (isClockOn || isInDelayProcess)
			{
				startbutton.SetActive(false);
				stopbutton.SetActive(true);
			}
			else
			{
				startbutton.SetActive(true);
				stopbutton.SetActive(false);
			}
			for (int i = 0; i < registery.Length; i++)
			{
				if (!((Object)(object)registery[i] != (Object)null))
				{
					continue;
				}
				if (registery[i].IsSpent)
				{
					if (!registerySpent[i])
					{
						registerySpent[i] = true;
						ShotDetected();
					}
				}
				else
				{
					registerySpent[i] = false;
				}
			}
		}

		private void updateRegistery()
		{
			//IL_0039: 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)
			chambersInScene = GameObject.FindGameObjectsWithTag("FVRFireArmChamber");
			distfromshotclock = new float[chambersInScene.Length];
			for (int i = 0; i < chambersInScene.Length; i++)
			{
				distfromshotclock[i] = Vector3.Distance(((Component)this).transform.position, chambersInScene[i].transform.position);
				if (!(distfromshotclock[i] < regmaxdist))
				{
					continue;
				}
				FVRFireArmChamber component = chambersInScene[i].GetComponent<FVRFireArmChamber>();
				FVRFireArmChamber[] array = registery;
				foreach (FVRFireArmChamber val in array)
				{
					if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)component)
					{
						alreadyInRegisteryFlag = true;
					}
				}
				if (alreadyInRegisteryFlag)
				{
					continue;
				}
				Debug.Log((object)("Ready to load " + chambersInScene[i]));
				for (int k = 0; k < registery.Length; k++)
				{
					if ((Object)(object)registery[k] == (Object)null)
					{
						registery[k] = chambersInScene[i].GetComponent<FVRFireArmChamber>();
						Debug.Log((object)string.Concat(registery[k], " loaded successfully from ", distfromshotclock[i], " units away!"));
						break;
					}
				}
				updateRegisteryText();
			}
		}

		public void updateRegisteryText()
		{
			for (int i = 0; i < registery.Length; i++)
			{
				if ((Object)(object)registery[i] != (Object)null)
				{
					weptext[i].text = ((object)((Component)registery[i]).transform.root).ToString();
				}
				else
				{
					weptext[i].text = "EMPTY";
				}
			}
		}

		public string updateStopClockTextString()
		{
			stopclocktextstring = "";
			TimeSpan timeSpan = TimeSpan.FromSeconds(stopclock);
			if (timeSpan.Minutes < 10)
			{
				stopclocktextstring += "0";
			}
			stopclocktextstring = stopclocktextstring + timeSpan.Minutes + ":";
			if (timeSpan.Seconds < 10)
			{
				stopclocktextstring += "0";
			}
			stopclocktextstring = stopclocktextstring + timeSpan.Seconds + ":";
			if (timeSpan.Milliseconds < 100)
			{
				stopclocktextstring += "0";
				if (timeSpan.Milliseconds < 10)
				{
					stopclocktextstring += "0";
				}
			}
			stopclocktextstring += Math.Round((double)timeSpan.Milliseconds, 3);
			return stopclocktextstring;
		}

		public void StartClock()
		{
			isClockOn = true;
			stopclock = 0f;
		}

		public void StopClock()
		{
			isClockOn = false;
			stopclock = 0f;
		}

		public void ShotDetected()
		{
			if (isClockOn)
			{
				TimeSpan timeSpan = TimeSpan.FromSeconds(stopclock);
				lastshottext.text = updateStopClockTextString();
			}
		}
	}
	internal class shotClockButton : FVRPhysicalObject
	{
		public enum buttonType
		{
			start,
			stop,
			register,
			delay
		}

		public shotClock shotclock;

		public bool pressed;

		public buttonType button;

		public void Update()
		{
			if (pressed)
			{
				pressed = false;
				SimpleInteraction(null);
			}
		}

		public void SimpleInteraction(FVRViveHand hand)
		{
			switch (button)
			{
			case buttonType.start:
				shotclock.startClockProcess();
				break;
			case buttonType.stop:
				shotclock.StopClock();
				break;
			case buttonType.register:
				break;
			case buttonType.delay:
				break;
			}
		}
	}
}
namespace H3VRUtils
{
	internal class lockToHead : MonoBehaviour
	{
		public void Update()
		{
		}
	}
}
namespace H3VRUtils.MonoScripts.UIModifiers
{
	public class DispBulletAmount : MonoBehaviour
	{
		[Header("Only fill out one of these.")]
		public FVRFireArm firearm;

		public FVRFireArmMagazine magazine;

		public FVRFireArmAttachment attachment;

		[Header("Ammo Counter Settings")]
		[Tooltip("Text to display ammo left in the gun.")]
		public Text UItext;

		[Tooltip("Text to display maximum ammo.")]
		public Text MaxAmmoText;

		[Tooltip("Text to display the type of ammo.")]
		public Text ammoTypeText;

		[Tooltip("Adds a minimum character count. See tooltip for MinCharLength for more.")]
		public bool AddMinCharLength;

		[Tooltip("i.e if MinCharLength is 2 and the amount of rounds left is 5, it will display 05 instead of 5.")]
		public int MinCharLength;

		[Tooltip("Will not instantly be the correct amount of rounds, but will tick up/down until it is.")]
		public bool enableDispLerp;

		[Tooltip("MaxAmmo will also lerp according to the DispLerpAmt")]
		public bool enableLerpForMaxAmmo;

		[Tooltip("EnabledObjects will also lerp according to the DispLerpAmt")]
		public bool enableLerpForEnabledObjects;

		[Tooltip("From 0-1. The % amount moved towards its correct amount every 50th of a second.")]
		[Range(0f, 0.2f)]
		public float DispLerpAmt;

		[Header("Alternate Displays")]
		[Tooltip("Enables enabling/disabling objects based on rounds left in mag.")]
		public bool EnabledObjects;

		[Tooltip("Object enabled when there is no magazine.")]
		public GameObject ObjectWhenEmpty;

		[Tooltip("Element no. corresponds to rounds left. 0 means no rounds, 1 means one round. Enables the 5th object if there are 5 rounds, and so on.")]
		public List<GameObject> Objects;

		[Tooltip("Enables all objects under the round count. Enables the 0th, 1st, 2nd, 3rd objects if there are 3 rounds left, and so on.")]
		public bool EnableAllUnderAmount;

		[Tooltip("Overrides Objects. #0 means Objects' #0 displays from 0% to #0%, #1 means Objects' #1 displays from #0% to #1%, etc- written normally, not mathmatically (e.g 57.32)")]
		public bool EnableBasedOnPercentage;

		public List<float> ObjectPercentages;

		private FVRFireArm _fa;

		private FVRFireArmMagazine _mag;

		private int lastAmountOfBullets;

		private int lastAmountOfMaxBullets;

		private int lastAmountOfBulletsForEnableObjects;
	}
}
namespace H3VRUtils.MonoScripts.VisualModifiers
{
	internal class AnimPlayOnGrab : MonoBehaviour
	{
		public Animation animation;

		public FVRPhysicalObject Object;

		public string AnimNameOnGrab;

		public string AnimNameOnLetGo;

		private bool isGrabbed;

		public void Update()
		{
			if (animation.isPlaying)
			{
				return;
			}
			if ((Object)(object)((FVRInteractiveObject)Object).m_hand != (Object)null)
			{
				if (!isGrabbed)
				{
					animation.Play(AnimNameOnGrab);
					isGrabbed = true;
				}
			}
			else if (isGrabbed)
			{
				animation.Play(AnimNameOnLetGo);
				isGrabbed = false;
			}
		}
	}
	internal class ConstantSpin : MonoBehaviour
	{
		public GameObject spinnything;

		public float spinrate;

		public cullOnZLoc.dirType directionofspeen;

		public void FixedUpdate()
		{
			//IL_0003: 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)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))[(int)directionofspeen] = spinrate;
			spinnything.transform.Rotate(val);
		}
	}
	internal class CycleOnBoltRelease : MonoBehaviour
	{
		public FVRFireArmChamber chamber;

		public GameObject muzzle;

		public List<Transform> Locs;

		private int pointer;

		private bool wasFull;

		public void Update()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (wasFull && !chamber.IsFull)
			{
				pointer++;
				if (pointer > Locs.Count)
				{
					pointer = 0;
				}
				muzzle.transform.position = Locs[pointer].position;
				muzzle.transform.rotation = Locs[pointer].rotation;
			}
			wasFull = chamber.IsFull;
		}
	}
	internal class FeedRamp : MonoBehaviour
	{
		public GameObject Carrier;

		public FVRFireArm firearm;

		public float CarrierDetectDistance;

		public Vector2 CarrierRots;

		public Transform CarrierComparePoint1;

		public Transform CarrierComparePoint2;

		private float m_curCarrierRot;

		private float m_tarCarrierRot;
	}
}
namespace H3VRUtils
{
	internal class InvisibleMagOnLoad : MonoBehaviour
	{
		public FVRFireArmMagazine magazine;

		public void Update()
		{
			if ((Object)(object)magazine.FireArm != (Object)null)
			{
				((Component)magazine.Viz).gameObject.SetActive(false);
			}
			else
			{
				((Component)magazine.Viz).gameObject.SetActive(true);
			}
		}
	}
	public class MagFollower : MonoBehaviour
	{
		[Header("Only fill out one of the ones below.")]
		public FVRFireArmMagazine magazine;

		public FVRFireArmClip clip;

		public GameObject follower;

		[Header("Translation Mag Follower")]
		public bool UsesOneRoundPos;

		[Tooltip("The round count where the follower starts moving (e.g 20)")]
		public int StartAtRoundCount;

		[Tooltip("The round count where the follower stops moving (e.g 0)")]
		public int StopAtRoundCount;

		[Tooltip("The position where the follower should be when the magazine is full.")]
		public GameObject StartPos;

		[Tooltip("The position where the follower should be when the magazine has one round left.")]
		public GameObject OneRoundPos;

		[Tooltip("The position where the follower should be when the magazine is empty.")]
		public GameObject StopPos;

		[Header("Individual Point Mag Follower")]
		public bool UsesIndivdualPointMagFollower;

		[Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")]
		public List<GameObject> Positions;

		[Header("Individual Mesh Replacement")]
		public bool UsesIndividualMeshReplacement;

		[Tooltip("Top-to-bottom order, where the 0th position is when the magazine is empty. ")]
		public List<Mesh> Meshes;

		private int magrounds;

		private MeshFilter followerFilter;

		public void Update()
		{
			if (magazine.m_numRounds != magrounds)
			{
				magrounds = magazine.m_numRounds;
				UpdateDisp();
			}
		}

		public void Start()
		{
			followerFilter = follower.GetComponent<MeshFilter>();
		}

		public void UpdateDisp()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			if (UsesOneRoundPos)
			{
				Transform transform = StopPos.transform;
				int num = StopAtRoundCount;
				if (UsesOneRoundPos)
				{
					transform = OneRoundPos.transform;
					num++;
				}
				follower.transform.position = Vector3.Lerp(StartPos.transform.position, transform.position, Mathf.InverseLerp((float)StartAtRoundCount, (float)num, (float)magazine.m_numRounds));
				if (magazine.m_numRounds == 0)
				{
					follower.transform.position = StopPos.transform.position;
				}
			}
			if (UsesIndivdualPointMagFollower)
			{
				if (Positions.Count < magazine.m_numRounds || (Object)(object)Positions[magazine.m_numRounds] == (Object)null)
				{
					return;
				}
				follower.transform.position = Positions[magazine.m_numRounds].transform.position;
				follower.transform.rotation = Positions[magazine.m_numRounds].transform.rotation;
			}
			if (UsesIndivdualPointMagFollower)
			{
				if (Positions.Count < magazine.m_numRounds || (Object)(object)Positions[magazine.m_numRounds] == (Object)null)
				{
					return;
				}
				follower.transform.position = Positions[magazine.m_numRounds].transform.position;
				follower.transform.rotation = Positions[magazine.m_numRounds].transform.rotation;
			}
			if (UsesIndividualMeshReplacement && Meshes.Count >= magazine.m_numRounds && !((Object)(object)Meshes[magazine.m_numRounds] == (Object)null))
			{
				followerFilter.mesh = Meshes[magazine.m_numRounds];
				followerFilter.mesh = Meshes[magazine.m_numRounds];
			}
		}
	}
}
namespace H3VRUtils.MonoScripts.VisualModifiers
{
	public class ManipulateObject : MonoBehaviour
	{
		public enum dirtype
		{
			x,
			y,
			z,
			w
		}

		public enum transformtype
		{
			position,
			rotation,
			scale,
			quaternion,
			quaternionPresentedEuler
		}

		public enum dir
		{
			both,
			towardsStop,
			towardsStart
		}

		public enum StreamlinedDirType
		{
			AX_Button,
			BY_Button,
			Trigger
		}

		[Header("Object Being Observed")]
		public GameObject ObservedObject;

		public dirtype DirectionOfObservation;

		public transformtype TransformationTypeOfObservedObject;

		public float StartOfObservation;

		public float StopOfObservation;

		public dir ObservationDirection;

		[Header("Object Being Affected")]
		public GameObject AffectedObject;

		public dirtype DirectionOfAffection;

		public transformtype TransformationTypeOfAffectedObject;

		public float StartOfAffected;

		public float StopOfAffected;

		[Header("General Modifiers")]
		[Tooltip("Affected object will move itself over time to the expected position, instead of immediately. Recommended from 5-40. Defaults to 100 for effectively instant movement.")]
		public float LerpAmount = 100f;

		public bool usesCurve;

		[Tooltip("X/Y axis must be 0 to 1.")]
		public AnimationCurve Curve;

		[Header("Debug Values")]
		public float observationpoint;

		public float observationDistancePc;

		public float finalPoint;

		public float previousObservationDistancePc;

		public float previousFinalPoint;

		public float finalLerpAmt;

		private float rememberLerpPoint = -999f;

		[Header("Special Observations")]
		[Tooltip("When the observed object reaches or exceeds the stopofobservation, the affected object will snap back to the startofaffected, and will only reset when the observed object reaches the startofobserved.")]
		[Header("Snap Forwards")]
		public bool SnapForwardsOnMax;

		public bool SnappedForwards;

		public float SnapBackAt;

		[Tooltip("If off, it will 'unsnap' when under the bounds of Start Of Observation, Stop Of Observation, and Snap Back At. When on, it will unsnap when above all of those.")]
		public bool ResetIfOverBounds;

		[Tooltip("When on, it will lock when at its max, rather than snapping forward.")]
		public bool LockForward;

		[Header("Move On Touch Pad")]
		public bool ReadHandTouchpadMovement;

		public FVRInteractiveObject ItemToReadFrom;

		public H3VRUtilsMagRelease.TouchpadDirType DirToRead;

		public StreamlinedDirType DirToReadStreamlined;

		[Header("Move On Mag Loaded")]
		public bool ReadIfGunIsLoaded;

		public FVRFireArm FirearmToReadFrom;

		[Header("Move If Bolt Locked - Closed Bolt Only")]
		public bool ReadIfBoltIsLocked;

		public ClosedBolt BoltToReadFrom;

		[Header("Move If Specific Attachment Attached")]
		public bool MoveIfSpecificAttachmentAttached;

		public List<string> AttachmentIDs;

		public FVRFireArmAttachmentMount AttachmentMount;

		private int rememberAttached;

		private float lastDecision;

		[Header("Move If Object Held")]
		public bool MoveIfObjectHeld;

		public FVRInteractiveObject HeldObject;

		private bool _isObservedObjectNotNull;

		[Header("Move If Grenade Armed")]
		public bool MoveIfGrenadeArmed;

		public PinnedGrenade grenade;

		[Header("Move If Disabled")]
		public bool MoveIfDisabled;

		[Header("Move If Chamber Full")]
		public bool MoveIfChamberFull;

		public FVRFireArmChamber Chamber;

		public bool considerFullEvenIfRoundFired;

		[Header("Special Affected Things")]
		[Header("Move Attached Items")]
		public bool MoveAttachedItems;

		[Tooltip("NOTE: THIS ONLY APPLIES TO THE FIRST ATTACHMENT IN THE MOUNT.")]
		public FVRFireArmAttachmentMount MAImount;

		[Header("Disable If Observed Object Moved")]
		public bool DisableIfMoved;

		[Tooltip("The percentage (from 0-1, not 0-100) at which point it disables. NOTE: IF SCRIPT IS ON DISABLED OBJECT, WILL NOT REENABLE")]
		[Range(0f, 1f)]
		public float percentageCutoff;

		private void Start()
		{
			_isObservedObjectNotNull = (Object)(object)ObservedObject != (Object)null;
		}

		public void Update()
		{
			//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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Invalid comparison between Unknown and I4
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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_0392: Invalid comparison between Unknown and I4
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Unknown result type (might be due to invalid IL or missing references)
			//IL_074d: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0821: Unknown result type (might be due to invalid IL or missing references)
			//IL_0838: Unknown result type (might be due to invalid IL or missing references)
			//IL_083d: Unknown result type (might be due to invalid IL or missing references)
			//IL_085d: Unknown result type (might be due to invalid IL or missing references)
			previousObservationDistancePc = observationDistancePc;
			observationDistancePc = 0f;
			if (_isObservedObjectNotNull)
			{
				switch (TransformationTypeOfObservedObject)
				{
				case transformtype.position:
				{
					Vector3 localPosition = ObservedObject.transform.localPosition;
					observationpoint = ((Vector3)(ref localPosition))[(int)DirectionOfObservation];
					break;
				}
				case transformtype.rotation:
				{
					Vector3 localEulerAngles = ObservedObject.transform.localEulerAngles;
					observationpoint = ((Vector3)(ref localEulerAngles))[(int)DirectionOfObservation];
					break;
				}
				case transformtype.scale:
				{
					Vector3 localScale = ObservedObject.transform.localScale;
					observationpoint = ((Vector3)(ref localScale))[(int)DirectionOfObservation];
					break;
				}
				case transformtype.quaternion:
				{
					Quaternion localRotation2 = ObservedObject.transform.localRotation;
					observationpoint = ((Quaternion)(ref localRotation2))[(int)DirectionOfObservation];
					break;
				}
				case transformtype.quaternionPresentedEuler:
				{
					Quaternion localRotation = ObservedObject.transform.localRotation;
					observationpoint = ((Quaternion)(ref localRotation))[(int)DirectionOfObservation] * 180f;
					break;
				}
				}
				observationDistancePc = Mathf.InverseLerp(StartOfObservation, StopOfObservation, observationpoint);
			}
			if (SnapForwardsOnMax)
			{
				bool flag = observationpoint <= Math.Min(StopOfObservation, Math.Min(StartOfObservation, SnapBackAt));
				bool flag2 = observationpoint >= Math.Max(StopOfObservation, Math.Max(StartOfObservation, SnapBackAt));
				if (flag || flag2)
				{
					SnappedForwards = true;
				}
				if (SnappedForwards)
				{
					observationDistancePc = 0f;
				}
				if ((!flag && !ResetIfOverBounds) || (!flag2 && ResetIfOverBounds))
				{
					SnappedForwards = false;
				}
				if (SnappedForwards && LockForward)
				{
					observationDistancePc = 1f;
				}
			}
			if (ReadHandTouchpadMovement)
			{
				Vector2 up = Vector2.up;
				bool flag3 = false;
				if (DirToRead == H3VRUtilsMagRelease.TouchpadDirType.Up)
				{
					up = Vector2.up;
				}
				if (DirToRead == H3VRUtilsMagRelease.TouchpadDirType.Down)
				{
					up = Vector2.down;
				}
				if (DirToRead == H3VRUtilsMagRelease.TouchpadDirType.Left)
				{
					up = Vector2.left;
				}
				if (DirToRead == H3VRUtilsMagRelease.TouchpadDirType.Right)
				{
					up = Vector2.right;
				}
				if (DirToRead == H3VRUtilsMagRelease.TouchpadDirType.Trigger)
				{
					flag3 = true;
				}
				if ((Object)(object)ItemToReadFrom.m_hand != (Object)null)
				{
					switch (DirToReadStreamlined)
					{
					case StreamlinedDirType.AX_Button:
						if (ItemToReadFrom.m_hand.Input.AXButtonPressed)
						{
							observationDistancePc = 1f;
						}
						break;
					case StreamlinedDirType.Trigger:
						if (ItemToReadFrom.m_hand.Input.TriggerDown)
						{
							observationDistancePc = 1f;
						}
						break;
					}
				}
			}
			if (ReadIfGunIsLoaded)
			{
				if ((Object)(object)FirearmToReadFrom.Magazine != (Object)null)
				{
					observationDistancePc = 1f;
				}
				else
				{
					observationDistancePc = 0f;
				}
			}
			if (ReadIfBoltIsLocked)
			{
				if ((int)BoltToReadFrom.CurPos == 2 && (int)BoltToReadFrom.LastPos == 2)
				{
					observationDistancePc = 1f;
				}
				else
				{
					observationDistancePc = 0f;
				}
			}
			if (MoveIfSpecificAttachmentAttached)
			{
				foreach (FVRFireArmAttachment attachments in AttachmentMount.AttachmentsList)
				{
					foreach (string attachmentID in AttachmentIDs)
					{
						if (((FVRPhysicalObject)attachments).ObjectWrapper.ItemID == attachmentID)
						{
							observationDistancePc = 1f;
							break;
						}
					}
				}
			}
			if (MoveIfObjectHeld)
			{
				if ((Object)(object)HeldObject.m_hand != (Object)null)
				{
					observationDistancePc = 1f;
				}
				else
				{
					observationDistancePc = 0f;
				}
			}
			if (MoveIfGrenadeArmed)
			{
			}
			if (MoveIfDisabled)
			{
				if (!ObservedObject.activeSelf)
				{
					observationDistancePc = 1f;
				}
				else
				{
					observationDistancePc = 0f;
				}
			}
			if (MoveIfChamberFull)
			{
				if (considerFullEvenIfRoundFired)
				{
					if (Chamber.IsFull)
					{
						observationDistancePc = 1f;
					}
				}
				else if (Chamber.IsFull && !Chamber.IsSpent)
				{
					observationDistancePc = 1f;
				}
				else
				{
					observationDistancePc = 0f;
				}
			}
			finalLerpAmt = Mathf.Lerp(previousObservationDistancePc, observationDistancePc, LerpAmount * Time.deltaTime);
			if (usesCurve)
			{
				finalLerpAmt = Curve.Evaluate(finalLerpAmt);
			}
			previousFinalPoint = finalPoint;
			finalPoint = Mathf.Lerp(StartOfAffected, StopOfAffected, finalLerpAmt);
			finalPoint = Mathf.Lerp(previousFinalPoint, finalPoint, LerpAmount * Time.deltaTime);
			bool flag4 = false;
			if (Math.Abs(rememberLerpPoint - finalPoint) < float.Epsilon)
			{
				flag4 = true;
			}
			if (!SnappedForwards)
			{
				if (finalPoint - rememberLerpPoint < 0f && ObservationDirection == dir.towardsStop)
				{
					flag4 = true;
				}
				if (finalPoint - rememberLerpPoint > 0f && ObservationDirection == dir.towardsStart)
				{
					flag4 = true;
				}
			}
			rememberLerpPoint = finalPoint;
			if (flag4)
			{
				return;
			}
			if (MoveAttachedItems)
			{
			}
			if (DisableIfMoved)
			{
				Debug.Log((object)(observationDistancePc + ", " + percentageCutoff));
				if (observationDistancePc >= percentageCutoff)
				{
					Debug.Log((object)"Hi!");
					AffectedObject.SetActive(false);
				}
				else
				{
					AffectedObject.SetActive(true);
				}
			}
			if ((Object)(object)AffectedObject != (Object)null)
			{
				Vector3 val;
				switch (TransformationTypeOfAffectedObject)
				{
				case transformtype.position:
					val = AffectedObject.transform.localPosition;
					((Vector3)(ref val))[(int)DirectionOfAffection] = finalPoint;
					AffectedObject.transform.localPosition = val;
					break;
				case transformty