Decompiled source of Grenade Pin Bite v1.0.0
Grenade_Pin_Bite.dll
Decompiled 8 months agousing System; using System.Collections; using System.Collections.Generic; 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 FistVR; using ProBuilder2.Common; using ProBuilder2.MeshOperations; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [RequireComponent(typeof(ParticleSystem))] public class CFX_AutoDestructShuriken : MonoBehaviour { public bool OnlyDeactivate; private void OnEnable() { ((MonoBehaviour)this).StartCoroutine("CheckIfAlive"); } private IEnumerator CheckIfAlive() { do { yield return (object)new WaitForSeconds(0.5f); } while (((Component)this).GetComponent<ParticleSystem>().IsAlive(true)); if (OnlyDeactivate) { ((Component)this).gameObject.SetActive(false); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } [RequireComponent(typeof(Light))] public class CFX_LightIntensityFade : MonoBehaviour { public float duration = 1f; public float delay = 0f; public float finalIntensity = 0f; private float baseIntensity; public bool autodestruct; private float p_lifetime = 0f; private float p_delay; private void Start() { baseIntensity = ((Component)this).GetComponent<Light>().intensity; } private void OnEnable() { p_lifetime = 0f; p_delay = delay; if (delay > 0f) { ((Behaviour)((Component)this).GetComponent<Light>()).enabled = false; } } private void Update() { if (p_delay > 0f) { p_delay -= Time.deltaTime; if (p_delay <= 0f) { ((Behaviour)((Component)this).GetComponent<Light>()).enabled = true; } } else if (p_lifetime / duration < 1f) { ((Component)this).GetComponent<Light>().intensity = Mathf.Lerp(baseIntensity, finalIntensity, p_lifetime / duration); p_lifetime += Time.deltaTime; } else if (autodestruct) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } [RequireComponent(typeof(MeshFilter))] public class WFX_BulletHoleDecal : MonoBehaviour { private static Vector2[] quadUVs = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(1f, 0f), new Vector2(1f, 1f) }; public float lifetime = 10f; public float fadeoutpercent = 80f; public Vector2 frames; public bool randomRotation = false; public bool deactivate = false; private float life; private float fadeout; private Color color; private float orgAlpha; private void Awake() { //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) color = ((Component)this).GetComponent<Renderer>().material.GetColor("_TintColor"); orgAlpha = color.a; } private void OnEnable() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, (int)(frames.x * frames.y)); int num2 = (int)((float)num % frames.x); int num3 = (int)((float)num / frames.y); Vector2[] array = (Vector2[])(object)new Vector2[4]; for (int i = 0; i < 4; i++) { array[i].x = (quadUVs[i].x + (float)num2) * (1f / frames.x); array[i].y = (quadUVs[i].y + (float)num3) * (1f / frames.y); } ((Component)this).GetComponent<MeshFilter>().mesh.uv = array; if (randomRotation) { ((Component)this).transform.Rotate(0f, 0f, Random.Range(0f, 360f), (Space)1); } life = lifetime; fadeout = life * (fadeoutpercent / 100f); color.a = orgAlpha; ((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color); ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine("holeUpdate"); } private IEnumerator holeUpdate() { while (life > 0f) { life -= Time.deltaTime; if (life <= fadeout) { color.a = Mathf.Lerp(0f, orgAlpha, life / fadeout); ((Component)this).GetComponent<Renderer>().material.SetColor("_TintColor", color); } yield return null; } } } [RequireComponent(typeof(Light))] public class WFX_LightFlicker : MonoBehaviour { public float time = 0.05f; private float timer; private void Start() { timer = time; ((MonoBehaviour)this).StartCoroutine("Flicker"); } private IEnumerator Flicker() { while (true) { ((Behaviour)((Component)this).GetComponent<Light>()).enabled = !((Behaviour)((Component)this).GetComponent<Light>()).enabled; do { timer -= Time.deltaTime; yield return null; } while (timer > 0f); timer = time; } } } [BepInPlugin("Okkim.Grenade_Pin_Bite", "Grenade_Pin_Bite", "1.0.0")] [BepInProcess("h3vr.exe")] public class Grenade_Pin_BitePlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); private void Awake() { LoadAssets(); } private void LoadAssets() { } } public class FollowTargetDebug : MonoBehaviour { public bool check; private void OnLevelWasLoaded() { Debug.Log((object)("OnLevelWasLoaded, player head exists: " + GM.CurrentPlayerBody != null)); } private void Awake() { Debug.Log((object)"OnAwake, player head exists: "); } private void Start() { Debug.Log((object)"Start, player head exists: "); } private void Update() { if (!check) { Debug.Log((object)"Update, player head exists: "); } check = true; } } public class ExtrudeRandomEdges : MonoBehaviour { private pb_Object pb; private pb_Face lastExtrudedFace = null; public float distance = 1f; private void Start() { pb = pb_ShapeGenerator.PlaneGenerator(1f, 1f, 0, 0, (Axis)2, false); pb.SetFaceMaterial(pb.faces, pb_Constant.DefaultMaterial); lastExtrudedFace = pb.faces[0]; } private void OnGUI() { if (GUILayout.Button("Extrude Random Edge", (GUILayoutOption[])(object)new GUILayoutOption[0])) { ExtrudeEdge(); } } private void ExtrudeEdge() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00d0: 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_00df: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) pb_Face sourceFace = lastExtrudedFace; List<pb_WingedEdge> wingedEdges = pb_WingedEdge.GetWingedEdges(pb, false); IEnumerable<pb_WingedEdge> source = wingedEdges.Where((pb_WingedEdge x) => x.face == sourceFace); List<pb_Edge> list = (from x in source where x.opposite == null select x into y select y.edge.local).ToList(); int index = Random.Range(0, list.Count); pb_Edge val = list[index]; Vector3 val2 = (pb.vertices[val.x] + pb.vertices[val.y]) * 0.5f - pb_Math.Average<int>((IList<int>)sourceFace.distinctIndices, (Func<int, Vector3>)((int x) => pb.vertices[x]), (IList<int>)null); ((Vector3)(ref val2)).Normalize(); pb_Edge[] selectedEdges = default(pb_Edge[]); pbMeshOps.Extrude(pb, (pb_Edge[])(object)new pb_Edge[1] { val }, 0f, false, true, ref selectedEdges); lastExtrudedFace = pb.faces.Last(); pb.SetSelectedEdges((IEnumerable<pb_Edge>)selectedEdges); pb_Object_Utility.TranslateVertices(pb, pb.SelectedTriangles, val2 * distance); pb.ToMesh(); pb.Refresh((RefreshMask)255); } } public class HighlightNearestFace : MonoBehaviour { public float travel = 50f; public float speed = 0.2f; private pb_Object target; private pb_Face nearest = null; private void Start() { //IL_0061: 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_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) target = pb_ShapeGenerator.PlaneGenerator(travel, travel, 25, 25, (Axis)2, false); target.SetFaceMaterial(target.faces, pb_Constant.DefaultMaterial); ((Component)target).transform.position = new Vector3(travel * 0.5f, 0f, travel * 0.5f); target.ToMesh(); target.Refresh((RefreshMask)255); Camera main = Camera.main; ((Component)main).transform.position = new Vector3(25f, 40f, 0f); ((Component)main).transform.localRotation = Quaternion.Euler(new Vector3(65f, 0f, 0f)); } private void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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) //IL_008a: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) float num = Time.time * speed; Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(Mathf.PerlinNoise(num, num) * travel, 2f, Mathf.PerlinNoise(num + 1f, num + 1f) * travel); ((Component)this).transform.position = position; if ((Object)(object)target == (Object)null) { Debug.LogWarning((object)"Missing the ProBuilder Mesh target!"); return; } Vector3 val = ((Component)target).transform.InverseTransformPoint(((Component)this).transform.position); if (nearest != null) { target.SetFaceColor(nearest, Color.white); } int num2 = target.faces.Length; float num3 = float.PositiveInfinity; nearest = target.faces[0]; for (int i = 0; i < num2; i++) { float num4 = Vector3.Distance(val, FaceCenter(target, target.faces[i])); if (num4 < num3) { num3 = num4; nearest = target.faces[i]; } } target.SetFaceColor(nearest, Color.blue); target.RefreshColors(); } private Vector3 FaceCenter(pb_Object pb, pb_Face face) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c6: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = pb.vertices; Vector3 zero = Vector3.zero; int[] distinctIndices = face.distinctIndices; foreach (int num in distinctIndices) { zero.x += vertices[num].x; zero.y += vertices[num].y; zero.z += vertices[num].z; } float num2 = face.distinctIndices.Length; zero.x /= num2; zero.y /= num2; zero.z /= num2; return zero; } }
GrenadePinBite.dll
Decompiled 8 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using FistVR; using Microsoft.CodeAnalysis; using On.FistVR; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("GrenadePinBite")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GrenadePinBite")] [assembly: AssemblyTitle("GrenadePinBite")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace GrenadePinBite { [BepInPlugin("okkim.grenadepinbite", "Grenade Pin Bite", "1.0.0")] [BepInProcess("h3vr.exe")] public class GrenadePinBite : BaseUnityPlugin { private const string ASSET_BUNDLE_NAME = "grenadepinbite"; private GameObject toothPrefab; private AudioEvent AudEvent_Spit = new AudioEvent(); public static ConfigEntry<float> biteRadius; public static ConfigEntry<float> biteRadiusHeightOffset; public static ConfigEntry<float> forceRequiredForPull; public static ConfigEntry<float> pinPullToothChance; private GameObject? loosePinInMouth; private Vector3 leftPrevFramePinPos; private Vector3 rightPrevFramePinPos; private float leftPrevFramePinMouthDistance; private float rightPrevFramePinMouthDistance; public GrenadePinBite() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00b7: 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) PinnedGrenade.UpdateInteraction += new hook_UpdateInteraction(PinnedGrenade_UpdateInteraction); SosigWeaponPlayerInterface.UpdateInteraction += new hook_UpdateInteraction(SosigWeaponPlayerInterface_UpdateInteraction); GM.InitScene += new hook_InitScene(GM_InitScene); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "grenadepinbite")); toothPrefab = val.LoadAsset<GameObject>("ToothPrefab"); for (int i = 1; i <= 6; i++) { AudEvent_Spit.Clips.Add(val.LoadAsset<AudioClip>($"sfx_Paper_Blow_0{i}")); } AudEvent_Spit.VolumeRange = new Vector2(0.3f, 0.3f); biteRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Pin Bite Settings", "Bite Radius", 0.15f, "How close to your mouth the pin needs to be to be considered bitten"); biteRadiusHeightOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Pin Bite Settings", "Bite Radius Height Offset", -0.1f, "How far down from your eye level the \"bite zone\" will be"); forceRequiredForPull = ((BaseUnityPlugin)this).Config.Bind<float>("Pin Bite Settings", "Force Required For Pull", 1.1f, "How fast the grenade needs to be moved from the mouth for its pin to be considered bitten"); pinPullToothChance = ((BaseUnityPlugin)this).Config.Bind<float>("Pin Bite Settings", "Pin Pull Accident Probability (1 is 100%)", 0.02f, "After all, those pins are held in there awfully tight..."); } private void PinnedGrenade_UpdateInteraction(orig_UpdateInteraction orig, PinnedGrenade self, FVRViveHand hand) { //IL_005d: 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_0080: 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) //IL_0089: 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) orig.Invoke(self, hand); PinnedGrenadeRing val = null; for (int i = 0; i < self.m_rings.Count; i++) { if (!self.m_rings[i].HasPinDetached()) { val = self.m_rings[i]; break; } } if (!((Object)(object)val != (Object)null)) { return; } Vector3 mouthPos = ((Component)GM.CurrentPlayerBody.Head).transform.position + ((Component)GM.CurrentPlayerBody.Head).transform.up * -0.1f; if (TryPullPin(hand, (FVRInteractiveObject)(object)val, mouthPos) && !val.HasPinDetached() && (Object)(object)loosePinInMouth == (Object)null && hand.Input.TriggerFloat > 0.6f) { hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); BiteOutPin(val); ((MonoBehaviour)this).Invoke("SpitOutPin", 0.5f); if (pinPullToothChance.Value > 0f && Random.Range(0f, 1f) <= pinPullToothChance.Value) { SpitOutTooth(mouthPos); } } } private void BiteOutPin(PinnedGrenadeRing _ring) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (_ring.m_hasPinDetached) { Debug.LogError((object)"Tried to pull an already pulled pin!"); return; } loosePinInMouth = ((FVRInteractiveObject)_ring.Pin).GameObject; _ring.m_hasPinDetached = true; _ring.Pin.RootRigidbody = ((Component)_ring.Pin).gameObject.GetComponent<Rigidbody>(); if ((Object)(object)_ring.Pin.RootRigidbody == (Object)null) { _ring.Pin.RootRigidbody = ((Component)_ring.Pin).gameObject.AddComponent<Rigidbody>(); } _ring.Pin.RootRigidbody.mass = 0.02f; _ring.Pin.RootRigidbody.isKinematic = true; ((Component)_ring).transform.SetParent(((Component)_ring.Pin).transform); ((Component)_ring.Pin).transform.SetParent(GM.CurrentPlayerBody.Head); ((Behaviour)_ring.Pin).enabled = true; SM.PlayCoreSound((FVRPooledAudioType)10, _ring.G.AudEvent_Pinpull, ((Component)_ring.G).transform.position); ((Component)_ring).GetComponent<Collider>().enabled = false; ((Behaviour)_ring).enabled = false; } private void SpitOutPin() { //IL_0050: 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_006e: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)loosePinInMouth != (Object)null) { loosePinInMouth.transform.SetParent((Transform)null); Rigidbody component = loosePinInMouth.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.isKinematic = false; Vector3 val = ((Component)GM.CurrentPlayerBody.Head).transform.position + ((Component)GM.CurrentPlayerBody.Head).transform.up * -0.1f; SM.PlayGenericSound(AudEvent_Spit, val); component.velocity = GM.CurrentPlayerBody.Head.forward * Random.Range(1f, 2f) + Random.onUnitSphere; component.angularVelocity = Random.onUnitSphere * Random.Range(1f, 5f); } loosePinInMouth = null; } } private void SosigWeaponPlayerInterface_UpdateInteraction(orig_UpdateInteraction orig, SosigWeaponPlayerInterface self, FVRViveHand hand) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0053: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, hand); if ((int)self.W.Type != 2) { return; } SosigGrenadePin val = null; if ((Object)(object)self.W.Pin != (Object)null) { val = self.W.Pin; } if (!((Object)(object)val != (Object)null)) { return; } Vector3 mouthPos = ((Component)GM.CurrentPlayerBody.Head).transform.position + ((Component)GM.CurrentPlayerBody.Head).transform.up * -0.2f; if (TryPullPin(hand, (FVRInteractiveObject)(object)val, mouthPos) && !val.hasSpawned && (Object)(object)loosePinInMouth == (Object)null && hand.Input.TriggerFloat > 0.6f) { hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); val.Grenade.FuseGrenade(); val.PopSpoon(); BiteOutSosigPin(val); ((MonoBehaviour)this).Invoke("SpitOutSosigPin", 0.5f); if (pinPullToothChance.Value > 0f && Random.Range(0f, 1f) <= pinPullToothChance.Value) { SpitOutTooth(mouthPos); } } } private void BiteOutSosigPin(SosigGrenadePin _pin) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (_pin.hasSpawned) { Debug.LogError((object)"Tried to pull an already pulled sosig grenade pin!"); return; } _pin.hasSpawned = true; if ((Object)(object)_pin.EnableOnPinPull != (Object)null) { _pin.EnableOnPinPull.SetActive(true); } if ((Object)(object)_pin.DisableOnPinPull != (Object)null) { _pin.DisableOnPinPull.SetActive(false); } if ((Object)(object)_pin.PinRend != (Object)null) { _pin.PinRend.enabled = false; } GameObject val = Object.Instantiate<GameObject>(_pin.PinDiscardGO, ((Component)_pin).transform.position, ((Component)_pin).transform.rotation); Rigidbody val2 = val.gameObject.GetComponent<Rigidbody>(); if ((Object)(object)val2 == (Object)null) { Debug.Log((object)"Added rigidbody to sosig grenade pin"); val2 = ((Component)_pin).gameObject.AddComponent<Rigidbody>(); } val2.mass = 0.02f; val2.isKinematic = true; loosePinInMouth = val; ((Component)_pin).transform.SetParent(GM.CurrentPlayerBody.Head); ((Behaviour)_pin).enabled = false; } private void SpitOutSosigPin() { //IL_008a: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f3: 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 ((Object)(object)loosePinInMouth != (Object)null) { loosePinInMouth.transform.SetParent((Transform)null); Rigidbody component = loosePinInMouth.GetComponent<Rigidbody>(); Debug.Log((object)("isKinematic = " + component.isKinematic)); Debug.Log((object)("useGravity = " + component.useGravity)); if ((Object)(object)component != (Object)null) { component.isKinematic = false; Vector3 val = ((Component)GM.CurrentPlayerBody.Head).transform.position + ((Component)GM.CurrentPlayerBody.Head).transform.up * -0.1f; SM.PlayGenericSound(AudEvent_Spit, val); component.velocity = GM.CurrentPlayerBody.Head.forward * Random.Range(1f, 2f) + Random.onUnitSphere; component.angularVelocity = Random.onUnitSphere * Random.Range(1f, 5f); } loosePinInMouth = null; } } private bool TryPullPin(FVRViveHand _hand, FVRInteractiveObject _curPin, Vector3 _mouthPos) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_0099: 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_0050: 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) bool result = false; Vector3 val = (_hand.IsThisTheRightHand ? rightPrevFramePinPos : leftPrevFramePinPos); float num = Vector3.Distance(((Component)_curPin).transform.position, _mouthPos); if (num < biteRadius.Value) { float num2 = (_hand.IsThisTheRightHand ? rightPrevFramePinMouthDistance : leftPrevFramePinMouthDistance); if (val != Vector3.zero && Vector3.Distance(((Component)_curPin).transform.position, val) > forceRequiredForPull.Value * Time.deltaTime && num > num2) { result = true; } } if (_hand.IsThisTheRightHand) { rightPrevFramePinPos = ((Component)_curPin).transform.position; rightPrevFramePinMouthDistance = num; } else { leftPrevFramePinPos = ((Component)_curPin).transform.position; leftPrevFramePinMouthDistance = num; } return result; } private void SpitOutTooth(Vector3 _mouthPos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_005d: 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) Rigidbody component = Object.Instantiate<GameObject>(toothPrefab, _mouthPos, Random.rotation).GetComponent<Rigidbody>(); component.velocity = GM.CurrentPlayerBody.Head.forward * Random.Range(2f, 4f) + Random.onUnitSphere; component.angularVelocity = Random.onUnitSphere * Random.Range(1f, 5f); SM.PlayBulletImpactHit((BulletImpactSoundType)13, _mouthPos, 0.7f, 0.8f); } private void GM_InitScene(orig_InitScene orig, GM self) { //IL_000f: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); loosePinInMouth = null; leftPrevFramePinPos = Vector3.zero; leftPrevFramePinMouthDistance = 0f; rightPrevFramePinPos = Vector3.zero; rightPrevFramePinMouthDistance = 0f; } } internal static class PluginInfo { internal const string NAME = "Grenade Pin Bite"; internal const string GUID = "okkim.grenadepinbite"; internal const string VERSION = "1.0.0"; } }