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;
[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.ModulPSAJakl47;
[BepInPlugin("Volks.ModulPSAJakl47", "ModulPSAJakl47", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.2")]
public class ModulPSAJakl47Plugin : 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.ModulPSAJakl47");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.ModulPSAJakl47", "", "", "modulpsajakl47", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulpsajakl47"));
}
}
public class BoltActionDustCover : FVRInteractiveObject
{
public FVRFireArm BoltActionRifle;
public BoltActionRifle_Handle BoltActionRifle_Handle;
public Transform DustCoverGeo;
private bool m_isOpen;
public float OpenRot;
public float ClosedRot;
public float RotSpeed = 360f;
private float m_curRot;
private float m_tarRot;
public AudioEvent AudEvent_CoverOpen;
public AudioEvent AudEvent_CoverClose;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
m_curRot = ClosedRot;
m_tarRot = ClosedRot;
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if ((Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 2)
{
if (m_isOpen)
{
Close();
}
else
{
Open();
}
}
else if ((Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 0 && m_isOpen)
{
Close();
}
}
private void ToggleDustCoverState()
{
if (m_isOpen)
{
Close();
}
else
{
Open();
}
}
public override void FVRUpdate()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (!m_isOpen && (Object)(object)BoltActionRifle_Handle != (Object)null && (int)BoltActionRifle_Handle.HandleRot == 0)
{
Open();
}
if (Mathf.Abs(m_tarRot - m_curRot) > 0.01f)
{
m_curRot = Mathf.MoveTowards(m_curRot, m_tarRot, Time.deltaTime * RotSpeed);
if ((Object)(object)DustCoverGeo != (Object)null)
{
DustCoverGeo.localEulerAngles = new Vector3(0f, 0f, m_curRot);
}
}
}
private void Open()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (!m_isOpen)
{
m_isOpen = true;
m_tarRot = OpenRot;
RotSpeed = 1900f;
if (AudEvent_CoverOpen != null && (Object)(object)BoltActionRifle != (Object)null)
{
BoltActionRifle.PlayAudioAsHandling(AudEvent_CoverOpen, ((Component)this).transform.position);
}
}
}
private void Close()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if (m_isOpen)
{
m_isOpen = false;
m_tarRot = ClosedRot;
RotSpeed = 800f;
if (AudEvent_CoverClose != null && (Object)(object)BoltActionRifle != (Object)null)
{
BoltActionRifle.PlayAudioAsHandling(AudEvent_CoverClose, ((Component)this).transform.position);
}
}
}
}