Decompiled source of Flux Raider 365 v1.1.5

Flux_Raider_365.dll

Decompiled 3 months ago
using System.Collections;
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 OpenScripts2;
using OtherLoader;
using UnityEngine;

[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 AndrewFTW
{
	public class SpringLoadedStockButtonRotateY : FVRInteractiveObject
	{
		[Header("This only works for z axis,it works for Y axis rotation fuck you")]
		public MovableObjectPart Stock;

		public float ClosedVal;

		public float OpenVal;

		public float TimeToExtend = 0.5f;

		public AudioEvent SwitchSound;

		public bool SpringsOpenWhenNotClosed = false;

		public void Update()
		{
			if (SpringsOpenWhenNotClosed)
			{
				bool flag = false;
				if (!Stock.IsClosed && !flag)
				{
					EjectStock(UseCurPosn: true);
					flag = true;
				}
				if (Stock.IsOpen)
				{
					flag = false;
				}
			}
		}

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			EjectStock(UseCurPosn: false);
		}

		public void EjectStock(bool UseCurPosn)
		{
			//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_0054: Unknown result type (might be due to invalid IL or missing references)
			if ((double)Mathf.Abs(((Component)Stock).transform.localRotation.y - ClosedVal) <= 0.02)
			{
				((MonoBehaviour)this).StartCoroutine(LerpStock(ClosedVal));
				SM.PlayGenericSound(SwitchSound, ((Component)this).transform.position);
			}
		}

		private IEnumerator LerpStock(float _ClosedVal)
		{
			float _timeEllapsed = 0f;
			bool _StockExtended = false;
			while (!_StockExtended)
			{
				_timeEllapsed += Time.deltaTime;
				float _percentComplete = _timeEllapsed / TimeToExtend;
				if ((double)_percentComplete > 0.9)
				{
					_percentComplete = 1f;
					_StockExtended = true;
				}
				float lerpValue = Mathf.Lerp(_ClosedVal, OpenVal, _percentComplete);
				((Component)Stock).transform.localEulerAngles = new Vector3(((Component)Stock).transform.localRotation.x, lerpValue, ((Component)Stock).transform.localRotation.z);
				yield return null;
			}
			yield return null;
		}
	}
	public class SpringLoadedStockFirearmControlRotateY : MonoBehaviour
	{
		public FVRAlternateGrip Grip;

		public SpringLoadedStockButtonRotateY StockButton;

		private bool IsDian;

		public void Update()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((FVRInteractiveObject)Grip).m_hand != (Object)null))
			{
				return;
			}
			FVRViveHand hand = ((FVRInteractiveObject)Grip).m_hand;
			if (IsDian)
			{
				return;
			}
			if (!hand.IsInStreamlinedMode)
			{
				if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f)
				{
					StockButton.EjectStock(UseCurPosn: false);
				}
			}
			else if (hand.Input.BYButtonDown)
			{
				StockButton.EjectStock(UseCurPosn: false);
			}
		}
	}
}
namespace Brillcrafter.Flux_Raider_365
{
	[BepInPlugin("Brillcrafter.Flux_Raider_365", "Flux_Raider_365", "1.1.5")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Flux_Raider_365Plugin : 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(), "Brillcrafter.Flux_Raider_365");
			OtherLoader.RegisterDirectLoad(BasePath, "Brillcrafter.Flux_Raider_365", "", "", "flux raider 365", "");
		}
	}
}