Decompiled source of ModulAN94 v1.0.2

ModulAN94.dll

Decompiled 10 months 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 ModularWorkshop;
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]
public class EnableObjOnSkinSelect : MonoBehaviour
{
	[Header("Hover Over Variables To Read The Tooltips!!!")]
	[Tooltip("Your weapon object.")]
	public GameObject ModularWeapon;

	[Tooltip("ID of the skin to enable/disable objects on.")]
	public string skinID;

	[Tooltip("All objects you want enabled when the skin is selected.")]
	public GameObject[] objectsEnabled;

	[Tooltip("All objects you want disabled when the skin is selected.")]
	public GameObject[] objectsDisabled;

	private IModularWeapon weapon;

	private void Update()
	{
		if (weapon == null)
		{
			weapon = ModularWeapon.GetComponent<IModularWeapon>();
		}
		if (weapon.GetModularFVRFireArm.CurrentSelectedReceiverSkinID == skinID)
		{
			GameObject[] array = objectsEnabled;
			foreach (GameObject val in array)
			{
				val.SetActive(true);
			}
			GameObject[] array2 = objectsDisabled;
			foreach (GameObject val2 in array2)
			{
				val2.SetActive(false);
			}
		}
	}
}
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace localpcnerd.ModulAN94
{
	[BepInPlugin("localpcnerd.ModulAN94", "ModulAN94", "1.0.2")]
	[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 ModulAN94Plugin : 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(), "localpcnerd.ModulAN94");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulan94"));
			OtherLoader.RegisterDirectLoad(BasePath, "localpcnerd.ModulAN94", "", "", "modulan94", "");
		}
	}
}
public class MultiHandleBoltHandle : ClosedBoltHandle
{
	[Header("Multiple Rotating Handles")]
	public bool useMultipleHandles;

	public Transform[] handles;

	public Vector3[] leftRots;

	public Vector3[] rightRots;

	public Vector3[] neutralRots;

	public bool[] StayRotOnBack;

	public bool[] UseSoundOnGrab;

	public override void BeginInteraction(FVRViveHand hand)
	{
		for (int i = 0; i < handles.Length; i++)
		{
			if (UseSoundOnGrab[i])
			{
				((FVRFireArm)base.Weapon).PlayAudioEvent((FirearmAudioEventType)9, 1f);
			}
		}
		((ClosedBoltHandle)this).BeginInteraction(hand);
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_001a: 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)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
		((ClosedBoltHandle)this).UpdateInteraction(hand);
		if (base.HasRotatingPart)
		{
			Vector3 val = ((Component)this).transform.position - ((FVRInteractiveObject)this).m_hand.PalmTransform.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			if (Vector3.Dot(normalized, ((Component)this).transform.right) > 0f)
			{
				base.RotatingPart.localEulerAngles = base.RotatingPartLeftEulers;
			}
			else
			{
				base.RotatingPart.localEulerAngles = base.RotatingPartRightEulers;
			}
		}
		if (!useMultipleHandles)
		{
			return;
		}
		for (int i = 0; i < handles.Length; i++)
		{
			Vector3 val2 = ((Component)this).transform.position - ((FVRInteractiveObject)this).m_hand.PalmTransform.position;
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			if (Vector3.Dot(normalized2, ((Component)this).transform.right) > 0f)
			{
				handles[i].localEulerAngles = leftRots[i];
			}
			else
			{
				handles[i].localEulerAngles = rightRots[i];
			}
		}
	}

	public override void EndInteraction(FVRViveHand hand)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (useMultipleHandles && !base.StaysRotatedWhenBack)
		{
			for (int i = 0; i < handles.Length; i++)
			{
				if (!StayRotOnBack[i])
				{
					handles[i].localEulerAngles = neutralRots[i];
				}
			}
		}
		((ClosedBoltHandle)this).EndInteraction(hand);
	}
}