Decompiled source of Meloncorp Kukri Mk2 v1.0.0
Meloncorp_Kukri_Mk2.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OpenScripts2; using OtherLoader; using Sodalite.Api; using Sodalite.Utilities; using UnityEditor; using UnityEngine; using UnityEngine.AI; using UnityEngine.UI; using VolksScripts; [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 VolksScripts { public class NVGPowerSwitch : FVRInteractiveObject { public PIPScope Scope; [HideInInspector] public bool Toggle = true; public override void SimpleInteraction(FVRViveHand hand) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).SimpleInteraction(hand); SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position); if (Toggle) { Scope.enableNightvision = (Scope.enableThermal = false); } else { Scope.enableNightvision = (Scope.enableThermal = true); } Toggle = !Toggle; } } public class ANVIS21Control : MonoBehaviour { public Transform armreal; public Transform armfake; public PIPScope scopeL; public PIPScope scopeR; public float onspeed = 0.5f; public float offspeed = 0.5f; public AudioEvent powerOn; public AudioEvent powerOff; public bool isOn; private float gainVelL; private float gainVelR; private float brightVelL; private float brightVelR; public bool IsOn => isOn; private void Start() { SetScopesImmediate(0f); } private void Update() { SyncArms(); UpdateNVG(); } public void SetPower(bool value) { //IL_006d: 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) if (isOn == value) { return; } isOn = value; if (isOn) { if (powerOn != null) { SM.PlayCoreSound((FVRPooledAudioType)10, powerOn, ((Component)this).transform.position); } } else if (powerOff != null) { SM.PlayCoreSound((FVRPooledAudioType)10, powerOff, ((Component)this).transform.position); } } private void SyncArms() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)armreal == (Object)null) && !((Object)(object)armfake == (Object)null)) { armfake.localPosition = armreal.localPosition; armfake.localRotation = armreal.localRotation; } } private void UpdateNVG() { float num = ((!isOn) ? 0f : 1f); float num2 = ((!isOn) ? offspeed : onspeed); if ((Object)(object)scopeL != (Object)null) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, num, ref brightVelL, num2); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, num, ref gainVelL, num2); ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); } if ((Object)(object)scopeR != (Object)null) { scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, num, ref brightVelR, num2); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, num, ref gainVelR, num2); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); } } private void SetScopesImmediate(float value) { if ((Object)(object)scopeL != (Object)null) { scopeL.nvDef.nightVisionTargetBrightness = value; scopeL.nightVisionManualGainFactor = value; } if ((Object)(object)scopeR != (Object)null) { scopeR.nvDef.nightVisionTargetBrightness = value; scopeR.nightVisionManualGainFactor = value; } } } public class ANVIS21PowerSwitch : FVRInteractiveObject { public ANVIS21Control control; public Transform switchTransform; public Vector3 offEulerAngles; public Vector3 onEulerAngles; public float lerpSpeed = 8f; private float m_lerp; protected void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).Awake(); if ((Object)(object)switchTransform == (Object)null) { switchTransform = ((Component)this).transform; } if ((Object)(object)control != (Object)null) { m_lerp = ((!control.IsOn) ? 0f : 1f); switchTransform.localEulerAngles = Vector3.Lerp(offEulerAngles, onEulerAngles, m_lerp); } } public override void SimpleInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).SimpleInteraction(hand); if (!((Object)(object)control == (Object)null)) { control.SetPower(!control.IsOn); } } protected void FVRUpdate() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).FVRUpdate(); if (!((Object)(object)control == (Object)null) && !((Object)(object)switchTransform == (Object)null)) { float num = ((!control.IsOn) ? 0f : 1f); m_lerp = Mathf.MoveTowards(m_lerp, num, Time.deltaTime * lerpSpeed); switchTransform.localEulerAngles = Vector3.Lerp(offEulerAngles, onEulerAngles, m_lerp); } } } } public class ForceBindToHead : MonoBehaviour { [Tooltip("The object that should follow the player's head (e.g. NVG physical root).")] public GameObject phys; [Tooltip("Optional: if true, runs even when not equipped.")] public bool alwaysFollow = true; private Transform headTransform; private void Start() { if ((Object)(object)GM.CurrentMovementManager != (Object)null && (Object)(object)GM.CurrentMovementManager.Head != (Object)null) { headTransform = ((Component)GM.CurrentMovementManager.Head).transform; } else { Debug.LogWarning((object)"[ForceBindToHead] Could not find head transform."); } } private void FixedUpdate() { //IL_00ac: 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) if (!((Object)(object)phys == (Object)null) && (alwaysFollow || !((Object)(object)headTransform == (Object)null))) { if ((Object)(object)headTransform == (Object)null && (Object)(object)GM.CurrentMovementManager != (Object)null) { headTransform = ((Component)GM.CurrentMovementManager.Head).transform; } if ((Object)(object)phys.transform.parent != (Object)(object)headTransform) { phys.transform.SetParent(headTransform); } phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; } } } namespace JerryComponent { public class PNV57EControl : MonoBehaviour { public GameObject phys; public GameObject armreal; public GameObject armfake; public Vector3 velLinearWorldL; public Vector3 velLinearWorldR; public Transform slapdirUP; public Transform slapdirDown; public HeadAttachment HA; public PIPScope scopeL; public PIPScope scopeR; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; public AudioSource whing; public float volref; private void Start() { scopeL.nvDef.nightVisionTargetBrightness = 0f; scopeL.nightVisionManualGainFactor = 0f; scopeR.nvDef.nightVisionTargetBrightness = 0f; scopeR.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; volref = 0f; whing.volume = 0f; whing.pitch = 0f; } private void FixedUpdate() { //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: 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_008a: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Invalid comparison between Unknown and I4 //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); if (isheadmounted) { armfake.transform.localEulerAngles = armreal.transform.localEulerAngles; phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld; velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld; if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } } if (powerknob.transform.localEulerAngles.x > 15f) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref volref, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0.5f, ref volref, onspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 1.3f, ref volref, onspeed); if (!started) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); } } public class PNV57EControlAdj : MonoBehaviour { public GameObject phys; public PIPScope scopeL; public PIPScope scopeR; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; public AudioSource whing; public float volref; public float pitref; public float volume; public float pitch; public GameObject root; public int scopePara; private void Start() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) scopePara = GM.Options.SimulationOptions.ScopeRecursiveRendering; GM.Options.SimulationOptions.ScopeRecursiveRendering = 0; GM.RefreshQuality(); powerknob.transform.localEulerAngles = new Vector3(30f, 0f, 0f); scopeL.nvDef.nightVisionTargetBrightness = 0f; scopeL.nightVisionManualGainFactor = 0f; scopeR.nvDef.nightVisionTargetBrightness = 0f; scopeR.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; volref = 0f; pitref = 0f; whing.volume = 0f; whing.pitch = 0f; } private void FixedUpdate() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) root.transform.localPosition = new Vector3(0f, 0f, 0f); ((Behaviour)scopeL).enabled = true; scopeL.UpdateParameters(); ((Behaviour)scopeR).enabled = true; scopeR.UpdateParameters(); if (isheadmounted) { phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; } if (powerknob.transform.localEulerAngles.x > 15f) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 0f, ref reflum, offspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 0f, ref reflum, offspeed); whing.volume = Mathf.SmoothDamp(whing.volume, 0f, ref volref, offspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, 0f, ref pitref, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scopeL.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeL.nightVisionManualGainFactor, 1f, ref reflum, onspeed); scopeR.nightVisionManualGainFactor = Mathf.SmoothDamp(scopeR.nightVisionManualGainFactor, 1f, ref reflum, onspeed); whing.volume = Mathf.SmoothDamp(whing.volume, volume, ref volref, onspeed); whing.pitch = Mathf.SmoothDamp(whing.pitch, pitch, ref pitref, onspeed); if (!started) { scopeL.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeL.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); scopeR.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scopeR.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scopeL.nvDef.nightVisionTargetBrightness > 0.9f && scopeR.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); GM.Options.SimulationOptions.ScopeRecursiveRendering = scopePara; GM.RefreshQuality(); } } public class PVS7Control : MonoBehaviour { public GameObject phys; public GameObject armreal; public GameObject armfake; public Vector3 velLinearWorldL; public Vector3 velLinearWorldR; public Transform slapdirUP; public Transform slapdirDown; public HeadAttachment HA; public PIPScope scope; public GameObject powerknob; public float refgain; public float reflum; public AudioEvent flip; public bool started = false; public float onspeed = 0.5f; public float offspeed = 2.5f; public bool isheadmounted = true; private void Start() { scope.nvDef.nightVisionTargetBrightness = 0f; scope.nightVisionManualGainFactor = 0f; refgain = 0f; reflum = 0f; } private void FixedUpdate() { //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: 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) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Invalid comparison between Unknown and I4 //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)scope).enabled = true; scope.UpdateParameters(); if (isheadmounted) { armfake.transform.localEulerAngles = armreal.transform.localEulerAngles; phys.transform.SetParent(((Component)GM.CurrentMovementManager.Head).gameObject.transform); phys.transform.localPosition = Vector3.zero; phys.transform.localEulerAngles = Vector3.zero; velLinearWorldL = GM.CurrentMovementManager.Hands[0].Input.VelLinearWorld; velLinearWorldR = GM.CurrentMovementManager.Hands[1].Input.VelLinearWorld; if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[0].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[0].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldL, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldL)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 0 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirUP.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirUP.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } else if ((Object)(object)GM.CurrentMovementManager.Hands[1].m_currentInteractable == (Object)null && (int)HA.MAState == 1 && Vector3.Distance(GM.CurrentMovementManager.Hands[1].PalmTransform.position, slapdirDown.position) < 0.15f && Vector3.Angle(velLinearWorldR, slapdirDown.forward) < 60f && ((Vector3)(ref velLinearWorldR)).magnitude > 1.5f) { HA.ToggleFlip(); SM.PlayCoreSound((FVRPooledAudioType)41, flip, phys.transform.position); } } if (powerknob.transform.localEulerAngles.x > 15f) { scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 0f, ref refgain, offspeed); scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 0f, ref reflum, offspeed); started = false; } else if (powerknob.transform.localEulerAngles.x < 15f) { scope.nightVisionManualGainFactor = Mathf.SmoothDamp(scope.nightVisionManualGainFactor, 1f, ref reflum, onspeed); if (!started) { scope.nvDef.nightVisionTargetBrightness = Mathf.SmoothDamp(scope.nvDef.nightVisionTargetBrightness, 1f, ref refgain, onspeed); } if (scope.nvDef.nightVisionTargetBrightness > 0.9f) { started = true; } } } private void OnDestroy() { Object.Destroy((Object)(object)phys); } } } namespace VolksScripts { public class Bulletholder : FVRPhysicalObject { [Header("Bullet Slots")] [Tooltip("Positions where rounds will be placed. Order defines fill order.")] public List<Transform> BulletSlots = new List<Transform>(); [Header("Visuals (optional)")] public MeshRenderer SlotHighlight; [Header("Behaviors")] public bool ClearVelocityOnPlace = true; [Header("Capacity")] public int capacity = 8; private FVRFireArmRound[] _storedRounds; public int NumRounds { get; private set; } protected void Awake() { ((FVRPhysicalObject)this).Awake(); if (BulletSlots == null) { BulletSlots = new List<Transform>(); } if (capacity <= 0 || capacity > BulletSlots.Count) { capacity = BulletSlots.Count; } _storedRounds = (FVRFireArmRound[])(object)new FVRFireArmRound[capacity]; NumRounds = 0; UpdateBulletDisplay(); } public bool TryPlace(FVRFireArmRound round) { if ((Object)(object)round == (Object)null || NumRounds >= capacity || capacity <= 0) { Debug.Log((object)"TryPlace failed: round is null or holder is full."); return false; } int num = FindFirstFreeSlot(); if (num < 0) { Debug.Log((object)"TryPlace failed: no free slot found."); return false; } Debug.Log((object)("TryPlace: placing round at slot " + num)); return PlaceAtIndex(round, num); } public bool PlaceAtIndex(FVRFireArmRound round, int index) { if ((Object)(object)round == (Object)null || index < 0 || index >= capacity || index >= BulletSlots.Count) { Debug.Log((object)("PlaceAtIndex failed: invalid round or index " + index)); return false; } if ((Object)(object)BulletSlots[index] == (Object)null) { Debug.Log((object)("PlaceAtIndex failed: slot " + index + " is null")); return false; } if ((Object)(object)_storedRounds[index] != (Object)null) { Debug.Log((object)("PlaceAtIndex failed: slot " + index + " already occupied")); return false; } PlaceAtSlot(round, BulletSlots[index]); _storedRounds[index] = round; NumRounds++; UpdateBulletDisplay(); if ((Object)(object)round != (Object)null) { ((FVRInteractiveObject)round).ForceBreakInteraction(); } Debug.Log((object)("PlaceAtIndex: round placed at slot " + index)); return true; } public FVRFireArmRound RemoveAt(int index) { if (index < 0 || index >= capacity) { return null; } FVRFireArmRound val = _storedRounds[index]; if ((Object)(object)val != (Object)null) { _storedRounds[index] = null; NumRounds--; UpdateBulletDisplay(); } return val; } public FVRFireArmRound GetAt(int index) { if (index < 0 || index >= capacity) { return null; } return _storedRounds[index]; } public void ClearAll() { for (int i = 0; i < capacity; i++) { _storedRounds[i] = null; } NumRounds = 0; UpdateBulletDisplay(); } private void PlaceAtSlot(FVRFireArmRound round, Transform slot) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0082: 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_012f: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0065: 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) if (!((Object)(object)slot == (Object)null)) { Vector3 up = ((Component)this).transform.up; Rigidbody val = ((!((Object)(object)((FVRPhysicalObject)round).RootRigidbody != (Object)null)) ? ((Component)round).GetComponent<Rigidbody>() : ((FVRPhysicalObject)round).RootRigidbody); if ((Object)(object)val != (Object)null && ClearVelocityOnPlace) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; } ((Component)round).transform.rotation = Quaternion.LookRotation(((Component)this).transform.forward, up); if (TryGetBaseAndTipAlongUp(round, up, out var baseAlongUp, out var _)) { float num = Vector3.Dot(slot.position, up); float num2 = num - baseAlongUp; Transform transform = ((Component)round).transform; transform.position += up * num2; Collider componentInChildren = ((Component)round).GetComponentInChildren<Collider>(); Bounds bounds = componentInChildren.bounds; Vector3 val2 = Vector3.ProjectOnPlane(slot.position, up); Vector3 val3 = Vector3.ProjectOnPlane(((Bounds)(ref bounds)).center, up); Vector3 val4 = val2 - val3; Transform transform2 = ((Component)round).transform; transform2.position += val4; } else { ((Component)round).transform.position = slot.position; } if ((Object)(object)SlotHighlight != (Object)null) { ((Component)SlotHighlight).transform.position = slot.position; } } } private bool TryGetBaseAndTipAlongUp(FVRFireArmRound round, Vector3 up, out float baseAlongUp, out float tipAlongUp) { //IL_0029: 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_0032: 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) baseAlongUp = (tipAlongUp = 0f); Collider componentInChildren = ((Component)round).GetComponentInChildren<Collider>(); if ((Object)(object)componentInChildren == (Object)null) { return false; } Bounds bounds = componentInChildren.bounds; baseAlongUp = Vector3.Dot(((Bounds)(ref bounds)).min, up); tipAlongUp = Vector3.Dot(((Bounds)(ref bounds)).max, up); return true; } private int FindFirstFreeSlot() { for (int i = 0; i < capacity; i++) { if (i < BulletSlots.Count && !((Object)(object)BulletSlots[i] == (Object)null) && (Object)(object)_storedRounds[i] == (Object)null) { return i; } } return -1; } public void UpdateBulletDisplay() { for (int i = 0; i < BulletSlots.Count; i++) { if ((Object)(object)BulletSlots[i] != (Object)null) { } } } private void OnTriggerEnter(Collider other) { FVRFireArmRound componentInParent = ((Component)other).GetComponentInParent<FVRFireArmRound>(); if (!((Object)(object)componentInParent == (Object)null)) { TryPlace(componentInParent); } } } public class BulletholderReloadTrigger : MonoBehaviour { public Bulletholder Holder; private void OnTriggerEnter(Collider other) { if ((Object)(object)Holder == (Object)null) { Debug.LogWarning((object)"BulletholderReloadTrigger: Holder not assigned."); return; } FVRFireArmRound componentInParent = ((Component)other).GetComponentInParent<FVRFireArmRound>(); if ((Object)(object)componentInParent != (Object)null) { Holder.TryPlace(componentInParent); } } } public class ShellCaddy : FVRFireArmMagazine { [Header("Caddy Configuration")] public int MaxCapacity = 8; public Transform DisplayContainer; private readonly List<FireArmRoundClass> roundClassData = new List<FireArmRoundClass>(); private int currentCapacity; private bool hasRoundType; private FireArmRoundType storedRoundType; private GameObject displayRoot; public override void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((FVRFireArmMagazine)this).Awake(); roundClassData.Clear(); currentCapacity = 0; hasRoundType = false; storedRoundType = (FireArmRoundType)0; } public override void Start() { ((FVRInteractiveObject)this).Start(); UpdateDisplayMag(); } public void AddShell(FVRFireArmRound shell) { //IL_005a: 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) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) if ((Object)(object)shell == (Object)null || !((FVRPhysicalObject)shell).m_isVisible || currentCapacity >= MaxCapacity) { Debug.LogWarning((object)"Invalid shell or caddy is full."); return; } if (!hasRoundType) { hasRoundType = true; storedRoundType = shell.RoundType; } if (shell.RoundType != storedRoundType) { Debug.LogWarning((object)"Shell type mismatch."); return; } roundClassData.Add(shell.RoundClass); currentCapacity++; Object.Destroy((Object)(object)((Component)shell).gameObject); UpdateDisplayMag(); } public FVRFireArmRound RemoveShell() { //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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) if (currentCapacity == 0) { Debug.LogWarning((object)"No shells to remove."); return null; } FireArmRoundClass val = roundClassData[currentCapacity - 1]; roundClassData.RemoveAt(currentCapacity - 1); currentCapacity--; if (!hasRoundType || (Object)(object)DisplayContainer == (Object)null) { UpdateDisplayMag(); return null; } GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)AM.GetRoundSelfPrefab(storedRoundType, val)).GetGameObject(), DisplayContainer.position, DisplayContainer.rotation); UpdateDisplayMag(); return val2.GetComponent<FVRFireArmRound>(); } private void UpdateDisplayMag() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0084: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) if ((Object)(object)displayRoot != (Object)null) { Object.Destroy((Object)(object)displayRoot); displayRoot = null; } if (currentCapacity <= 0 || (Object)(object)DisplayContainer == (Object)null || !hasRoundType) { return; } displayRoot = new GameObject("ShellCaddyDisplay"); displayRoot.transform.SetParent(DisplayContainer, false); for (int i = 0; i < currentCapacity; i++) { GameObject val = Object.Instantiate<GameObject>(((AnvilAsset)AM.GetRoundSelfPrefab(storedRoundType, roundClassData[i])).GetGameObject(), displayRoot.transform); val.transform.localPosition = Vector3.down * (float)i * 0.02f; val.transform.localRotation = Quaternion.identity; Rigidbody component = val.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; component.detectCollisions = false; } Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(); for (int j = 0; j < componentsInChildren.Length; j++) { componentsInChildren[j].enabled = false; } } } public void ResetCaddy() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) roundClassData.Clear(); currentCapacity = 0; hasRoundType = false; storedRoundType = (FireArmRoundType)0; if ((Object)(object)displayRoot != (Object)null) { Object.Destroy((Object)(object)displayRoot); displayRoot = null; } UpdateDisplayMag(); } public void HandleCollision(Collider other) { FVRFireArmRound component = ((Component)other).GetComponent<FVRFireArmRound>(); if ((Object)(object)component != (Object)null) { AddShell(component); } } } public class ShellCaddy_Reception : MonoBehaviour { public ShellCaddy caddy; private void OnTriggerStay(Collider other) { caddy.HandleCollision(other); } } } public class Compass : FVRPhysicalObject { [Header("Compass Lid")] public Transform Lid; public float openRotationX = 90f; public float openRotationY = 0f; public float openRotationZ = 0f; public float closeRotationX = 0f; public float closeRotationY = 0f; public float closeRotationZ = 0f; public float lidRotationSpeed = 5f; public AudioSource openCloseAudioSource; public AudioClip openClip; public AudioClip closeClip; [Header("Compass Needle")] public Transform Needle; [Tooltip("The direction that is considered North. Default is (0,0,1) (Z+).")] public Vector3 NorthDirection = Vector3.forward; public float needleSmoothTime = 0.5f; public float needleWobbleAmount = 2f; public float needleWobbleSpeed = 5f; private bool isOpen = false; private bool isTouching = false; private Vector2 initTouch = Vector2.zero; private Vector2 lastTouchPoint = Vector2.zero; private float currentNeedleAngle = 0f; private float needleVelocity = 0f; private void Update() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Quaternion val = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ)); if ((Object)(object)Lid != (Object)null) { Lid.localRotation = Quaternion.Lerp(Lid.localRotation, val, Time.deltaTime * lidRotationSpeed); } if ((Object)(object)Needle != (Object)null) { Vector3 normalized = ((Vector3)(ref NorthDirection)).normalized; Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.forward, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(normalized, Vector3.up); float num = Mathf.Atan2(Vector3.Cross(val2, val3).y, Vector3.Dot(val2, val3)) * 57.29578f; float num2 = Mathf.Sin(Time.time * needleWobbleSpeed) * needleWobbleAmount; num += num2; currentNeedleAngle = Mathf.SmoothDampAngle(currentNeedleAngle, num, ref needleVelocity, needleSmoothTime); Needle.localRotation = Quaternion.Euler(0f, currentNeedleAngle, 0f); } } public void ToggleLid() { isOpen = !isOpen; if ((Object)(object)openCloseAudioSource != (Object)null) { openCloseAudioSource.PlayOneShot((!isOpen) ? closeClip : openClip); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) //IL_0069: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).UpdateInteraction(hand); if (hand.IsInStreamlinedMode) { if (hand.Input.BYButtonDown || hand.Input.AXButtonDown) { ToggleLid(); } return; } if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero) { isTouching = true; initTouch = hand.Input.TouchpadAxes; } if (hand.Input.TouchpadTouchUp && isTouching) { isTouching = false; Vector2 val = lastTouchPoint; float y = (val - initTouch).y; if (y > 0.5f || y < -0.5f) { ToggleLid(); } initTouch = Vector2.zero; val = Vector2.zero; } lastTouchPoint = hand.Input.TouchpadAxes; } } public class FlamethrowerValve : FVRInteractiveObject { [Header("References")] public Transform RefFrame; public Transform Valve; [Header("Rotation Settings")] public Vector2 ValveRotRange = new Vector2(-50f, 50f); private float m_valveRot; [Header("Runtime")] public float Lerp = 0.5f; private Vector3 refDir = Vector3.one; public override void BeginInteraction(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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((HandInput)(ref hand.Input)).Up; Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right); refDir = ((Vector3)(ref val)).normalized; ((FVRInteractiveObject)this).BeginInteraction(hand); } 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references) //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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((HandInput)(ref hand.Input)).Up; Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Mathf.Atan2(Vector3.Dot(RefFrame.right, Vector3.Cross(refDir, normalized)), Vector3.Dot(refDir, normalized)) * 57.29578f; num = Mathf.Clamp(num, -5f, 5f); m_valveRot += num; m_valveRot = Mathf.Clamp(m_valveRot, ValveRotRange.x, ValveRotRange.y); Valve.localEulerAngles = new Vector3(m_valveRot, 0f, 0f); Lerp = Mathf.InverseLerp(ValveRotRange.x, ValveRotRange.y, m_valveRot); refDir = normalized; ((FVRInteractiveObject)this).UpdateInteraction(hand); } } namespace VolksScripts { public class FlareBody : FVRPhysicalObject { [Header("Flare Parts")] public GameObject FlareHead; public Transform HeadAttachPoint; public Collider StrikeArea; [Header("Ignition")] public int MinStrikesToIgnite = 2; public int MaxStrikesToIgnite = 5; public float StrikeCooldown = 0.2f; [Header("Strike Force")] public float MinStrikeSpeed = 1.2f; [Header("Strike Effects")] public ParticleSystem StrikeParticles; public AudioSource StrikeSound; [Header("Effects")] public ParticleSystem FlareParticles; public Light FlareLight; public AudioSource IgniteSound; public AudioSource BurnLoopSound; public AudioSource DieSound; [Header("Lifetime")] public float FlareLifetime = 20f; [Header("Debug")] public bool EnableDebug = false; private int m_strikeCount = 0; private int m_strikesRequired = 3; private bool m_isHeadAttached = true; private bool m_isIgnited = false; private float m_lastStrikeTime = -1f; private Coroutine m_lifetimeCoroutine; public override void Awake() { ((FVRPhysicalObject)this).Awake(); AttachHead(); if ((Object)(object)FlareParticles != (Object)null) { FlareParticles.Stop(); } if ((Object)(object)FlareLight != (Object)null) { ((Behaviour)FlareLight).enabled = false; } if ((Object)(object)BurnLoopSound != (Object)null) { BurnLoopSound.Stop(); } int num = Mathf.Min(MinStrikesToIgnite, MaxStrikesToIgnite); int num2 = Mathf.Max(MinStrikesToIgnite, MaxStrikesToIgnite); m_strikesRequired = Random.Range(num, num2 + 1); } public void DetachHead() { if (!m_isHeadAttached) { return; } m_isHeadAttached = false; if ((Object)(object)FlareHead != (Object)null) { FlareHead.transform.parent = null; Rigidbody component = FlareHead.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; } } } public void AttachHead() { //IL_004c: 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) m_isHeadAttached = true; if ((Object)(object)FlareHead != (Object)null && (Object)(object)HeadAttachPoint != (Object)null) { FlareHead.transform.parent = HeadAttachPoint; FlareHead.transform.localPosition = Vector3.zero; FlareHead.transform.localRotation = Quaternion.identity; Rigidbody component = FlareHead.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.isKinematic = true; } FlareHead component2 = FlareHead.GetComponent<FlareHead>(); if ((Object)(object)component2 != (Object)null) { component2.Body = this; } } } public void TryStrikeFromHead(Collider headStrikeCollider, Collision col) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); return; } if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || col == null) { DebugLog("Missing strike refs."); return; } for (int i = 0; i < col.contacts.Length; i++) { ContactPoint val = col.contacts[i]; bool flag = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)headStrikeCollider || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)headStrikeCollider; bool flag2 = (Object)(object)((ContactPoint)(ref val)).thisCollider == (Object)(object)StrikeArea || (Object)(object)((ContactPoint)(ref val)).otherCollider == (Object)(object)StrikeArea; if (flag && flag2) { Vector3 relativeVelocity = col.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude >= MinStrikeSpeed) { Strike(); return; } Vector3 relativeVelocity2 = col.relativeVelocity; DebugLog("Speed too low: " + ((Vector3)(ref relativeVelocity2)).magnitude.ToString("F2")); return; } } DebugLog("No valid head/body strike in contacts."); } public void TryStrikeFromHead(Collider headStrikeCollider, Collider other) { if (m_isIgnited || m_isHeadAttached) { DebugLog("Blocked: ignited/head attached."); } else if ((Object)(object)StrikeArea == (Object)null || (Object)(object)headStrikeCollider == (Object)null || (Object)(object)other == (Object)null) { DebugLog("Missing strike refs."); } else if ((Object)(object)other == (Object)(object)StrikeArea) { float triggerStrikeSpeed = GetTriggerStrikeSpeed(other); if (triggerStrikeSpeed >= MinStrikeSpeed) { Strike(); } else { DebugLog("Trigger speed too low: " + triggerStrikeSpeed.ToString("F2")); } } } private float GetTriggerStrikeSpeed(Collider other) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_0043: 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_0048: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) Rigidbody component = ((Component)this).GetComponent<Rigidbody>(); Rigidbody attachedRigidbody = other.attachedRigidbody; Vector3 val = ((!((Object)(object)component != (Object)null)) ? Vector3.zero : component.velocity); Vector3 val2 = ((!((Object)(object)attachedRigidbody != (Object)null)) ? Vector3.zero : attachedRigidbody.velocity); Vector3 val3 = val - val2; return ((Vector3)(ref val3)).magnitude; } private void Strike() { if (!(Time.time - m_lastStrikeTime < StrikeCooldown)) { m_lastStrikeTime = Time.time; m_strikeCount++; if ((Object)(object)StrikeParticles != (Object)null) { StrikeParticles.Play(); } if ((Object)(object)StrikeSound != (Object)null) { StrikeSound.Play(); } if (m_strikeCount >= m_strikesRequired) { Ignite(); } } } private void Ignite() { m_isIgnited = true; if ((Object)(object)FlareParticles != (Object)null) { FlareParticles.Play(); } if ((Object)(object)FlareLight != (Object)null) { ((Behaviour)FlareLight).enabled = true; } if ((Object)(object)IgniteSound != (Object)null) { IgniteSound.Play(); } if ((Object)(object)BurnLoopSound != (Object)null) { BurnLoopSound.loop = true; BurnLoopSound.Play(); } if ((Object)(object)FlareHead != (Object)null) { Object.Destroy((Object)(object)FlareHead); } if (m_lifetimeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(m_lifetimeCoroutine); } m_lifetimeCoroutine = ((MonoBehaviour)this).StartCoroutine(FlareLifeCoroutine()); } private IEnumerator FlareLifeCoroutine() { yield return (object)new WaitForSeconds(FlareLifetime); if ((Object)(object)BurnLoopSound != (Object)null) { BurnLoopSound.Stop(); } if ((Object)(object)DieSound != (Object)null) { DieSound.Play(); } if ((Object)(object)FlareParticles != (Object)null) { FlareParticles.Stop(); } if ((Object)(object)FlareLight != (Object)null) { ((Behaviour)FlareLight).enabled = false; } float dieSoundLength = ((!((Object)(object)DieSound != (Object)null) || !((Object)(object)DieSound.clip != (Object)null)) ? 0f : DieSound.clip.length); yield return (object)new WaitForSeconds(dieSoundLength); Object.Destroy((Object)(object)((Component)this).gameObject); } private void DebugLog(string msg) { if (EnableDebug) { Debug.Log((object)("[FlareBody] " + msg)); } } } public class FlareHead : FVRPhysicalObject { [Header("Owner")] public FlareBody Body; [Header("Strike Collider")] public Collider StrikeCollider; public override void Awake() { ((FVRPhysicalObject)this).Awake(); } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); if ((Object)(object)Body != (Object)null) { Body.DetachHead(); } } private void OnTransformParentChanged() { if ((Object)(object)Body != (Object)null && (Object)(object)((Component)this).transform.parent == (Object)null) { Body.DetachHead(); } } public override void OnCollisionEnter(Collision col) { ((FVRPhysicalObject)this).OnCollisionEnter(col); if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, col); } } private void OnTriggerEnter(Collider other) { if ((Object)(object)Body != (Object)null && (Object)(object)StrikeCollider != (Object)null) { Body.TryStrikeFromHead(StrikeCollider, other); } } } } public class FlyingHotdog : MonoBehaviour { public enum FlapAxis { X, Y, Z } [Tooltip("Seconds to wait before the hotdog starts flying.")] public float waitTime = 2f; [Header("Speed Settings")] [Tooltip("Minimum speed the hotdog can fly.")] public float minFlySpeed = 3f; [Tooltip("Maximum speed the hotdog can fly.")] public float maxFlySpeed = 7f; [Tooltip("How often the hotdog changes direction (seconds).")] public float directionChangeInterval = 1f; [Tooltip("How much the hotdog can move up or down per direction change.")] public float verticalVariance = 2f; [Tooltip("How quickly the hotdog turns toward its new direction. Higher = snappier.")] public float turnSpeed = 1.2f; [Header("Flock Settings")] [Tooltip("Prefab of the hotdog to spawn.")] public GameObject hotdogPrefab; [Tooltip("Minimum number of hotdogs in a flock.")] public int minFlockSize = 3; [Tooltip("Maximum number of hotdogs in a flock.")] public int maxFlockSize = 8; [Tooltip("Spawn radius for flock members.")] public float flockRadius = 2f; [Tooltip("Minimum flying height (Y axis).")] public float minFlyHeight = 15f; [Tooltip("Maximum flying height (Y axis).")] public float maxFlyHeight = 25f; [Tooltip("If true, this object is a flock spawner.")] public bool isSpawner = true; [Tooltip("Delay before spawning the rest of the flock (seconds).")] public float flockSpawnDelay = 1f; [Header("Wing Flapping")] [Tooltip("Left wing mesh transform.")] public Transform leftWing; [Tooltip("Right wing mesh transform.")] public Transform rightWing; [Tooltip("Axis to rotate wings around.")] public FlapAxis flapAxis = FlapAxis.Z; [Tooltip("Maximum angle (degrees) for wing flap (from center to top/bottom).")] public float flapAngle = 45f; [Tooltip("Flap speed in cycles per second.")] public float flapSpeed = 2f; private float wingFlapTime = 0f; private Quaternion leftWingBaseRot; private Quaternion rightWingBaseRot; private Rigidbody rb; private Vector3 flyDirection; private Vector3 targetDirection; private float currentFlySpeed; private float velocityLerp = 0f; private float targetFlyHeight; private bool isFlying = false; private void Start() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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) rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).gameObject.AddComponent<Rigidbody>(); } rb.useGravity = false; rb.isKinematic = true; rb.collisionDetectionMode = (CollisionDetectionMode)2; rb.interpolation = (RigidbodyInterpolation)1; rb.WakeUp(); if ((Object)(object)leftWing != (Object)null) { leftWingBaseRot = leftWing.localRotation; } if ((Object)(object)rightWing != (Object)null) { rightWingBaseRot = rightWing.localRotation; } if (isSpawner && (Object)(object)hotdogPrefab != (Object)null) { ((MonoBehaviour)this).StartCoroutine(SpawnFlockWithDelay()); return; } currentFlySpeed = minFlySpeed; if (Mathf.Approximately(targetFlyHeight, 0f)) { targetFlyHeight = GetCeilingHeight(((Component)this).transform.position, minFlyHeight, maxFlyHeight); } SetInitialDirection(); flyDirection = targetDirection; ((MonoBehaviour)this).StartCoroutine(FlyRoutine()); } private void Update() { AnimateWings(); } private void AnimateWings() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00c5: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)leftWing == (Object)null) || !((Object)(object)rightWing == (Object)null)) { wingFlapTime += Time.deltaTime * flapSpeed * 2f * (float)Math.PI; float num = Mathf.Sin(wingFlapTime) * flapAngle; Vector3 val = Vector3.forward; switch (flapAxis) { case FlapAxis.X: val = Vector3.right; break; case FlapAxis.Y: val = Vector3.up; break; case FlapAxis.Z: val = Vector3.forward; break; } if ((Object)(object)leftWing != (Object)null) { leftWing.localRotation = leftWingBaseRot * Quaternion.AngleAxis(num, val); } if ((Object)(object)rightWing != (Object)null) { rightWing.localRotation = rightWingBaseRot * Quaternion.AngleAxis(0f - num, val); } } } private IEnumerator SpawnFlockWithDelay() { yield return (object)new WaitForSeconds(flockSpawnDelay); int flockCount = Random.Range(minFlockSize, maxFlockSize + 1); for (int i = 0; i < flockCount; i++) { Vector3 val = Random.insideUnitSphere * flockRadius; Vector3 val2 = ((Component)this).transform.position + val; GameObject val3 = Object.Instantiate<GameObject>(hotdogPrefab, val2, Quaternion.identity); val3.SetActive(true); FlyingHotdog component = val3.GetComponent<FlyingHotdog>(); if ((Object)(object)component != (Object)null) { component.isSpawner = false; component.targetFlyHeight = GetCeilingHeight(val2, minFlyHeight, maxFlyHeight); } } Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator FlyRoutine() { yield return (object)new WaitForSeconds(waitTime); while (Mathf.Abs(((Component)this).transform.position.y - targetFlyHeight) > 0.1f) { yield return (object)new WaitForFixedUpdate(); float dt = Time.fixedDeltaTime; Vector3 pos = ((Component)this).transform.position; float ascendSpeed = Mathf.Lerp(minFlySpeed, maxFlySpeed, 0.5f); float nextY = Mathf.MoveTowards(pos.y, targetFlyHeight, ascendSpeed * dt); Vector3 nextPos = new Vector3(pos.x, nextY, pos.z); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } if ((Object)(object)rb != (Object)null) { rb.MovePosition(nextPos); } } isFlying = true; ((MonoBehaviour)this).StartCoroutine(FlockFlyRoutine()); } private IEnumerator FlockFlyRoutine() { if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } if ((Object)(object)rb == (Object)null) { yield break; } RaycastHit hit = default(RaycastHit); while (true) { SetTargetDirection(); float targetSpeed = Random.Range(minFlySpeed, maxFlySpeed); float timer = 0f; float dt; for (velocityLerp = 0f; timer < directionChangeInterval; timer += dt) { yield return (object)new WaitForFixedUpdate(); dt = Time.fixedDeltaTime; velocityLerp += dt / directionChangeInterval; currentFlySpeed = Mathf.Lerp(currentFlySpeed, targetSpeed, velocityLerp); FlyingHotdog flyingHotdog = this; Vector3 val = Vector3.Slerp(flyDirection, targetDirection, dt * turnSpeed); flyingHotdog.flyDirection = ((Vector3)(ref val)).normalized; Vector3 move = flyDirection * currentFlySpeed * dt; Vector3 nextPos = ((Component)this).transform.position + move; nextPos.y = Mathf.Clamp(nextPos.y, minFlyHeight, maxFlyHeight); if (Physics.Raycast(((Component)this).transform.position, flyDirection, ref hit, ((Vector3)(ref move)).magnitude + 0.5f)) { Vector3 val2 = Vector3.Reflect(flyDirection, ((RaycastHit)(ref hit)).normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Random.Range(-45f, 45f); Quaternion val3 = Quaternion.AngleAxis(num, ((RaycastHit)(ref hit)).normal); FlyingHotdog flyingHotdog2 = this; Vector3 val4 = val3 * normalized; flyingHotdog2.flyDirection = ((Vector3)(ref val4)).normalized; targetDirection = flyDirection; } if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } if ((Object)(object)rb != (Object)null) { rb.MovePosition(nextPos); } } } } private void SetInitialDirection() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0018: 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) Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * 0.5f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.y); targetDirection = ((Vector3)(ref val2)).normalized; } private void SetTargetDirection() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; float num = Random.Range(0f - verticalVariance, verticalVariance); float num2 = Mathf.Clamp(((Component)this).transform.position.y + num, minFlyHeight, maxFlyHeight) - ((Component)this).transform.position.y; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(normalized.x, num2, normalized.y); targetDirection = ((Vector3)(ref val)).normalized; } private float GetCeilingHeight(Vector3 pos, float min, float max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(pos + Vector3.up * 2f, Vector3.up, ref val, max - min + 2f)) { return Mathf.Clamp(((RaycastHit)(ref val)).point.y - 1f, min, max); } return Random.Range(min, max); } } [ExecuteInEditMode] public class HolographicSight : MonoBehaviour { public Transform VirtualQuad; public float Scale = 1f; public bool SizeCompensation = true; private MaterialPropertyBlock m_block; private void OnEnable() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown m_block = new MaterialPropertyBlock(); ((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block); } private void OnWillRenderObject() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position); m_block.SetVector("_Offset", Vector4.op_Implicit(val)); m_block.SetFloat("_Scale", Scale); m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f); ((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block); } } public class ClosedBoltMagRelease : FVRInteractiveObject { public ClosedBoltWeapon Weapon; protected void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void SimpleInteraction(FVRViveHand hand) { if ((Object)(object)Weapon != (Object)null && ((Object)(object)((FVRInteractiveObject)Weapon).m_hand == (Object)null || (Object)(object)hand != (Object)(object)((FVRInteractiveObject)Weapon).m_hand)) { ((FVRFireArm)Weapon).EjectMag(false); } ((FVRInteractiveObject)this).SimpleInteraction(hand); } } namespace VolksScripts { public class GiantSlingshot : FVRFireArm { [Header("Slingshot")] public Transform Basket; public Transform String_Left; public Transform String_Right; public Transform Centroid; public Transform String_LeftTarget; public Transform String_RightTarget; public GameObject ColGO_Upper; public GameObject ColGO_Basket; public Collider Col_Basket; [Header("Controls")] [Tooltip("Interactive controls (levers, handles, etc.) for the slingshot. Assign in Inspector.")] public List<GameObject> Controls; [Header("Mounting")] public Collider Col; public LayerMask LM_CTest; public float MountRaycastDistance = 0.2f; [Header("Audio")] public AudioEvent AudEvent_Mount; public AudioEvent AudEvent_Fire; [Header("Slingshot Settings")] public float maxSlingVel = 20f; public float maxSlingDistance = 0.5f; private FVRPhysicalObject m_slungObject; private Vector3 m_basketLocalOffset = Vector3.zero; private bool isSlungObjectBeingSlinged; private Vector3 m_basketWorldVel = Vector3.zero; public bool m_isCol; private float m_colChange; private RaycastHit m_hit; private Vector3 m_initHandPointAdjust_Horizontal = Vector3.zero; private Vector3 m_initHandPointAdjust_Vertical = Vector3.zero; public bool IsMounted => m_isCol; public void BeginHandAdjust(Vector3 v, bool isHorizontal) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (isHorizontal) { m_initHandPointAdjust_Horizontal = v; } else { m_initHandPointAdjust_Vertical = v; } } public void UpdateHandAdjust(Vector3 v, bool isHorizontal) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_004b: 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) //IL_0053: 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_0062: 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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0070: 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_007b: 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_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_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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!((FVRInteractiveObject)this).IsHeld) { Vector3 val = ((!isHorizontal) ? m_initHandPointAdjust_Vertical : m_initHandPointAdjust_Horizontal); if (isHorizontal) { Vector3 val2 = Vector3.ProjectOnPlane(val - ((Component)this).transform.position, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(v - ((Component)this).transform.position, Vector3.up); Vector3 val4 = val2; float num = Mathf.Atan2(Vector3.Dot(Vector3.up, Vector3.Cross(val4, val3)), Vector3.Dot(val4, val3)) * 57.29578f; Vector3 forward = ((Component)this).transform.forward; forward = Quaternion.AngleAxis(num, Vector3.up) * forward; ((FVRPhysicalObject)this).PivotLockRot = Quaternion.LookRotation(forward, Vector3.up); ((Component)this).transform.rotation = ((FVRPhysicalObject)this).PivotLockRot; m_initHandPointAdjust_Horizontal = v; } else { Vector3 val5 = Vector3.ProjectOnPlane(val - ((Component)this).transform.position, ((Component)this).transform.right); Vector3 val6 = Vector3.ProjectOnPlane(v - ((Component)this).transform.position, ((Component)this).transform.right); Vector3 val7 = val5; float num2 = Mathf.Atan2(Vector3.Dot(((Component)this).transform.right, Vector3.Cross(val7, val6)), Vector3.Dot(val7, val6)) * 57.29578f; Vector3 forward2 = ((Component)this).transform.forward; forward2 = Quaternion.AngleAxis(num2, ((Component)this).transform.right) * forward2; ((FVRPhysicalObject)this).PivotLockRot = Quaternion.LookRotation(forward2, Vector3.up); ((Component)this).transform.rotation = ((FVRPhysicalObject)this).PivotLockRot; m_initHandPointAdjust_Vertical = v; } } } public override void OnCollisionEnter(Collision collision) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).OnCollisionEnter(collision); if ((Object)(object)m_slungObject != (Object)null) { return; } if ((Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col_Basket && (Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody != (Object)null && (Object)(object)((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>() != (Object)null) { FVRPhysicalObject component = ((Component)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody).gameObject.GetComponent<FVRPhysicalObject>(); Vector3 val = Basket.InverseTransformPoint(((Component)component).transform.position); if (((FVRInteractiveObject)component).IsHeld && !component.RootRigidbody.isKinematic) { if (!(val.z > 0f)) { Vector3 relativeVelocity = collision.relativeVelocity; if (!(Vector3.Angle(((Vector3)(ref relativeVelocity)).normalized, -((Component)this).transform.forward) < 45f)) { goto IL_0173; } } m_slungObject = component; m_basketLocalOffset = ((Component)component).transform.InverseTransformPoint(Basket.position); ColGO_Upper.SetActive(false); ColGO_Basket.SetActive(false); SM.PlayCoreSound((FVRPooledAudioType)0, AudEvent_Mount, Basket.position); } } goto IL_0173; IL_0173: if (CanMakeColChange() && !m_isCol && ((FVRInteractiveObject)this).IsHeld) { Vector3 relativeVelocity2 = collision.relativeVelocity; if (((Vector3)(ref relativeVelocity2)).magnitude > 1f && (Object)(object)((ContactPoint)(ref collision.contacts[0])).thisCollider == (Object)(object)Col && ((Object)(object)((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody == (Object)null || ((ContactPoint)(ref collision.contacts[0])).otherCollider.attachedRigidbody.isKinematic)) { ColOn(); } } } public override void FVRFixedUpdate() { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_slungObject != (Object)null && ((Object)(object)m_slungObject.RootRigidbody == (Object)null || !((Component)m_slungObject).gameObject.activeSelf || (Object)(object)m_slungObject.QuickbeltSlot != (Object)null)) { m_slungObject = null; } if ((Object)(object)m_slungObject == (Object)null) { isSlungObjectBeingSlinged = false; } else if (!isSlungObjectBeingSlinged) { if (((FVRInteractiveObject)m_slungObject).IsHeld) { Vector3 position = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset); Basket.position = position; Vector3 val = Centroid.position - Basket.position; if (((Vector3)(ref val)).magnitude > 0.001f) { Basket.rotation = Quaternion.LookRotation(val, ((Component)this).transform.up); } SyncBasketCollider(); } else { isSlungObjectBeingSlinged = true; Vector3 val2 = Centroid.position - Basket.position; float magnitude = ((Vector3)(ref val2)).magnitude; float num = Mathf.Clamp(magnitude / maxSlingDistance, 0f, 1f); float num2 = Mathf.Lerp(0.1f, maxSlingVel, num); m_slungObject.RootRigidbody.velocity = ((Vector3)(ref val2)).normalized * num2; m_slungObject.RootRigidbody.angularVelocity = Vector3.zero; float num3 = 0.1f + 0.3f * num; float num4 = Random.Range(0.7f, 0.75f) + num * 0.4f; SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, AudEvent_Fire, Basket.position, new Vector2(num3, num3), new Vector2(num4, num4)); m_basketWorldVel = Vector3.zero; } } else { Centroid.rotation = Quaternion.LookRotation(m_slungObject.RootRigidbody.velocity); if (Centroid.InverseTransformPoint(((Component)m_slungObject).transform.position).z >= 0.3f) { isSlungObjectBeingSlinged = false; m_slungObject = null; ColGO_Upper.SetActive(true); ColGO_Basket.SetActive(true); Basket.position = Centroid.position; Basket.rotation = Quaternion.LookRotation(((Component)this).transform.forward, ((Component)this).transform.up); SyncBasketCollider(); } else { Vector3 position2 = ((Component)m_slungObject).transform.TransformPoint(m_basketLocalOffset); Basket.position = position2; Transform basket = Basket; Vector3 velocity = m_slungObject.RootRigidbody.velocity; basket.rotation = Quaternion.LookRotation(((Vector3)(ref velocity)).normalized, ((Component)this).transform.up); SyncBasketCollider(); } } UpdateStrings(); if (m_colChange > 0f) { m_colChange -= Time.deltaTime; } ((FVRFireArm)this).FVRFixedUpdate(); } public override void UpdateInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).UpdateInteraction(hand); if ((hand.Input.VelLinearWorld.y > 0.5f || hand.Input.TriggerPressed) && m_isCol && CanMakeColChange()) { ColOff(); } } private void UpdateStrings() { //IL_0067: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)String_Left == (Object)null) && !((Object)(object)String_Right == (Object)null) && !((Object)(object)String_LeftTarget == (Object)null) && !((Object)(object)String_RightTarget == (Object)null) && !((Object)(object)Basket == (Object)null)) { String_Left.position = String_LeftTarget.position; String_Right.position = String_RightTarget.position; Vector3 val = Basket.position - String_Left.position; Vector3 val2 = Basket.position - String_Right.position; float magnitude = ((Vector3)(ref val)).magnitude; float magnitude2 = ((Vector3)(ref val2)).magnitude; if (magnitude > 0.001f) { String_Left.rotation = Quaternion.LookRotation(((Vector3)(ref val)).normalized, ((Component)this).transform.up); } if (magnitude2 > 0.001f) { String_Right.rotation = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, ((Component)this).transform.up); } String_Left.localScale = new Vector3(1f, 1f, Mathf.Max(0.01f, magnitude)); String_Right.localScale = new Vector3(1f, 1f, Mathf.Max(0.01f, magnitude2)); } } private void SyncBasketCollider() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Col_Basket != (Object)null) { ((Component)Col_Basket).transform.position = Basket.position; ((Component)Col_Basket).transform.rotation = Basket.rotation; } } private bool CanMakeColChange() { return m_colChange <= 0f; } private void ColOn() { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //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_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_005b: 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) //IL_007c: 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_008b: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; if (Vector3.Angle(Vector3.up, ((Component)this).transform.forward) > 80f || !Physics.Raycast(((Component)this).transform.position, Vector3.down, ref m_hit, MountRaycastDistance, LayerMask.op_Implicit(LM_CTest), (QueryTriggerInteraction)1)) { return; } position = ((RaycastHit)(ref m_hit)).point + Vector3.up * 0.022f; rotation = Quaternion.LookRotation(((HandInput)(ref ((FVRInteractiveObject)this).m_hand.Input)).Pos - position, Vector3.up); m_isCol = true; Col.enabled = false; m_colChange = 1f; ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).IsPivotLocked = true; ((FVRPhysicalObject)this).PivotLockPos = position; ((FVRPhysicalObject)this).PivotLockRot = ((Component)this).transform.rotation; if (Controls != null) { for (int i = 0; i < Controls.Count; i++) { if ((Object)(object)Controls[i] != (Object)null) { Controls[i].SetActive(true); } } } SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)2, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f); } private void ColOff() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) if (!m_isCol) { return; } m_isCol = false; m_colChange = 1f; Col.enabled = true; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; ((FVRPhysicalObject)this).IsPivotLocked = false; if (Controls != null) { for (int i = 0; i < Controls.Count; i++) { if ((Object)(object)Controls[i] != (Object)null) { Controls[i].SetActive(false); } } } SM.PlayImpactSound((ImpactType)160, (MatSoundType)3, (AudioImpactIntensity)1, ((Component)this).transform.position, (FVRPooledAudioType)41, 10f); } } public clas