Decompiled source of CetmeLRifle v1.0.0

CetmeLRifle.dll

Decompiled a month ago
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 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 JerryComponent
{
	public class ClosedBoltHandleLock : ClosedBoltHandle
	{
		private bool isLocked = false;

		private bool springread = false;

		private float springh;

		private float springb;

		private 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_00fd: 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_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			if (!(Vector3.Distance(((Component)this).gameObject.transform.position, base.Point_Rear.position) < 0.01f) || !((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null))
			{
				return;
			}
			if (!isLocked)
			{
				if ((((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed) || (!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.Secondary2AxisNorthPressed))
				{
					if (!springread)
					{
						springh = base.Speed_Forward;
						springb = base.Weapon.Bolt.Speed_Forward;
						springread = true;
					}
					base.Speed_Forward = 0f;
					base.Weapon.Bolt.Speed_Forward = 0f;
					base.Weapon.Bolt.LockBolt();
					base.CurPos = (HandlePos)2;
					base.Weapon.Bolt.CurPos = (BoltPos)2;
					((FVRInteractiveObject)this).ForceBreakInteraction();
					isLocked = true;
				}
				if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && !((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && !((FVRInteractiveObject)this).m_hand.Input.Secondary2AxisNorthPressed)
				{
					if (springread)
					{
						base.Speed_Forward = springh;
						base.Weapon.Bolt.Speed_Forward = springb;
						base.CurPos = (HandlePos)0;
						base.Weapon.Bolt.ReleaseBolt();
						base.Weapon.Bolt.CurPos = (BoltPos)0;
						springread = false;
					}
					isLocked = false;
				}
			}
			else
			{
				if (!isLocked)
				{
					return;
				}
				if ((((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed) || (!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)this).m_hand.Input.Secondary2AxisNorthPressed))
				{
					if (!springread)
					{
						springh = base.Speed_Forward;
						springb = base.Weapon.Bolt.Speed_Forward;
						springread = true;
					}
					base.Speed_Forward = 0f;
					base.Weapon.Bolt.Speed_Forward = 0f;
					base.CurPos = (HandlePos)2;
					base.Weapon.Bolt.LockBolt();
					base.Weapon.Bolt.CurPos = (BoltPos)2;
					((FVRInteractiveObject)this).ForceBreakInteraction();
					isLocked = true;
				}
				if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && !((FVRInteractiveObject)this).m_hand.Input.BYButtonPressed && !((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode && !((FVRInteractiveObject)this).m_hand.Input.Secondary2AxisNorthPressed)
				{
					if (springread)
					{
						base.Speed_Forward = springh;
						base.Weapon.Bolt.Speed_Forward = springb;
						base.CurPos = (HandlePos)0;
						base.Weapon.Bolt.ReleaseBolt();
						base.Weapon.Bolt.CurPos = (BoltPos)0;
						springread = false;
					}
					isLocked = false;
				}
			}
		}
	}
}
namespace Volks.CetmeLRifle
{
	[BepInPlugin("Volks.CetmeLRifle", "CetmeLRifle", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class CetmeLRiflePlugin : 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(), "Volks.CetmeLRifle");
			OtherLoader.RegisterDirectLoad(BasePath, "Volks.CetmeLRifle", "", "", "cetmelrifle", "");
		}
	}
}
namespace JerryComponent
{
	public class AttachableClosedBoltWeaponBoltRelease : MonoBehaviour
	{
		public AttachableClosedBolt bolt;

		public AttachableClosedBoltWeapon weapon;

		public bool buttonpressed = false;

		public void Update()
		{
			if ((Object)(object)((FVRInteractiveObject)((AttachableFirearm)weapon).Interface).m_hand != (Object)null && ((FVRInteractiveObject)((AttachableFirearm)weapon).Interface).m_hand.IsInStreamlinedMode)
			{
				if (((FVRInteractiveObject)((AttachableFirearm)weapon).Interface).m_hand.Input.BYButtonPressed)
				{
					if (bolt.m_isBoltLocked)
					{
						weapon.IsBoltReleaseButtonHeld = true;
					}
					else if (!bolt.m_isBoltLocked && !buttonpressed)
					{
						weapon.ToggleFireSelector();
						buttonpressed = true;
					}
				}
				else if (!((FVRInteractiveObject)((AttachableFirearm)weapon).Interface).m_hand.Input.BYButtonPressed)
				{
					if (bolt.m_isBoltLocked)
					{
						weapon.IsBoltReleaseButtonHeld = false;
					}
					buttonpressed = false;
				}
			}
			if (weapon.HasBoltReleaseButton && weapon.IsBoltReleaseButtonHeld)
			{
				bolt.ReleaseBolt();
			}
		}
	}
}