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