Decompiled source of RPOShmel v1.0.0

RPOShmel.dll

Decompiled a month 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 Volks.RPOShmel;

[BepInPlugin("Volks.RPOShmel", "RPOShmel", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class RPOShmelPlugin : 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(), "Volks.RPOShmel");
		OtherLoader.RegisterDirectLoad(BasePath, "Volks.RPOShmel", "", "", "rposhmel", "");
	}
}
public class FlipGrip : FVRAlternateGrip
{
	private float curXRot;

	private float m_curFlipLerp;

	private float m_tarFlipLerp;

	private float m_lastFlipLerp;

	public float XRotUp;

	public float XRotDown;

	public bool IsUp { get; private set; }

	public override void Awake()
	{
		((FVRAlternateGrip)this).Awake();
		if (IsUp)
		{
			curXRot = XRotUp;
			m_curFlipLerp = 1f;
			m_tarFlipLerp = 1f;
			m_lastFlipLerp = 1f;
		}
		else
		{
			curXRot = XRotDown;
			m_curFlipLerp = 0f;
			m_tarFlipLerp = 0f;
			m_lastFlipLerp = 0f;
		}
	}

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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)
		Vector2 touchpadAxes = hand.Input.TouchpadAxes;
		if (hand.IsInStreamlinedMode)
		{
			if (hand.Input.BYButtonDown)
			{
				IsUp = !IsUp;
				Flip();
			}
		}
		else if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.25f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
		{
			Flip();
		}
		((FVRAlternateGrip)this).UpdateInteraction(hand);
	}

	private void Flip()
	{
		if (IsUp)
		{
			curXRot = XRotUp;
			m_tarFlipLerp = 1f;
		}
		else
		{
			curXRot = XRotDown;
			m_tarFlipLerp = 0f;
		}
	}
}
public class GripRotation : FVRAlternateGrip
{
	[Header("Grip Rotation")]
	public Vector3 rotationDirection = Vector3.up;
}
public enum E_InteractionType
{
	None = -1,
	Holding,
	Touchpad,
	TouchpadUp,
	TouchpadDown,
	TouchpadLeft,
	TouchpadRight,
	AXButton,
	BYButton,
	Trigger,
	Simple,
	TriggerTouched,
	GripPressed
}
public class Safety_RPG : SimpleLauncher
{
	private int m_fireSelectorMode;

	public int FireSelectorModeIndex => m_fireSelectorMode;

	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class DM34Destroy : MonoBehaviour
{
	public FVRPhysicalObject triggerDestroy;

	public FVRFireArmChamber chamber;

	private bool isTimerStarted;

	public float timeBeforedestruction;

	private float timer = 1f;

	private void FixedUpdate()
	{
		if (!chamber.IsFull && !isTimerStarted)
		{
			isTimerStarted = true;
			timer = timeBeforedestruction;
		}
		if (((FVRInteractiveObject)triggerDestroy).IsHeld)
		{
			timer = timeBeforedestruction;
		}
		if (isTimerStarted)
		{
			timer -= Time.fixedDeltaTime;
		}
		if (timer <= 0f)
		{
			Object.Destroy((Object)(object)((Component)triggerDestroy).gameObject);
		}
	}
}
public class EnableEngine : MonoBehaviour
{
	public FVRFireArmChamber chamber;

	public GameObject objectToEnable;

	private void FixedUpdate()
	{
		if (!chamber.IsFull)
		{
			objectToEnable.SetActive(true);
		}
	}
}
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 Transform fakeParent;

	private Vector3 pos;

	private Vector3 fw;

	private Vector3 up;

	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_0012: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: 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)
		if (((1 << collision.gameObject.layer) & LayerMask.op_Implicit(stickyMask)) != 0 && !((FVRInteractiveObject)this).IsHeld)
		{
			((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();
			}
		}
		((PinnedGrenade)this).OnCollisionEnter(collision);
	}

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