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 Volks.UnderbarrelGlock
{
[BepInPlugin("Volks.UnderbarrelGlock", "UnderbarrelGlock", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class UnderbarrelGlockPlugin : 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.UnderbarrelGlock");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.UnderbarrelGlock", "", "", "underbarrelglock", "");
}
}
}
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();
}
}
}
}