Decompiled source of ModulM19 v1.1.0

ModulM19.dll

Decompiled 11 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 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 MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace localpcnerd.ModulM19
{
	[BepInPlugin("localpcnerd.ModulM19", "ModulM19", "1.1.0")]
	[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 ModulM19Plugin : 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.ModulM19");
			GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulm19"));
			OtherLoader.RegisterDirectLoad(BasePath, "localpcnerd.ModulM19", "", "", "modulm19", "");
		}
	}
}
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);
	}
}