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 Sodalite.Api;
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 Volks.ModulCarrack300;
[BepInPlugin("Volks.ModulCarrack300", "ModulCarrack300", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.2")]
public class ModulCarrack300Plugin : 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.ModulCarrack300");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.ModulCarrack300", "", "", "modulcarrack300", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_modulcarrack300"));
}
}
public class SAR21_Laser : FVRAlternateGrip
{
private bool isLaserActive = false;
public GameObject BeamEffect;
public GameObject BeamHitPoint;
public Transform Aperture;
public LayerMask LM;
private RaycastHit m_hit;
public AudioEvent AudEvent_LaserOnClip;
public AudioEvent AudEvent_LaserOffClip;
public override void Awake()
{
((FVRAlternateGrip)this).Awake();
if ((Object)(object)BeamHitPoint == (Object)null)
{
Debug.LogError((object)"BeamHitPoint is not assigned in the Inspector. Please assign it in Unity.");
}
if ((Object)(object)BeamEffect == (Object)null)
{
Debug.LogError((object)"BeamEffect is not assigned in the Inspector. Please assign it in Unity.");
}
if ((Object)(object)BeamHitPoint != (Object)null)
{
BeamHitPoint.transform.SetParent((Transform)null);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0060: Unknown result type (might be due to invalid IL or missing references)
((FVRAlternateGrip)this).UpdateInteraction(hand);
Vector2 touchpadAxes = hand.Input.TouchpadAxes;
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown)
{
ToggleLaser();
}
}
else if (hand.Input.TouchpadDown && ((Vector2)(ref touchpadAxes)).magnitude > 0.25f && Vector2.Angle(touchpadAxes, Vector2.up) <= 45f)
{
ToggleLaser();
}
}
public override void FVRUpdate()
{
//IL_0019: 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_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (isLaserActive)
{
Vector3 position = Aperture.position + Aperture.forward * 1000f;
float num = 1000f;
if (Physics.Raycast(Aperture.position, Aperture.forward, ref m_hit, 1000f, LayerMask.op_Implicit(LM), (QueryTriggerInteraction)1))
{
position = ((RaycastHit)(ref m_hit)).point;
num = ((RaycastHit)(ref m_hit)).distance;
}
float num2 = num * 0.01f;
float num3 = Mathf.Lerp(0.01f, 0.2f, num2);
if ((Object)(object)BeamHitPoint != (Object)null)
{
BeamHitPoint.transform.position = position;
BeamHitPoint.transform.localScale = new Vector3(num3, num3, num3);
}
}
}
public override void OnDestroy()
{
((FVRInteractiveObject)this).OnDestroy();
if ((Object)(object)BeamHitPoint != (Object)null)
{
Object.Destroy((Object)(object)BeamHitPoint);
}
}
private void ToggleLaser()
{
//IL_0056: 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)
isLaserActive = !isLaserActive;
SetLaserState(isLaserActive);
if (isLaserActive)
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOnClip, ((Component)this).transform.position);
}
else
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_LaserOffClip, ((Component)this).transform.position);
}
}
private void SetLaserState(bool state)
{
if ((Object)(object)BeamHitPoint != (Object)null)
{
BeamHitPoint.SetActive(state);
}
if ((Object)(object)BeamEffect != (Object)null)
{
BeamEffect.SetActive(state);
}
}
}