Decompiled source of BubbleLevelSet v2.0.1

BubbleLevelSet.dll

Decompiled 8 months ago
using System;
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 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 HLin_Mods.BubbleLevelSet;

[BepInPlugin("HLin_Mods.BubbleLevelSet", "BubbleLevelSet", "2.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class BubbleLevelSetPlugin : 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(), "HLin_Mods.BubbleLevelSet");
		OtherLoader.RegisterDirectLoad(BasePath, "HLin_Mods.BubbleLevelSet", "", "", "hlin-bubblelevel", "");
	}
}
public class BubbleLevel : MonoBehaviour
{
	[Header("BaseObject")]
	public GameObject baseObject = null;

	[Header("FVRAttachment")]
	public FVRFireArmAttachment attachment = null;

	[Header("LevelBubble")]
	public GameObject level_bubble = null;

	private void Start()
	{
	}

	private void Update()
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		float num;
		if ((Object)(object)attachment != (Object)null && (Object)(object)attachment.curMount != (Object)null)
		{
			num = ((Component)attachment.curMount.GetRootMount()).transform.eulerAngles.z;
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
			num = 0f - num;
		}
		else
		{
			num = baseObject.transform.eulerAngles.z;
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
		}
		Vector3 localPosition = level_bubble.transform.localPosition;
		localPosition.x = Mathf.Clamp(-0.0084f + num / 8f, -0.33f, 0.33f);
		level_bubble.transform.localPosition = localPosition;
	}
}
public class BubbleLevelMount : MonoBehaviour
{
	[Header("BaseObject")]
	public GameObject baseObject = null;

	[Header("FVRAttachment")]
	public FVRFireArmAttachment attachment = null;

	[Header("LevelBubble")]
	public GameObject level_bubble = null;

	[Header("BubblePivot")]
	public Transform customPivot;

	private void Start()
	{
	}

	private void FixedUpdate()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		Vector3 eulerAngles = level_bubble.transform.eulerAngles;
		float num = level_bubble.transform.localEulerAngles.y;
		float num2;
		if ((Object)(object)attachment != (Object)null && (Object)(object)attachment.curMount != (Object)null)
		{
			num2 = ((Component)attachment.curMount.GetRootMount()).transform.eulerAngles.z;
			if (180f < num2 && num2 < 360f)
			{
				num2 -= 360f;
			}
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
			num2 = 0f - num2;
		}
		else
		{
			num2 = ((Component)attachment).transform.eulerAngles.z;
			if (180f < num2 && num2 < 360f)
			{
				num2 -= 360f;
			}
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
		}
		num = 0f - num;
		float num3 = 3f * num2 - num;
		float num4 = num3;
		num4 = Mathf.Clamp(num4, -25f, 25f);
		if (num < 6.301f && num > -6.301f)
		{
			if (num < 6.3f && num > 5.8f)
			{
				num4 *= (7f - num) * 0.3f;
			}
			else if (num > -6.3f && num < -5.8f)
			{
				num4 *= (7f + num) * 0.3f;
			}
			level_bubble.transform.RotateAround(customPivot.position, Vector3.forward, num4 * Time.deltaTime);
		}
		else if (num >= 6.3f)
		{
			level_bubble.transform.RotateAround(customPivot.position, Vector3.forward, -0.02f * Math.Abs(num4) * Time.deltaTime);
		}
		else if (num <= -6.3f)
		{
			level_bubble.transform.RotateAround(customPivot.position, Vector3.forward, 0.02f * Math.Abs(num4) * Time.deltaTime);
		}
	}
}
public class BubbleLevelMountTest : MonoBehaviour
{
	[Header("BaseObject")]
	public GameObject baseObject = null;

	[Header("FVRAttachment")]
	public FVRFireArmAttachment attachment = null;

	[Header("LevelBubble")]
	public GameObject level_bubble = null;

	[Header("BubblePivot")]
	public Transform customPivot;

	private void Start()
	{
	}

	private void FixedUpdate()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		Vector3 eulerAngles = level_bubble.transform.eulerAngles;
		float num = level_bubble.transform.eulerAngles.z - 180f;
		float num2 = level_bubble.transform.localPosition.x - 0.000215f;
		float num3;
		if ((Object)(object)attachment != (Object)null && (Object)(object)attachment.curMount != (Object)null)
		{
			num3 = ((Component)attachment.curMount.GetRootMount()).transform.eulerAngles.z;
			if (180f < num3 && num3 < 360f)
			{
				num3 -= 360f;
			}
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
			num3 = 0f - num3;
		}
		else
		{
			num3 = ((Component)attachment).transform.eulerAngles.z;
			if (180f < num3 && num3 < 360f)
			{
				num3 -= 360f;
			}
			if (180f < num && num < 360f)
			{
				num -= 360f;
			}
		}
		num = 0f - num;
		float num4 = 4f * num3 - num;
		float num5 = num4;
		if (num2 > 3.2E-05f && num5 > 0f)
		{
			num5 *= (3.4E-05f - num2) * 20000f;
		}
		else if (num < -3.2E-05f && num5 < 0f)
		{
			num5 *= (num2 + 3.4E-05f) * 20000f;
		}
		if (Math.Abs(num5) > 0.01f)
		{
			level_bubble.transform.RotateAround(customPivot.position, -level_bubble.transform.forward, num5 * Time.deltaTime);
		}
	}
}
public class CosineMount : MonoBehaviour
{
	[Header("Wheel")]
	public GameObject wheel = null;

	private void Start()
	{
	}

	private void FixedUpdate()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		Vector3 eulerAngles = wheel.transform.eulerAngles;
		eulerAngles.x = -90f;
		wheel.transform.eulerAngles = eulerAngles;
	}
}