Decompiled source of Tenora Prime v1.0.0

Tenora_Prime.dll

Decompiled a day 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 H3VRUtils;
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 ShermanJumbo
{
	public class FirearmSpinnyBarrels : MonoBehaviour
	{
		public FVRFireArm Gun;

		public GameObject SpinningBarrels;

		public float SpinRate;

		public dirType DirectionOfSpin;

		public float DecelerationRate = 0.5f;

		public float TriggerDeadzone = 0.01f;

		private float currentSpinSpeed = 0f;

		private bool TriggerPulled = false;

		public AudioSource SpinnySounds;

		public float SpinnySoundsVolume = 0.4f;

		private void Awake()
		{
			if ((Object)(object)SpinnySounds != (Object)null)
			{
				SpinnySounds.volume = 0f;
			}
		}

		private void Update()
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected I4, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)SpinnySounds != (Object)null)
			{
				SpinnySounds.volume = currentSpinSpeed / SpinRate * SpinnySoundsVolume;
			}
			if ((Object)(object)Gun != (Object)null && (Object)(object)((FVRInteractiveObject)Gun).m_hand != (Object)null)
			{
				float triggerFloat = ((FVRInteractiveObject)Gun).m_hand.Input.TriggerFloat;
				if (triggerFloat >= TriggerDeadzone)
				{
					if (!TriggerPulled)
					{
						TriggerPulled = true;
					}
					currentSpinSpeed = SpinRate;
				}
				else if (TriggerPulled)
				{
					TriggerPulled = false;
				}
			}
			if (!TriggerPulled && currentSpinSpeed > 0f)
			{
				currentSpinSpeed -= DecelerationRate * Time.deltaTime;
				if (currentSpinSpeed < 0f)
				{
					currentSpinSpeed = 0f;
				}
			}
			if (currentSpinSpeed > 0f && (Object)(object)SpinningBarrels != (Object)null)
			{
				Vector3 zero = Vector3.zero;
				int num = (int)DirectionOfSpin;
				if (num >= 0 && num <= 2)
				{
					((Vector3)(ref zero))[num] = currentSpinSpeed * Time.deltaTime;
					SpinningBarrels.transform.Rotate(zero);
				}
				else
				{
					Debug.LogWarning((object)"Invalid DirectionOfSpin value!");
				}
			}
		}
	}
}
namespace Slim_Cut.Tenora_Prime
{
	[BepInPlugin("Slim_Cut.Tenora_Prime", "Tenora_Prime", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Tenora_PrimePlugin : 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(), "Slim_Cut.Tenora_Prime");
			OtherLoader.RegisterDirectLoad(BasePath, "Slim_Cut.Tenora_Prime", "", "", "tenora prime", "");
		}
	}
}