Decompiled source of DoombaCompanion v1.0.0

DoombaCompanion.dll

Decompiled 3 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 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 Volksterism.DoombaCompanion;

[BepInPlugin("Volksterism.DoombaCompanion", "DoombaCompanion", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class DoombaCompanionPlugin : 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.DoombaCompanion");
		OtherLoader.RegisterDirectLoad(BasePath, "Volksterism.DoombaCompanion", "", "", "doombacompanion", "");
	}
}
public class Semtex : PinnedGrenade
{
	[Header("Semtex Values")]
	public bool isSticky;

	public LayerMask stickyMask;

	[Header("Semtex Extras (Leave Empty If Not Needed)")]
	[Tooltip("If not null, will play audio clip placed inside of source. Used for a stick sound if you want.")]
	public AudioSource StickSource;

	public override void OnCollisionEnter(Collision collision)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		if (collision.gameObject.layer == LayerMask.op_Implicit(stickyMask) && !((FVRInteractiveObject)this).IsHeld)
		{
			((Component)this).transform.parent = collision.transform;
			((Component)this).GetComponent<Rigidbody>().isKinematic = true;
			if ((Object)(object)StickSource != (Object)null)
			{
				StickSource.Play();
			}
		}
		((PinnedGrenade)this).OnCollisionEnter(collision);
	}
}
public class Semtex_Updated : PinnedGrenade
{
	[Header("Semtex Values")]
	public bool isSticky;

	public LayerMask stickyMask;

	[Header("Semtex Extras (Leave Empty If Not Needed)")]
	[Tooltip("If not null, will play audio clip placed inside of source. Used for a stick sound if you want.")]
	public AudioSource StickSource;

	private float timeBeforeEnableStick = 0.1f;

	private bool canStick = false;

	private Transform fakeParent;

	private Vector3 pos;

	private Vector3 fw;

	private Vector3 up;

	public override void FVRUpdate()
	{
		if (base.m_isLeverReleased && !canStick)
		{
			timeBeforeEnableStick -= Time.deltaTime;
			if (timeBeforeEnableStick <= 0f)
			{
				canStick = true;
			}
		}
		((PinnedGrenade)this).FVRUpdate();
	}

	private void FixedUpdate()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)fakeParent != (Object)null)
		{
			Vector3 position = ((Component)fakeParent).transform.TransformPoint(pos);
			Vector3 val = ((Component)fakeParent).transform.TransformDirection(fw);
			Vector3 val2 = ((Component)fakeParent).transform.TransformDirection(up);
			Quaternion rotation = Quaternion.LookRotation(val, val2);
			((Component)this).transform.position = position;
			((Component)this).transform.rotation = rotation;
		}
	}

	public override void OnCollisionEnter(Collision collision)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		((PinnedGrenade)this).OnCollisionEnter(collision);
		if (!((FVRInteractiveObject)this).IsHeld && canStick && (Object)(object)fakeParent == (Object)null)
		{
			fakeParent = collision.gameObject.transform;
			((Component)this).transform.position = ((ContactPoint)(ref collision.contacts[0])).point;
			((Component)this).transform.rotation = Quaternion.LookRotation(((ContactPoint)(ref collision.contacts[0])).normal);
			pos = ((Component)fakeParent).transform.InverseTransformPoint(((Component)this).transform.position);
			fw = ((Component)fakeParent).transform.InverseTransformDirection(((Component)this).transform.forward);
			up = ((Component)fakeParent).transform.InverseTransformDirection(((Component)this).transform.up);
			((Component)this).GetComponent<Rigidbody>().isKinematic = true;
			if ((Object)(object)StickSource != (Object)null)
			{
				StickSource.Play();
			}
		}
	}

	public override void BeginInteraction(FVRViveHand hand)
	{
		((PinnedGrenade)this).BeginInteraction(hand);
		fakeParent = null;
	}
}