Decompiled source of Hawk12Shotgun v1.0.2

Hawk12Shotgun.dll

Decompiled 2 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 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]
public class UnhideObjectOnRotation : MonoBehaviour
{
	public GameObject objectToUnhide;

	public Transform targetObject;

	public float targetAngle = 90f;

	public string rotationAxis = "Z";

	public float tolerance = 1f;

	private bool goalAchieved = false;

	private void Update()
	{
		float rotationOnAxis = GetRotationOnAxis(targetObject, rotationAxis);
		if (!goalAchieved && Mathf.Abs(Mathf.DeltaAngle(rotationOnAxis, targetAngle)) <= tolerance)
		{
			if ((Object)(object)objectToUnhide != (Object)null && !objectToUnhide.activeInHierarchy)
			{
				objectToUnhide.SetActive(true);
			}
			goalAchieved = true;
			Debug.Log((object)"Rotation goal achieved! Object unhidden.");
		}
		else if (goalAchieved && Mathf.Abs(Mathf.DeltaAngle(rotationOnAxis, targetAngle)) > tolerance)
		{
			goalAchieved = false;
			Debug.Log((object)"Rotation has deviated from the goal.");
		}
	}

	private float GetRotationOnAxis(Transform obj, string axis)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		switch (axis.ToUpper())
		{
		case "X":
			return obj.eulerAngles.x;
		case "Y":
			return obj.eulerAngles.y;
		case "Z":
			return obj.eulerAngles.z;
		default:
			Debug.LogError((object)"Invalid rotation axis specified.");
			return 0f;
		}
	}
}
public class UnhideScriptOnRotation : MonoBehaviour
{
	public MonoBehaviour scriptToEnable;

	public Transform targetObject;

	public float targetAngle = 90f;

	public string rotationAxis = "Z";

	public float tolerance = 1f;

	private bool goalAchieved = false;

	private void Update()
	{
		float rotationOnAxis = GetRotationOnAxis(targetObject, rotationAxis);
		if (!goalAchieved && Mathf.Abs(Mathf.DeltaAngle(rotationOnAxis, targetAngle)) <= tolerance)
		{
			if ((Object)(object)scriptToEnable != (Object)null && !((Behaviour)scriptToEnable).enabled)
			{
				((Behaviour)scriptToEnable).enabled = true;
			}
			goalAchieved = true;
			Debug.Log((object)"Rotation goal achieved! Script enabled.");
		}
		else if (goalAchieved && Mathf.Abs(Mathf.DeltaAngle(rotationOnAxis, targetAngle)) > tolerance)
		{
			goalAchieved = false;
			Debug.Log((object)"Rotation has deviated from the goal.");
		}
	}

	private float GetRotationOnAxis(Transform obj, string axis)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		switch (axis.ToUpper())
		{
		case "X":
			return obj.eulerAngles.x;
		case "Y":
			return obj.eulerAngles.y;
		case "Z":
			return obj.eulerAngles.z;
		default:
			Debug.LogError((object)"Invalid rotation axis specified.");
			return 0f;
		}
	}
}
namespace Volksterism.Hawk12Shotgun;

[BepInPlugin("Volksterism.Hawk12Shotgun", "Hawk12Shotgun", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Hawk12ShotgunPlugin : 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(), "Volksterism.Hawk12Shotgun");
		OtherLoader.RegisterDirectLoad(BasePath, "Volksterism.Hawk12Shotgun", "", "", "hawk12shotgun", "");
	}
}