using System;
using System.Collections.Generic;
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 PlaySound : MonoBehaviour
{
public AudioSource audioSource;
public void PlayButtonSound()
{
if ((Object)(object)audioSource != (Object)null)
{
audioSource.Play();
}
}
}
namespace Volksterism.Type97Grenade;
[BepInPlugin("Volksterism.Type97Grenade", "Type97Grenade", "2.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Type97GrenadePlugin : 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.Type97Grenade");
OtherLoader.RegisterDirectLoad(BasePath, "Volksterism.Type97Grenade", "", "", "type97grenade", "");
}
}
public class BouncingObject : MonoBehaviour
{
public float bounceForce = 10f;
public float bounceInterval = 0.5f;
public float bounceDuration = 5f;
public Vector3 randomDirectionRange = new Vector3(1f, 1f, 1f);
private Rigidbody rb;
private float bounceTimer = 0f;
private float durationTimer = 0f;
private void Start()
{
rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)rb == (Object)null)
{
Debug.LogError((object)"Rigidbody component not found. Please add a Rigidbody component to this object.");
((Behaviour)this).enabled = false;
}
}
private void Update()
{
if (!((Behaviour)this).enabled)
{
return;
}
durationTimer += Time.deltaTime;
if (durationTimer >= bounceDuration)
{
((Behaviour)this).enabled = false;
return;
}
bounceTimer += Time.deltaTime;
if (bounceTimer >= bounceInterval)
{
Bounce();
bounceTimer = 0f;
}
}
private void Bounce()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_0064: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(Random.Range(0f - randomDirectionRange.x, randomDirectionRange.x), Random.Range(0.5f, 1f), Random.Range(0f - randomDirectionRange.z, randomDirectionRange.z));
Vector3 normalized = ((Vector3)(ref val)).normalized;
rb.AddForce(normalized * bounceForce, (ForceMode)1);
}
}
public class HelicopterBlade1 : MonoBehaviour
{
public float rotationSpeed = 1000f;
private bool isRotating = false;
private void Update()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)32))
{
ToggleRotation();
}
if (isRotating)
{
((Component)this).transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
}
}
private void ToggleRotation()
{
isRotating = !isRotating;
if (isRotating)
{
Debug.Log((object)"Helicopter blades started rotating.");
}
else
{
Debug.Log((object)"Helicopter blades stopped rotating.");
}
}
}
public class HelicopterBladeH3VR : MonoBehaviour
{
public float rotationSpeed = 2500f;
private void Update()
{
}
}
[Serializable]
public class ArmSettings
{
public Transform armTransform;
public Vector3 extendedRotation;
}
public class HelicopterControl : MonoBehaviour
{
public Transform[] bladeTransforms;
public float rotationSpeed = 1000f;
public ArmSettings[] armSettings;
public float extensionSpeed = 1f;
public float forwardSpeed = 10f;
private bool isMovingForward = false;
private bool isActivated = false;
private Vector3[] initialRotations;
private void Start()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
initialRotations = (Vector3[])(object)new Vector3[armSettings.Length];
for (int i = 0; i < armSettings.Length; i++)
{
ref Vector3 reference = ref initialRotations[i];
reference = armSettings[i].armTransform.localEulerAngles;
}
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)32))
{
isActivated = !isActivated;
}
if (isActivated)
{
ExtendArms();
RotateBlades();
MoveForward();
}
else
{
RetractArms();
StopMoving();
}
}
private void ExtendArms()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < armSettings.Length; i++)
{
armSettings[i].armTransform.localRotation = Quaternion.Lerp(armSettings[i].armTransform.localRotation, Quaternion.Euler(armSettings[i].extendedRotation), extensionSpeed * Time.deltaTime);
}
}
private void RetractArms()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < armSettings.Length; i++)
{
armSettings[i].armTransform.localRotation = Quaternion.Lerp(armSettings[i].armTransform.localRotation, Quaternion.Euler(initialRotations[i]), extensionSpeed * Time.deltaTime);
}
}
private void RotateBlades()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Transform[] array = bladeTransforms;
foreach (Transform val in array)
{
val.Rotate(Vector3.up * rotationSpeed * Time.deltaTime, (Space)1);
}
}
private void MoveForward()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
if (!isMovingForward)
{
isMovingForward = true;
Debug.Log((object)"Moving forward");
}
((Component)this).transform.Translate(Vector3.forward * forwardSpeed * Time.deltaTime);
}
private void StopMoving()
{
if (isMovingForward)
{
isMovingForward = false;
Debug.Log((object)"Stopping forward movement");
}
}
public bool IsInteractable()
{
return !isActivated;
}
public void BeginInteraction(FVRViveHand hand)
{
isActivated = true;
}
}
public class ObjectReturner : MonoBehaviour
{
public float timeLimit = 20f;
private Vector3 originalPosition;
private bool isCheckingPosition = false;
private float timer = 0f;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
originalPosition = ((Component)this).transform.position;
}
private void Update()
{
if (!isCheckingPosition)
{
timer += Time.deltaTime;
if (timer >= timeLimit)
{
isCheckingPosition = true;
CheckAndReturnObject();
}
}
}
private void CheckAndReturnObject()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
if (((Component)this).transform.position != originalPosition)
{
((Component)this).transform.position = originalPosition;
}
timer = 0f;
isCheckingPosition = false;
}
}
public class SimpleActivator : MonoBehaviour
{
private void Update()
{
if (Input.GetKeyDown((KeyCode)32))
{
Debug.Log((object)"Spacebar pressed! The script works!");
}
}
}
public class WaterCanteen : MonoBehaviour
{
public int maxCharges = 5;
public int currentCharges = 5;
public MonoBehaviour actionScript;
public KeyCode useKey = (KeyCode)32;
private void Start()
{
currentCharges = maxCharges;
}
private void Update()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(useKey))
{
UseCanteen();
}
}
public void UseCanteen()
{
if (currentCharges > 0)
{
Debug.Log((object)("Player used the water canteen. Remaining charges: " + (currentCharges - 1)));
if ((Object)(object)actionScript != (Object)null)
{
((Component)actionScript).SendMessage("PerformAction", (SendMessageOptions)1);
Debug.Log((object)"Action script was triggered by the water canteen.");
CheckActionScriptActivation();
}
currentCharges--;
}
else
{
Debug.Log((object)"The water canteen is empty. Find more water!");
}
}
private void CheckActionScriptActivation()
{
}
}
public class Type97Grenade : FVRPhysicalObject
{
[Tooltip("Enables verbose console logging for debugging.")]
public bool EnableDebugLogging = false;
[Header("Striker Setup")]
[Tooltip("The moving plunger/striker transform that depresses when struck.")]
public Transform StrikerTransform;
[Tooltip("Dedicated collider on the striker cap used for collision filtering.")]
public Collider StrikerCollider;
[Tooltip("Distance in meters the striker moves downward when primed.")]
public float StrikerDepressDistance = 0.005f;
[Tooltip("Downward axis of depression in local space.")]
public Vector3 StrikerDepressAxis = new Vector3(0f, -1f, 0f);
[Tooltip("Minimum impact velocity required to drive the striker down on world surfaces.")]
public float MinStrikeSpeed = 1f;
[Tooltip("Radius around the striker transform that counts as a cap impact.")]
public float StrikerProximityRadius = 0.04f;
[Header("Collision Layers")]
[Tooltip("Layers that can trigger the striker when struck against.")]
public LayerMask StrikerLayers;
[Header("Hand Striking")]
[Tooltip("Allows striking the primer against the player's other hand/controller in VR.")]
public bool AllowHandStrike = true;
[Tooltip("Maximum distance from the other hand to register a hand strike.")]
public float HandStrikeDistance = 0.1f;
[Tooltip("Minimum relative speed between hands to trigger primer ignition.")]
public float MinHandStrikeSpeed = 0.8f;
[Header("Head / Helmet Striking")]
[Tooltip("Allows striking the primer against the player's helmet/head.")]
public bool AllowHeadStrike = true;
[Tooltip("Maximum distance from the player's HMD head center to register a strike.")]
public float HeadStrikeDistance = 0.28f;
[Tooltip("Minimum hand speed near the head to trigger primer ignition.")]
public float MinHeadStrikeSpeed = 0.6f;
[Tooltip("Optional accessibility toggle allowing touchpad down or B/Y button to strike the primer while held.")]
public bool AllowButtonStrikeFallback = false;
[Header("Fuse & Detonation")]
[Tooltip("Delay in seconds from primer strike until detonation.")]
public float FuseTime = 4.5f;
[Tooltip("List of explosion prefabs spawned upon detonation.")]
public List<GameObject> SpawnOnSplode = new List<GameObject>();
[Tooltip("Particle system emitting fuse sparks/smoke while burning.")]
public ParticleSystem FuseParticles;
[Tooltip("Player identification friend-or-foe index.")]
public int IFF;
[Header("Audio Events")]
[Tooltip("Sound played when the striker hits the percussion primer.")]
public AudioEvent AudEvent_PrimerPop;
[Tooltip("Sound played when the safety pin is detached.")]
public AudioEvent AudEvent_Pinpull;
private bool m_isPinPulled = false;
private bool m_isPrimed = false;
private bool m_hasExploded = false;
private float m_currentFuseTime = 0f;
private Vector3 m_strikerRestLocalPos;
private Vector3 m_strikerDepressedLocalPos;
private List<Type97Ring> m_rings = new List<Type97Ring>();
public void RegisterRing(Type97Ring ring)
{
if ((Object)(object)ring != (Object)null && !m_rings.Contains(ring))
{
m_rings.Add(ring);
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Registered ring: " + ((Object)((Component)ring).gameObject).name));
}
}
}
public void OnPinPulled()
{
bool flag = true;
for (int i = 0; i < m_rings.Count; i++)
{
if ((Object)(object)m_rings[i] != (Object)null && !m_rings[i].HasPinDetached())
{
flag = false;
break;
}
}
if (flag)
{
m_isPinPulled = true;
if (EnableDebugLogging)
{
Debug.Log((object)"[Type97Grenade] All safety pins detached. Striker is now live!");
}
}
}
public void PrimeGrenade()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (m_isPinPulled && !m_isPrimed && !m_hasExploded)
{
m_isPrimed = true;
m_currentFuseTime = FuseTime;
if ((Object)(object)StrikerTransform != (Object)null)
{
StrikerTransform.localPosition = m_strikerDepressedLocalPos;
}
if (AudEvent_PrimerPop != null)
{
SM.PlayGenericSound(AudEvent_PrimerPop, ((Component)this).transform.position);
}
if ((Object)(object)FuseParticles != (Object)null)
{
FuseParticles.Play();
}
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Primer struck! Fuse armed: " + FuseTime.ToString("F2") + "s"));
}
}
}
public override void Awake()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).Awake();
if ((Object)(object)StrikerTransform != (Object)null)
{
m_strikerRestLocalPos = StrikerTransform.localPosition;
m_strikerDepressedLocalPos = m_strikerRestLocalPos + ((Vector3)(ref StrikerDepressAxis)).normalized * StrikerDepressDistance;
}
}
public override void FVRUpdate()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00c1: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (m_isPinPulled && !m_isPrimed && ((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
Vector3 val = ((!((Object)(object)StrikerTransform != (Object)null)) ? ((Component)this).transform.position : StrikerTransform.position);
if (AllowHandStrike)
{
FVRViveHand otherHand = ((FVRInteractiveObject)this).m_hand.OtherHand;
if ((Object)(object)otherHand != (Object)null)
{
float num = Vector3.Distance(((HandInput)(ref otherHand.Input)).Pos, val);
if (num <= HandStrikeDistance)
{
Vector3 val2 = otherHand.Input.VelLinearWorld - ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld;
float magnitude = ((Vector3)(ref val2)).magnitude;
if (magnitude >= MinHandStrikeSpeed)
{
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Hand strike triggered! Speed: " + magnitude.ToString("F2")));
}
PrimeGrenade();
}
}
}
}
if (AllowHeadStrike && !m_isPrimed && (Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)GM.CurrentPlayerBody.Head != (Object)null)
{
Vector3 position = GM.CurrentPlayerBody.Head.position;
float num2 = Vector3.Distance(position, val);
if (num2 <= HeadStrikeDistance)
{
Vector3 velLinearWorld = ((FVRInteractiveObject)this).m_hand.Input.VelLinearWorld;
float magnitude2 = ((Vector3)(ref velLinearWorld)).magnitude;
if (EnableDebugLogging && magnitude2 > 0.3f)
{
Debug.Log((object)("[Type97Grenade] Head proximity detected! Dist: " + num2.ToString("F3") + "m, HandSpeed: " + magnitude2.ToString("F2") + "m/s"));
}
if (magnitude2 >= MinHeadStrikeSpeed)
{
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Head/helmet strike triggered! Speed: " + magnitude2.ToString("F2") + ", Dist: " + num2.ToString("F3")));
}
PrimeGrenade();
}
}
}
}
if (m_isPrimed && !m_hasExploded)
{
m_currentFuseTime -= Time.deltaTime;
if (m_currentFuseTime <= 0f)
{
Explode();
}
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).UpdateInteraction(hand);
if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
{
IFF = GM.CurrentPlayerBody.GetPlayerIFF();
}
if (!AllowButtonStrikeFallback || !m_isPinPulled || m_isPrimed)
{
return;
}
bool flag = false;
if (hand.IsInStreamlinedMode && hand.Input.BYButtonDown)
{
flag = true;
}
else if (!hand.IsInStreamlinedMode && hand.Input.TouchpadDown)
{
flag = true;
}
if (flag)
{
if (EnableDebugLogging)
{
Debug.Log((object)"[Type97Grenade] Accessibility button strike triggered.");
}
PrimeGrenade();
}
}
public override void OnCollisionEnter(Collision col)
{
//IL_00cb: 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_00d0: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).OnCollisionEnter(col);
if (!m_isPinPulled || m_isPrimed || m_hasExploded)
{
return;
}
int num = 1 << col.gameObject.layer;
if ((((LayerMask)(ref StrikerLayers)).value & num) == 0)
{
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Collision ignored: Layer " + LayerMask.LayerToName(col.gameObject.layer) + " not in StrikerLayers."));
}
return;
}
ContactPoint[] contacts = col.contacts;
if (contacts == null || contacts.Length == 0)
{
return;
}
Vector3 val = ((!((Object)(object)StrikerTransform != (Object)null)) ? ((Component)this).transform.position : StrikerTransform.position);
Vector3 relativeVelocity = col.relativeVelocity;
float magnitude = ((Vector3)(ref relativeVelocity)).magnitude;
for (int i = 0; i < contacts.Length; i++)
{
bool flag = false;
if ((Object)(object)StrikerCollider != (Object)null && (Object)(object)((ContactPoint)(ref contacts[i])).thisCollider == (Object)(object)StrikerCollider)
{
flag = true;
}
else if (Vector3.Distance(((ContactPoint)(ref contacts[i])).point, val) <= StrikerProximityRadius)
{
flag = true;
}
if (!flag)
{
continue;
}
if (EnableDebugLogging)
{
Debug.Log((object)("[Type97Grenade] Cap contact detected with " + ((Object)col.gameObject).name + " on layer " + LayerMask.LayerToName(col.gameObject.layer) + "! ImpactSpeed: " + magnitude.ToString("F2") + "m/s (Req: " + MinStrikeSpeed.ToString("F2") + ")"));
}
if (magnitude >= MinStrikeSpeed)
{
if (EnableDebugLogging)
{
Debug.Log((object)"[Type97Grenade] Surface strike registered!");
}
PrimeGrenade();
break;
}
}
}
private void Explode()
{
//IL_0057: 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)
if (m_hasExploded)
{
return;
}
m_hasExploded = true;
if (SpawnOnSplode != null)
{
for (int i = 0; i < SpawnOnSplode.Count; i++)
{
if ((Object)(object)SpawnOnSplode[i] != (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(SpawnOnSplode[i], ((Component)this).transform.position, Quaternion.identity);
Explosion component = val.GetComponent<Explosion>();
if ((Object)(object)component != (Object)null)
{
component.IFF = IFF;
}
ExplosionSound component2 = val.GetComponent<ExplosionSound>();
if ((Object)(object)component2 != (Object)null)
{
component2.IFF = IFF;
}
GrenadeExplosion component3 = val.GetComponent<GrenadeExplosion>();
if ((Object)(object)component3 != (Object)null)
{
component3.IFF = IFF;
}
}
}
}
if (((FVRInteractiveObject)this).IsHeld && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
hand.ForceSetInteractable((FVRInteractiveObject)null);
((FVRInteractiveObject)this).EndInteraction(hand);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class Type97Ring : FVRInteractiveObject
{
[Tooltip("Enables verbose console logging for debugging.")]
public bool EnableDebugLogging = false;
[Tooltip("The parent Type 97 grenade component.")]
public Type97Grenade Grenade;
[Tooltip("The physical safety pin object that pulls out and becomes physical.")]
public FVRPhysicalObject Pin;
[Tooltip("Travel distance along forward vector required to extract the pin.")]
public float PinLength = 0.01f;
[Tooltip("Optional WaggleJoint for ring physics dangling animation.")]
public WaggleJoint Waggle;
[Tooltip("Hinge graphic rotation offset when gripped in hand.")]
public Vector3 GrabEuler;
[Tooltip("Enables swapping the pin mesh upon pull.")]
public bool UsesSwapPin;
[Tooltip("Alternate mesh swapped onto the pin when pulled.")]
public Mesh SwapPin;
private Transform m_pointIn;
private Transform m_pointOut;
private Transform m_pointMaxGrab;
private float m_posMin;
private float m_posMax;
private float m_posMaxGrab;
private float m_posCurrent;
private float m_heldTarget;
private float m_handZOffset;
private bool m_hasPinDetached;
private bool m_hasSwapped;
public bool HasPinDetached()
{
return m_hasPinDetached;
}
public override bool IsInteractable()
{
if ((Object)(object)Grenade != (Object)null && (Object)(object)((FVRPhysicalObject)Grenade).QuickbeltSlot != (Object)null && ((FVRPhysicalObject)Grenade).m_isSpawnLock)
{
return false;
}
return !m_hasPinDetached && ((FVRInteractiveObject)this).IsInteractable();
}
public override void Start()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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_00ca: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Grenade != (Object)null)
{
Grenade.RegisterRing(this);
}
if ((Object)(object)Pin != (Object)null && (Object)(object)Grenade != (Object)null)
{
GameObject val = new GameObject("Ring_PointIn");
m_pointIn = val.transform;
m_pointIn.SetParent(((Component)Grenade).transform);
m_pointIn.localPosition = ((Component)Pin).transform.localPosition;
m_pointIn.localRotation = ((Component)Pin).transform.localRotation;
m_posMin = m_pointIn.localPosition.z;
GameObject val2 = new GameObject("Ring_PointOut");
m_pointOut = val2.transform;
m_pointOut.SetParent(((Component)Grenade).transform);
m_pointOut.position = ((Component)this).transform.position + ((Component)Pin).transform.forward * PinLength;
m_pointOut.localRotation = ((Component)Pin).transform.localRotation;
m_posMax = m_pointOut.localPosition.z;
GameObject val3 = new GameObject("Ring_PointMaxGrab");
m_pointMaxGrab = val3.transform;
m_pointMaxGrab.SetParent(((Component)Grenade).transform);
m_pointMaxGrab.position = ((Component)this).transform.position + ((Component)Pin).transform.forward * (PinLength * 3f);
m_pointMaxGrab.localRotation = ((Component)Pin).transform.localRotation;
m_posMaxGrab = m_pointMaxGrab.localPosition.z;
m_posCurrent = ((Component)Pin).transform.localPosition.z;
}
((FVRInteractiveObject)this).Start();
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
((FVRInteractiveObject)this).BeginInteraction(hand);
if ((Object)(object)Pin != (Object)null)
{
m_handZOffset = ((Component)Pin).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z;
}
}
public override void EndInteraction(FVRViveHand hand)
{
if ((Object)(object)Waggle != (Object)null)
{
Waggle.ResetParticlePos();
}
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override void FVRUpdate()
{
UpdatePinPos();
((FVRInteractiveObject)this).FVRUpdate();
}
private void UpdatePinPos()
{
//IL_005c: 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)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Pin == (Object)null || (Object)(object)Grenade == (Object)null || m_hasPinDetached)
{
return;
}
if (((FVRInteractiveObject)this).IsHeld && (Object)(object)base.m_hand != (Object)null)
{
Vector3 val = ((HandInput)(ref base.m_hand.Input)).Pos + -((Component)Pin).transform.forward * m_handZOffset;
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(m_pointIn.position, m_pointMaxGrab.position, val);
m_heldTarget = ((Component)Grenade).transform.InverseTransformPoint(closestValidPoint).z;
}
float num = m_posCurrent;
if (((FVRInteractiveObject)this).IsHeld)
{
float num2 = Mathf.InverseLerp(m_posMin, m_posMaxGrab, m_heldTarget);
float num3 = Mathf.Lerp(0.02f, 0.6f, num2 * num2 * num2 * num2);
num = Mathf.MoveTowards(m_posCurrent, m_heldTarget, num3 * Time.deltaTime);
}
if (Mathf.Abs(num - m_posCurrent) > Mathf.Epsilon)
{
m_posCurrent = num;
((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_posCurrent);
((Component)Pin).transform.localPosition = new Vector3(((Component)Pin).transform.localPosition.x, ((Component)Pin).transform.localPosition.y, m_posCurrent);
if (UsesSwapPin && !m_hasSwapped && (Object)(object)SwapPin != (Object)null)
{
MeshFilter component = ((Component)Pin).gameObject.GetComponent<MeshFilter>();
if ((Object)(object)component != (Object)null)
{
m_hasSwapped = true;
component.mesh = SwapPin;
}
}
}
if (m_posCurrent > m_posMax && ((FVRInteractiveObject)this).IsHeld)
{
DetachPin();
}
if (!((Object)(object)Waggle != (Object)null))
{
return;
}
if (((FVRInteractiveObject)this).IsHeld)
{
if ((Object)(object)Waggle.hingeGraphic != (Object)null)
{
Waggle.hingeGraphic.localEulerAngles = GrabEuler;
}
}
else
{
Waggle.Execute();
}
}
private void DetachPin()
{
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
if (m_hasPinDetached)
{
return;
}
m_hasPinDetached = true;
if ((Object)(object)Pin != (Object)null)
{
Rigidbody val = ((Component)Pin).gameObject.GetComponent<Rigidbody>();
if ((Object)(object)val == (Object)null)
{
val = ((Component)Pin).gameObject.AddComponent<Rigidbody>();
}
val.mass = 0.02f;
Pin.RootRigidbody = val;
FVRViveHand hand = base.m_hand;
((FVRInteractiveObject)this).ForceBreakInteraction();
((Component)this).transform.SetParent(((Component)Pin).transform);
((Behaviour)Pin).enabled = true;
if ((Object)(object)hand != (Object)null)
{
hand.ForceSetInteractable((FVRInteractiveObject)(object)Pin);
if (Vector3.Distance(((Component)Pin).transform.position, ((HandInput)(ref hand.Input)).Pos) > 0.04f)
{
((Component)Pin).transform.position = ((HandInput)(ref hand.Input)).Pos;
}
((FVRInteractiveObject)Pin).BeginInteraction(hand);
}
}
if ((Object)(object)Grenade != (Object)null)
{
if (Grenade.AudEvent_Pinpull != null)
{
SM.PlayGenericSound(Grenade.AudEvent_Pinpull, ((Component)this).transform.position);
}
Grenade.OnPinPulled();
}
Collider component = ((Component)this).GetComponent<Collider>();
if ((Object)(object)component != (Object)null)
{
component.enabled = false;
}
((Behaviour)this).enabled = false;
if (EnableDebugLogging)
{
Debug.Log((object)"[Type97Ring] Pin fully detached and physicalized.");
}
}
}