Decompiled source of MrZippy v0.9.3
MrZippy.dll
Decompiled 2 hours 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.Configuration; using BepInEx.Logging; using FistVR; using HarmonyLib; using Sodalite.Api; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using quaternion.MrZippy.Core; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.9.3.0")] [module: UnverifiableCode] namespace quaternion.MrZippy.Core { public sealed class ArmMomentum { private bool initialized; private V3 previousLeft; private V3 previousRight; private V3 leftVelocity; private V3 rightVelocity; public void Reset() { initialized = false; leftVelocity = (rightVelocity = default(V3)); } public V3 Sample(V3 left, V3 right, float dt, float bodyMass, float armMass) { if (!left.Finite || !right.Finite || !V3.Valid(dt) || dt <= 0f || dt > 0.15f || !V3.Valid(bodyMass) || bodyMass <= 0f || !V3.Valid(armMass) || armMass < 0f) { Reset(); return default(V3); } if (!initialized) { previousLeft = left; previousRight = right; initialized = true; return default(V3); } V3 v = (left - previousLeft) / dt; V3 v2 = (right - previousRight) / dt; previousLeft = left; previousRight = right; if (v.Length > 8f || v2.Length > 8f) { Reset(); return default(V3); } float num = 1f - (float)Math.Exp((0f - dt) / 0.06f); V3 v3 = leftVelocity + (v - leftVelocity) * num; V3 v4 = rightVelocity + (v2 - rightVelocity) * num; V3 result = (v3 - leftVelocity + (v4 - rightVelocity)) * ((0f - armMass) / (bodyMass + 2f * armMass)); leftVelocity = v3; rightVelocity = v4; return result; } } public struct HandReelStep { public float Length; public float Speed; public float RemainingForce; } public static class HandReel { public static HandReelStep Step(float length, float target, float speed, float mass, float force, float maximumSpeed, float gravityToward, float dt) { HandReelStep result = new HandReelStep { Length = length, Speed = 0f, RemainingForce = ((!V3.Valid(force)) ? 0f : Math.Max(0f, force)) }; if (!V3.Valid(length) || !V3.Valid(target) || !V3.Valid(speed) || !V3.Valid(mass) || mass <= 0f || !V3.Valid(force) || force < 0f || !V3.Valid(maximumSpeed) || maximumSpeed < 0f || !V3.Valid(gravityToward) || !V3.Valid(dt) || dt <= 0f || dt > 0.15f) { return result; } float num = target - length; if (Math.Abs(num) < 1E-05f) { return result; } float num2 = ((!(num < 0f)) ? (force / mass) : Math.Max(0f, force / mass + gravityToward)); float num3 = (float)Math.Sign(num) * Math.Min(maximumSpeed, Math.Abs(num) / dt); float num4 = speed + Clamp(num3 - speed, (0f - num2) * dt, num2 * dt); float num5 = num4 * dt; if (Math.Sign(num5) != Math.Sign(num)) { num5 = 0f; } if (Math.Abs(num5) > Math.Abs(num)) { num5 = num; } result.Length = length + num5; result.Speed = ((!(Math.Abs(num5 - num) < 1E-06f)) ? (num5 / dt) : 0f); if (num5 < 0f) { float num6 = Math.Max(0f, (0f - (num5 / dt - speed)) / dt); float num7 = mass * Math.Max(0f, num6 - gravityToward); result.RemainingForce = Math.Max(0f, force - num7); } return result; } private static float Clamp(float value, float min, float max) { return Math.Max(min, Math.Min(max, value)); } } public struct RailStep { public V3 PlayerVelocity; public float Position; public float Speed; } public static class RailPhysics { public static RailStep Step(V3 player, V3 velocity, V3 direction, float railLength, float position, float speed, V3 gravity, float ropeLength, float playerMass, float carriageMass, float damping, float dt) { RailStep result = new RailStep { PlayerVelocity = velocity, Position = position, Speed = 0f }; float length = direction.Length; if (!player.Finite || !velocity.Finite || !direction.Finite || !gravity.Finite || length < 0.0001f || !V3.Valid(dt) || dt <= 0f || dt > 0.15f || !V3.Valid(railLength) || railLength <= 0f || !V3.Valid(position) || !V3.Valid(speed) || !V3.Valid(ropeLength) || ropeLength < 0.05f || !V3.Valid(playerMass) || playerMass <= 0f || !V3.Valid(carriageMass) || carriageMass <= 0f) { return result; } V3 v = direction / length; float num = 1f / playerMass; float num2 = 1f / carriageMass; float num3 = Math.Max(0f, Math.Min(railLength, position)); V3 v2 = v * V3.Dot(velocity, v); float num4 = ((!V3.Valid(damping) || !(damping > 0f)) ? 1f : ((float)Math.Exp((0f - damping) * dt))); V3 v3 = player + (v2 + (velocity - v2) * num4) * dt; float num5 = (speed + V3.Dot(gravity, v) * dt) * (float)Math.Exp(-0.025f * dt); float num6 = Math.Max(0f, Math.Min(railLength, num3 + num5 * dt)); for (int i = 0; i < 24; i++) { V3 v4 = v3 - v * num6; float length2 = v4.Length; if (length2 <= ropeLength + 1E-06f) { break; } V3 v5 = v4 / length2; float num7 = V3.Dot(v5, v); float num8 = num2; if ((num6 <= 1E-06f && num7 < 0f) || (num6 >= railLength - 1E-06f && num7 > 0f)) { num8 = 0f; } float num9 = (length2 - ropeLength) / (num + num8 * num7 * num7); v3 -= v5 * (num9 * num); num6 = Math.Max(0f, Math.Min(railLength, num6 + num9 * num7 * num8)); } result.PlayerVelocity = (v3 - player) / dt; result.Position = num6; result.Speed = (num6 - num3) / dt; if (Math.Abs(result.Speed) < 0.0001f && (num6 == 0f || num6 == railLength)) { result.Speed = num5; } return result; } } public enum BeltGesture { None, Detach, ToggleSlide, ToggleLock } public struct BeltPad { public float X; public float Y; public bool Clicked; public bool Held; public BeltPad(float x, float y, bool clicked, bool held) { X = x; Y = y; Clicked = clicked; Held = held; } } public sealed class BeltControls { private int channel; public bool HasLockOverride => channel != 0; public static bool ResolveLock(bool persistent, bool temporaryReverse) { return persistent != temporaryReverse; } public void Clear() { channel = 0; } public BeltGesture Update(bool active, BeltPad primary, BeltPad secondary) { if (!active) { Clear(); return BeltGesture.None; } if ((channel == 1 && !primary.Held) || (channel == 2 && !secondary.Held)) { Clear(); } int num = Direction(primary); int num2 = 1; if (num == 0) { num = Direction(secondary); num2 = 2; } switch (num) { case 1: Clear(); return BeltGesture.Detach; case 2: channel = (((num2 != 1) ? secondary.Held : primary.Held) ? num2 : 0); break; } return num switch { 3 => BeltGesture.ToggleSlide, 4 => BeltGesture.ToggleLock, _ => BeltGesture.None, }; } private static int Direction(BeltPad pad) { if (!pad.Clicked || float.IsNaN(pad.X) || float.IsNaN(pad.Y) || float.IsInfinity(pad.X) || float.IsInfinity(pad.Y)) { return 0; } if (Math.Abs(pad.Y) >= 0.5f && Math.Abs(pad.Y) >= Math.Abs(pad.X)) { return (pad.Y > 0f) ? 1 : 2; } if (Math.Abs(pad.X) >= 0.5f && Math.Abs(pad.X) > Math.Abs(pad.Y)) { return (!(pad.X > 0f)) ? 4 : 3; } return 0; } } public struct RopeDegree { public float Velocity; public float InverseMass; public RopeDegree(float velocity, float inverseMass) { Velocity = velocity; InverseMass = inverseMass; } } public sealed class RopeRow { public float[] Gradient; public float Error; public float KinematicRate; public RopeRow(int count) { Gradient = new float[count]; } } public static class RoutedConstraint { public static float[] Solve(RopeDegree[] bodies, RopeRow[] rows, float dt) { float[] array = new float[rows.Length]; if (!V3.Valid(dt) || dt <= 0f || dt > 0.15f) { return array; } int num = rows.Length; float[] array2 = new float[num * num]; float[] array3 = new float[num]; for (int i = 0; i < num; i++) { if (rows[i].Gradient.Length != bodies.Length || !V3.Valid(rows[i].Error) || !V3.Valid(rows[i].KinematicRate)) { return array; } array3[i] = rows[i].KinematicRate + rows[i].Error / dt; for (int j = 0; j < bodies.Length; j++) { if (!V3.Valid(bodies[j].Velocity) || !V3.Valid(bodies[j].InverseMass) || bodies[j].InverseMass < 0f || !V3.Valid(rows[i].Gradient[j])) { return array; } array3[i] += rows[i].Gradient[j] * bodies[j].Velocity; } } for (int k = 0; k < num; k++) { for (int l = 0; l < num; l++) { for (int m = 0; m < bodies.Length; m++) { array2[k * num + l] += rows[k].Gradient[m] * bodies[m].InverseMass * rows[l].Gradient[m]; } } } if (num == 1 && array2[0 * num] > 1E-09f) { array[0] = Math.Max(0f, array3[0] / array2[0 * num]); } else if (num == 2 && array2[0 * num] > 1E-09f && array2[num + 1] > 1E-09f) { float num2 = array2[0 * num] * array2[num + 1] - array2[0 * num + 1] * array2[num]; bool flag = false; if (num2 > array2[0 * num] * array2[num + 1] * 1E-06f) { float num3 = (array3[0] * array2[num + 1] - array3[1] * array2[0 * num + 1]) / num2; float num4 = (array3[1] * array2[0 * num] - array3[0] * array2[num]) / num2; if (num3 >= 0f && num4 >= 0f) { array[0] = num3; array[1] = num4; flag = true; } } if (!flag) { float num5 = Math.Max(0f, array3[0] / array2[0 * num]); float num6 = Math.Max(0f, array3[1] / array2[num + 1]); if (array3[1] - array2[num] * num5 <= 1E-05f) { array[0] = num5; flag = true; } else if (array3[0] - array2[0 * num + 1] * num6 <= 1E-05f) { array[1] = num6; flag = true; } } if (!flag) { Iterate(array2, array3, array); } } else { Iterate(array2, array3, array); } for (int n = 0; n < bodies.Length; n++) { float num7 = 0f; for (int num8 = 0; num8 < num; num8++) { num7 += rows[num8].Gradient[n] * array[num8]; } bodies[n].Velocity -= num7 * bodies[n].InverseMass; } return array; } private static void Iterate(float[] a, float[] b, float[] impulses) { int num = b.Length; for (int i = 0; i < 40; i++) { for (int j = 0; j < b.Length; j++) { if (!(a[j * num + j] <= 1E-09f)) { float num2 = b[j]; for (int k = 0; k < b.Length; k++) { num2 -= a[j * num + k] * impulses[k]; } impulses[j] = Math.Max(0f, impulses[j] + num2 / a[j * num + j]); } } } } } public struct V3 { public float X; public float Y; public float Z; public float Length => (float)Math.Sqrt(Dot(this, this)); public bool Finite => Valid(X) && Valid(Y) && Valid(Z); public V3(float x, float y, float z) { X = x; Y = y; Z = z; } public static bool Valid(float value) { return !float.IsNaN(value) && !float.IsInfinity(value); } public static float Dot(V3 a, V3 b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; } public static V3 operator +(V3 a, V3 b) { return new V3(a.X + b.X, a.Y + b.Y, a.Z + b.Z); } public static V3 operator -(V3 a, V3 b) { return new V3(a.X - b.X, a.Y - b.Y, a.Z - b.Z); } public static V3 operator *(V3 a, float scale) { return new V3(a.X * scale, a.Y * scale, a.Z * scale); } public static V3 operator /(V3 a, float scale) { return a * (1f / scale); } } public static class TetherMath { public const float MinimumLength = 0.05f; public const float LimitTolerance = 0.015f; public static bool CanAttach(float distance, float maximum) { return V3.Valid(distance) && V3.Valid(maximum) && distance >= 0.05f && distance <= maximum; } public static float AdjustLength(float length, float handDelta, float maximum) { return (!V3.Valid(handDelta) || !V3.Valid(maximum) || !(maximum >= 0.05f)) ? length : Math.Max(0.05f, Math.Min(maximum, length + handDelta)); } public static float ReelLength(float retained, float distance, float maximum, bool automatic) { if (!automatic || !V3.Valid(distance) || !V3.Valid(maximum) || maximum < 0.05f) { return retained; } return Math.Max(0.05f, Math.Min(maximum, distance)); } public static float TravelFraction(V3 offset, V3 delta, float maximum) { if (!offset.Finite || !delta.Finite || !V3.Valid(maximum) || maximum <= 0f) { return 0f; } if (offset.Length > maximum + 0.0001f) { return 0f; } if ((offset + delta).Length <= maximum) { return 1f; } float num = V3.Dot(delta, delta); if (num < 1E-08f) { return 0f; } float num2 = 2f * V3.Dot(offset, delta); float num3 = V3.Dot(offset, offset) - maximum * maximum; float val = num2 * num2 - 4f * num * num3; return Math.Max(0f, Math.Min(1f, (0f - num2 + (float)Math.Sqrt(Math.Max(0f, val))) / (2f * num))); } public static bool ClimbingBreakaway(float before, float after, float maximum, bool activeOutwardPull) { return activeOutwardPull && V3.Valid(before) && V3.Valid(after) && V3.Valid(maximum) && after > maximum + 0.015f && after > before + 0.001f; } public static V3 Constrain(V3 offset, V3 velocity, V3 anchorVelocity, float length, float damping, float dt) { if (!offset.Finite || !velocity.Finite || !anchorVelocity.Finite || !V3.Valid(length) || length < 0.05f || !V3.Valid(dt) || dt <= 0f) { return velocity; } V3 v = velocity - anchorVelocity; float length2 = offset.Length; if (length2 < length - 0.0001f && (offset + v * dt).Length <= length) { return velocity; } if (length2 > 1E-05f) { V3 v2 = offset / length2; float num = V3.Dot(v, v2); V3 v3 = v - v2 * num; if (V3.Valid(damping) && damping > 0f) { v3 *= (float)Math.Exp((0f - damping) * dt); } if (length2 >= length - 0.0001f && num > 0f) { num = 0f; } v = v3 + v2 * num; } V3 v4 = offset + v * dt; float length3 = v4.Length; if (length3 > length) { v4 *= length / length3; } return (v4 - offset) / dt + anchorVelocity; } } public struct RopeRail { public bool Enabled; public V3 Axis; public float Length; public float Position; public float Speed; public float Mass; } public struct RopeNodeStep { public V3 PlayerVelocity; public V3 Point; public V3 PointVelocity; public float RailPosition; public float RailSpeed; } public static class TwoSegmentRope { public static V3 MergeVelocity(V3 body, V3 point, float totalMass, float pointMass) { if (!body.Finite || !point.Finite || !V3.Valid(totalMass) || !V3.Valid(pointMass) || totalMass <= 0f || pointMass < 0f || pointMass >= totalMass) { return body; } return (body * (totalMass - pointMass) + point * pointMass) / totalMass; } public static V3 SpringImpulse(V3 error, V3 relativeVelocity, float bodyMass, float handMass, float dt) { if (!error.Finite || !relativeVelocity.Finite || bodyMass <= 0f || handMass <= 0f || dt <= 0f) { return default(V3); } float num = bodyMass * handMass / (bodyMass + handMass); float num2 = (float)Math.PI * 12f; float num3 = num * num2 * num2; float num4 = 2f * num * num2; return (error * num3 + relativeVelocity * num4) * (dt / (1f + (num4 * dt + num3 * dt * dt) / num)); } public static RopeNodeStep Step(V3 body, V3 velocity, V3 point, V3 pointVelocity, V3 handOffset, V3 handVelocity, V3 anchor, V3 anchorVelocity, float upper, float lower, float bodyMass, float handMass, V3 gravity, float damping, float dt, RopeRail rail, float maximumHandForce = float.PositiveInfinity) { RopeNodeStep result = new RopeNodeStep { PlayerVelocity = velocity, Point = point, PointVelocity = pointVelocity, RailPosition = rail.Position, RailSpeed = rail.Speed }; if (!body.Finite || !velocity.Finite || !point.Finite || !pointVelocity.Finite || !handOffset.Finite || !handVelocity.Finite || !anchor.Finite || !anchorVelocity.Finite || !gravity.Finite || !V3.Valid(dt) || dt <= 0f || dt > 0.15f || !V3.Valid(upper) || !V3.Valid(lower) || upper < 0.025f || lower < 0.025f || !V3.Valid(bodyMass) || !V3.Valid(handMass) || bodyMass <= 0f || handMass <= 0f) { return result; } if (rail.Enabled && (!rail.Axis.Finite || Math.Abs(rail.Axis.Length - 1f) > 0.001f || rail.Length <= 0f || rail.Mass <= 0f)) { return result; } V3 v = body; V3 v2 = point; float position = rail.Position; float num = rail.Position; float num2 = rail.Speed; V3 v3 = anchor - rail.Axis * num; float num3 = 1f / bodyMass; float num4 = 1f / handMass; int num5 = Math.Max(1, (int)Math.Ceiling(dt / 0.008f)); float num6 = dt / (float)num5; for (int i = 0; i < num5; i++) { V3 v4 = ((!rail.Enabled) ? (anchor + anchorVelocity * ((float)i * num6)) : (v3 + anchorVelocity * ((float)i * num6) + rail.Axis * num)); V3 v5 = SpringImpulse(body + handOffset - point, velocity + handVelocity - pointVelocity, bodyMass, handMass, num6); if (V3.Valid(maximumHandForce) && maximumHandForce >= 0f && v5.Length > maximumHandForce * num6) { v5 *= maximumHandForce * num6 / v5.Length; } velocity -= v5 * num3; pointVelocity += v5 * num4; pointVelocity += gravity * num6; if (damping > 0f && (point - v4).Length >= upper - 0.001f) { V3 v6 = body - v4; float length = v6.Length; if (length > 0.0001f) { V3 v7 = v6 / length; V3 v8 = velocity - anchorVelocity; V3 v9 = v8 - v7 * V3.Dot(v8, v7); velocity -= v9 * (1f - (float)Math.Exp((0f - damping) * num6)); } } V3 v10 = body; V3 v11 = point; float num7 = num; body += velocity * num6; point += pointVelocity * num6; if (rail.Enabled) { num2 += V3.Dot(gravity, rail.Axis) * num6; num = Clamp(num + num2 * num6, 0f, rail.Length); } for (int j = 0; j < 8; j++) { v4 = ((!rail.Enabled) ? (anchor + anchorVelocity * ((float)(i + 1) * num6)) : (v3 + anchorVelocity * ((float)(i + 1) * num6) + rail.Axis * num)); V3 v12 = point - v4; V3 v13 = body - point; float length2 = v12.Length; float length3 = v13.Length; V3 v14 = ((!(length2 > 1E-06f)) ? default(V3) : (v12 / length2)); V3 v15 = ((!(length3 > 1E-06f)) ? default(V3) : (v13 / length3)); float num8 = Math.Max(0f, length2 - upper); float num9 = Math.Max(0f, length3 - lower); if (num8 < 1E-06f && num9 < 1E-06f) { break; } float num10 = ((!rail.Enabled) ? 0f : V3.Dot(v14, rail.Axis)); float num11 = ((!rail.Enabled) ? 0f : (1f / rail.Mass)); if ((num <= 0f && num10 < 0f) || (num >= rail.Length && num10 > 0f)) { num11 = 0f; } float num12 = num4 + num11 * num10 * num10; float num13 = num3 + num4; float num14 = (0f - num4) * V3.Dot(v14, v15); float num15 = num8 / num12; float num16 = num9 / num13; if (length2 >= upper - 1E-05f && length3 >= lower - 1E-05f) { float num17 = num12 * num13 - num14 * num14; num15 = (num8 * num13 - num9 * num14) / num17; num16 = (num9 * num12 - num8 * num14) / num17; if (num15 < 0f) { num15 = 0f; num16 = num9 / num13; } if (num16 < 0f) { num16 = 0f; num15 = num8 / num12; } } body -= v15 * (num16 * num3); point += (v15 * num16 - v14 * num15) * num4; if (rail.Enabled) { num = Clamp(num + num10 * num15 * num11, 0f, rail.Length); } } velocity = (body - v10) / num6; pointVelocity = (point - v11) / num6; if (rail.Enabled) { num2 = (num - num7) / num6; } } result.PlayerVelocity = (body - v) / dt; result.Point = point; result.PointVelocity = (point - v2) / dt; result.RailPosition = num; result.RailSpeed = ((!rail.Enabled) ? 0f : ((num - position) / dt)); return result; } private static float Clamp(float x, float min, float max) { return Math.Max(min, Math.Min(max, x)); } } } namespace quaternion.MrZippy { internal static class GrabVolumes { internal static bool FindHeld(Vector3 hand, Vector3 top, out FVRInteractiveObject grab, out Collider volume, out Vector3 contact) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_008c: 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) grab = null; volume = null; contact = top; float num = float.MaxValue; Collider[] array = Physics.OverlapCapsule(hand, top, 0.012f, -1, (QueryTriggerInteraction)2); foreach (Collider val in array) { FVRInteractiveObject val2 = Resolve(val); if (!((Object)(object)val2 == (Object)null)) { Collider val3 = AttachmentVolume(val2, val); Vector3 val4 = val3.ClosestPoint(top); Vector3 val5 = val4 - top; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; grab = val2; volume = val3; contact = val4; } } } return (Object)(object)grab != (Object)null; } internal static FVRInteractiveObject Resolve(Collider collider) { if ((Object)(object)collider == (Object)null || !collider.enabled || !((Component)collider).gameObject.activeInHierarchy) { return null; } FVRInteractiveObject val = ((Component)collider).GetComponent<FVRInteractiveObject>(); MrGrippy mrGrippy = val as MrGrippy; if ((Object)(object)mrGrippy != (Object)null) { val = (FVRInteractiveObject)(object)mrGrippy.ClimbPoint; } if ((Object)(object)val == (Object)null && (Object)(object)collider.attachedRigidbody != (Object)null && ((Component)collider.attachedRigidbody).CompareTag("RawGrab")) { val = ((Component)collider.attachedRigidbody).GetComponent<FVRInteractiveObject>(); } return (!CanAttachTo(val)) ? null : val; } internal static bool CanAttachTo(FVRInteractiveObject target) { if (!ValidAnchor(target)) { return false; } return target is GrippyClimbPoint || target is SupportShellAnchor || target.IsInteractable(); } internal static Collider AttachmentVolume(FVRInteractiveObject target, Collider fallback) { GrippyClimbPoint grippyClimbPoint = target as GrippyClimbPoint; SupportShellAnchor supportShellAnchor = target as SupportShellAnchor; return (Collider)(((Object)(object)grippyClimbPoint != (Object)null) ? grippyClimbPoint.Volume : ((!((Object)(object)supportShellAnchor != (Object)null)) ? ((object)fallback) : ((object)supportShellAnchor.Volume))); } internal static bool ValidAnchor(FVRInteractiveObject target) { if ((Object)(object)target == (Object)null || !((Behaviour)target).enabled || !((Component)target).gameObject.activeInHierarchy) { return false; } GrippyClimbPoint grippyClimbPoint = target as GrippyClimbPoint; SupportShellAnchor supportShellAnchor = target as SupportShellAnchor; return ((Object)(object)grippyClimbPoint != (Object)null) ? grippyClimbPoint.TetherAvailable : ((!((Object)(object)supportShellAnchor != (Object)null)) ? target.DoesFunctionAsGrabPoint() : supportShellAnchor.TetherAvailable); } internal static bool Find(Vector3 point, out FVRInteractiveObject grab, out Collider volume) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0059: 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_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_0087: Unknown result type (might be due to invalid IL or missing references) grab = null; volume = null; Collider[] array = Physics.OverlapSphere(point, 0.002f, -1, (QueryTriggerInteraction)2); float num = float.MaxValue; Collider[] array2 = array; foreach (Collider val in array2) { FVRInteractiveObject val2 = Resolve(val); if ((Object)(object)val2 == (Object)null) { continue; } Collider val3 = AttachmentVolume(val2, val); Vector3 val4 = val3.ClosestPoint(point) - point; if (!(((Vector3)(ref val4)).sqrMagnitude > 1E-06f)) { Vector3 val5 = ((Component)val).transform.position - point; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; grab = val2; volume = val3; } } } return (Object)(object)grab != (Object)null; } } public sealed class GrippyClimbPoint : FVRInteractiveObject { public MrGrippy Owner; public Collider Volume; private Vector3 lastHandLocal; public bool TetherAvailable => (Object)(object)Owner != (Object)null && ((Behaviour)Owner).isActiveAndEnabled && (Object)(object)Volume != (Object)null && Volume.enabled; public override bool IsInteractable() { return (Object)(object)Owner != (Object)null && Owner.IsAttached && ((Behaviour)Owner).isActiveAndEnabled; } public override bool DoesFunctionAsGrabPoint() { return ((FVRInteractiveObject)this).IsInteractable(); } public override Vector3 GetLastGrabHandPos() { //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_0012: 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) return ((Component)this).transform.TransformPoint(lastHandLocal); } public override void SetLastGrabHandPos(Vector3 point) { //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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) lastHandLocal = ((Component)this).transform.InverseTransformPoint(point); } public override void BeginInteraction(FVRViveHand hand) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (((FVRInteractiveObject)this).IsInteractable()) { ((FVRInteractiveObject)this).SetLastGrabHandPos(((HandInput)(ref hand.Input)).Pos); GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); ((FVRInteractiveObject)this).BeginInteraction(hand); } } public override void UpdateInteraction(FVRViveHand hand) { //IL_0043: 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_0048: Unknown result type (might be due to invalid IL or missing references) ((FVRInteractiveObject)this).UpdateInteraction(hand); bool flag = !hand.Input.TouchpadDown && hand.Input.Secondary2AxisInputDown; Vector2 val = ((!flag) ? hand.Input.TouchpadAxes : hand.Input.Secondary2AxisInputAxes); if ((hand.Input.TouchpadDown || flag) && val.y < -0.5f && 0f - val.y > Mathf.Abs(val.x) && (Object)(object)Owner != (Object)null) { hand.Input.TouchpadDown = (hand.Input.Secondary2AxisInputDown = false); Owner.PickUpAttached(hand); } } public override void EndInteraction(FVRViveHand hand) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) bool isHeld = ((FVRInteractiveObject)this).IsHeld; ((FVRInteractiveObject)this).EndInteraction(hand); if (isHeld && (Object)(object)GM.CurrentMovementManager != (Object)null) { GM.CurrentMovementManager.CleanupFlagsForModeSwitch(); GM.CurrentMovementManager.EndGrabPointMove(hand, default(Vector3)); } } internal void ReleaseClimber() { FVRViveHand hand = base.m_hand; if ((Object)(object)hand != (Object)null && (Object)(object)hand.CurrentInteractable == (Object)(object)this) { hand.ForceSetInteractable((FVRInteractiveObject)null); } else if ((Object)(object)hand != (Object)null) { ((FVRInteractiveObject)this).EndInteraction(hand); } } } [HarmonyPatch(typeof(FVRMovementManager), "TeleportToPoint", new Type[] { typeof(Vector3), typeof(bool), typeof(Vector3) })] internal static class HarnessTurnHook { internal sealed class TurnState { public ZippyHarness Kit; public Vector3 Pivot; public Vector3 Velocity; } private static readonly FieldInfo Velocity = AccessTools.Field(typeof(FVRMovementManager), "m_smoothLocoVelocity"); private static void Prefix(FVRMovementManager __instance, Vector3 point, bool isAbsolute, Vector3 lookDir, out TurnState __state) { //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_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_004c: 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_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_0099: 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_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_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_00e7: 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) __state = null; ZippyHarness active = ZippyHarness.Active; if ((Object)(object)active == (Object)null || active.State != HarnessState.Attached || isAbsolute || !ZippyHarness.Supported(__instance)) { return; } Vector3 position = __instance.Body.NeckJointTransform.position; Vector3 val = point - position; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude > 0.04f) && !(Mathf.Abs(point.y - ((Component)__instance).transform.position.y) > 0.05f)) { Vector3 val2 = Vector3.ProjectOnPlane(lookDir, Vector3.up); if (!(((Vector3)(ref val2)).sqrMagnitude < 0.001f)) { __state = new TurnState { Kit = active, Pivot = active.TetherOrigin, Velocity = (Vector3)Velocity.GetValue(__instance) }; } } } [HarmonyPriority(0)] private static void Postfix(FVRMovementManager __instance, TurnState __state) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_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_0093: 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_009c: 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_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_0107: 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_00e4: 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_01fd: 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_0167: Unknown result type (might be due to invalid IL or missing references) if (__state == null || (Object)(object)__state.Kit == (Object)null) { return; } __instance.Body.UpdatePlayerBodyPositions(); Vector3 val = __state.Pivot - __state.Kit.TetherOrigin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 1E-05f) { Vector3 position = __instance.Body.NeckJointTransform.position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(position.x, ((Component)__instance).transform.position.y + 0.25f, position.z); RaycastHit val3 = default(RaycastHit); if (Physics.CapsuleCast(position, val2, 0.15f, ((Vector3)(ref val)).normalized, ref val3, magnitude + 0.01f, LayerMask.op_Implicit(__instance.LM_TeleCast), (QueryTriggerInteraction)1)) { val = ((Vector3)(ref val)).normalized * Mathf.Min(magnitude, Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.01f)); } Transform transform = ((Component)__instance).transform; transform.position += val; __instance.Body.MoveQuickbeltContents(val); FVRViveHand[] hands = __instance.Hands; foreach (FVRViveHand val4 in hands) { FVRInteractiveObject currentInteractable = val4.CurrentInteractable; FVRPhysicalObject val5 = (FVRPhysicalObject)(object)((currentInteractable is FVRPhysicalObject) ? currentInteractable : null); if ((Object)(object)val5 != (Object)null && !val5.DoesDirectParent && !val5.IsPivotLocked) { Transform transform2 = ((Component)val5).transform; transform2.position += val; } } } __instance.Body.UpdatePlayerBodyPositions(); Velocity.SetValue(__instance, __state.Velocity); FVRViveHand[] hands2 = __instance.Hands; foreach (FVRViveHand val6 in hands2) { val6.PollInput(); val6.FlushFilter(); if ((Object)(object)val6.CurrentInteractable != (Object)null && val6.CurrentInteractable.DoesFunctionAsGrabPoint()) { val6.CurrentInteractable.SetLastGrabHandPos(((HandInput)(ref val6.Input)).Pos); } } __instance.ResetNeckPoses(); __state.Kit.RebaseAfterTurn(); } } public sealed class MrGrippy : FVRPhysicalObject { public const string ItemId = "quaternion_MrGrippy"; public Transform HeadContact; public Collider PickupVolume; public GrippyClimbPoint ClimbPoint; public Transform[] HookBones; public float[] HookAngles; public AudioSource MechanismAudio; public AudioClip AttachmentClick; public AudioClip DetachmentClick; public float MinimumImpactSpeed = 0.5f; public float DeploySeconds = 0.18f; public float AlignmentMinimumSpeed = 1.25f; public float AlignmentTurnSpeed = 12f; public float AlignmentResponse = 24f; public const float PlantInset = 0.003f; private Quaternion[] readyRotations; private Collider anchor; private Vector3 anchorPosition; private Quaternion anchorRotation; private Vector3 previousTip; private bool sweepReady; private float retryAfter; private bool alignInFlight; private bool throwDamageArmed; private readonly HashSet<int> hitSosigs = new HashSet<int>(); internal const float DamageMinimumSpeed = 2.5f; public bool IsAttached { get; private set; } public float Deployment { get; private set; } public override void Awake() { //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) ((FVRPhysicalObject)this).Awake(); readyRotations = (Quaternion[])(object)new Quaternion[HookBones.Length]; for (int i = 0; i < HookBones.Length; i++) { ref Quaternion reference = ref readyRotations[i]; reference = HookBones[i].localRotation; } SetDeployment(0f); if ((Object)(object)ClimbPoint != (Object)null) { ClimbPoint.Owner = this; } RefreshVolumes(); } public override bool IsInteractable() { return !IsAttached && ((FVRPhysicalObject)this).IsInteractable(); } public override void BeginInteraction(FVRViveHand hand) { Detach(sound: true); sweepReady = false; alignInFlight = false; throwDamageArmed = false; hitSosigs.Clear(); ((FVRPhysicalObject)this).BeginInteraction(hand); } public override void EndInteraction(FVRViveHand hand) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).EndInteraction(hand); if (!((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null) && !((FVRInteractiveObject)this).IsHeld) { previousTip = HeadContact.position; sweepReady = true; Vector3 velocity = ((FVRPhysicalObject)this).RootRigidbody.velocity; alignInFlight = ((Vector3)(ref velocity)).magnitude >= AlignmentMinimumSpeed; Vector3 velocity2 = ((FVRPhysicalObject)this).RootRigidbody.velocity; throwDamageArmed = ((Vector3)(ref velocity2)).magnitude >= 2.5f; hitSosigs.Clear(); TryHeadPlacement(); } } public override void FVRUpdate() { ((FVRPhysicalObject)this).FVRUpdate(); if (IsAttached) { FollowAnchor(); } float num = ((!(DeploySeconds <= 0f)) ? (Time.deltaTime / DeploySeconds) : 1f); SetDeployment(Mathf.MoveTowards(Deployment, (!IsAttached) ? 0f : 1f, num)); } public override void FVRFixedUpdate() { //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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRFixedUpdate(); if (IsAttached) { FollowAnchor(); return; } if (((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null || Time.time < retryAfter) { sweepReady = false; alignInFlight = false; return; } AlignFlight(); Vector3 position = HeadContact.position; if (sweepReady) { Vector3 val = position - previousTip; if (((Vector3)(ref val)).sqrMagnitude > 1E-06f) { Vector3 velocity = ((FVRPhysicalObject)this).RootRigidbody.velocity; if (((Vector3)(ref velocity)).magnitude >= MinimumImpactSpeed) { RaycastHit[] array = Physics.RaycastAll(previousTip, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude + 0.008f, -1, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val2 = array2[num]; if (!((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(((Component)this).transform)) { DamageSosig(((RaycastHit)(ref val2)).collider, ((RaycastHit)(ref val2)).point, ((RaycastHit)(ref val2)).normal, ((FVRPhysicalObject)this).RootRigidbody.velocity); TryAttach(((RaycastHit)(ref val2)).collider, ((RaycastHit)(ref val2)).point, ((RaycastHit)(ref val2)).normal); break; } } } } } previousTip = position; sweepReady = true; } public override void OnCollisionEnter(Collision collision) { //IL_0030: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_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_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_00da: 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_0110: 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) ((FVRPhysicalObject)this).OnCollisionEnter(collision); alignInFlight = false; if (collision.contacts.Length > 0) { DamageSosig(collision.collider, ((ContactPoint)(ref collision.contacts[0])).point, ((ContactPoint)(ref collision.contacts[0])).normal, -collision.relativeVelocity); } if (IsAttached || ((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null || Time.time < retryAfter) { return; } Vector3 relativeVelocity = collision.relativeVelocity; if (((Vector3)(ref relativeVelocity)).magnitude < MinimumImpactSpeed) { return; } ContactPoint[] contacts = collision.contacts; for (int i = 0; i < contacts.Length; i++) { ContactPoint val = contacts[i]; if (!(((Component)this).transform.InverseTransformPoint(((ContactPoint)(ref val)).point).y < HeadContact.localPosition.y - 0.03f) && TryAttach(collision.collider, ((ContactPoint)(ref val)).point, ((ContactPoint)(ref val)).normal)) { break; } } } private void AlignFlight() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0063: 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_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_00b4: 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_00db: 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_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_00f0: 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_00f4: 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) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!alignInFlight || ((FVRPhysicalObject)this).RootRigidbody.isKinematic) { return; } Vector3 velocity = ((FVRPhysicalObject)this).RootRigidbody.velocity; if (!(((Vector3)(ref velocity)).magnitude < AlignmentMinimumSpeed)) { Vector3 normalized = ((Vector3)(ref velocity)).normalized; Vector3 val = ((FVRPhysicalObject)this).RootRigidbody.rotation * Vector3.up; Quaternion val2 = Quaternion.FromToRotation(val, normalized); float num = default(float); Vector3 zero = default(Vector3); ((Quaternion)(ref val2)).ToAngleAxis(ref num, ref zero); if (num > 180f) { num -= 360f; } if (float.IsNaN(zero.x) || ((Vector3)(ref zero)).sqrMagnitude < 0.1f) { zero = Vector3.zero; } Vector3 val3 = zero * Mathf.Clamp(num * ((float)Math.PI / 180f) * 12f, 0f - AlignmentTurnSpeed, AlignmentTurnSpeed); Vector3 val4 = Vector3.ProjectOnPlane(((FVRPhysicalObject)this).RootRigidbody.angularVelocity, normalized); Vector3 val5 = Vector3.ClampMagnitude((val3 - val4) * AlignmentResponse, 240f); ((FVRPhysicalObject)this).RootRigidbody.AddTorque(val5, (ForceMode)5); } } private void DamageSosig(Collider surface, Vector3 point, Vector3 normal, Vector3 impactVelocity) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_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_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) if (throwDamageArmed && !((FVRInteractiveObject)this).IsHeld && !IsAttached && !((Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null) && !((Object)(object)surface == (Object)null) && !(((Vector3)(ref impactVelocity)).magnitude < 2.5f)) { SosigLink val = SosigTarget(surface); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.S == (Object)null) && hitSosigs.Add(((Object)val.S).GetInstanceID())) { float num = 0.5f * ((FVRPhysicalObject)this).RootRigidbody.mass * ((Vector3)(ref impactVelocity)).sqrMagnitude; float num2 = ((MrZippyPlugin.GrippyImpactMultiplier != null) ? MrZippyPlugin.GrippyImpactMultiplier.Value : 2f); Damage val2 = new Damage(); val2.Class = (DamageClass)3; val2.point = point; val2.hitNormal = normal; val2.strikeDir = ((Vector3)(ref impactVelocity)).normalized; val2.Source_Point = ((Component)this).transform.position; val2.Source_IFF = GM.CurrentPlayerBody.GetPlayerIFF(); val2.damageSize = 0.025f; val2.Dam_Blunt = num * 0.5f * num2; val2.Dam_TotalKinetic = val2.Dam_Blunt; val2.Dam_Stunning = Mathf.Clamp(num * 0.12f, 0.4f, 3f) * num2; val.Damage(val2); } } } private static SosigLink SosigTarget(Collider surface) { SosigLink componentInParent = ((Component)surface).GetComponentInParent<SosigLink>(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent; } SosigWearable componentInParent2 = ((Component)surface).GetComponentInParent<SosigWearable>(); return (!((Object)(object)componentInParent2 != (Object)null)) ? null : componentInParent2.L; } internal bool CanStick(Collider surface) { if ((Object)(object)surface == (Object)null || !surface.enabled || surface.isTrigger || !((Component)surface).gameObject.activeInHierarchy || ((Component)surface).transform.IsChildOf(((Component)this).transform)) { return false; } if ((Object)(object)SosigTarget(surface) != (Object)null) { return false; } if ((Object)(object)((Component)surface).GetComponentInParent<FVRPhysicalObject>() != (Object)null || (Object)(object)((Component)surface).GetComponentInParent<FVRViveHand>() != (Object)null || (Object)(object)((Component)surface).GetComponentInParent<FVRPlayerBody>() != (Object)null) { return false; } return (Object)(object)surface.attachedRigidbody == (Object)null || surface.attachedRigidbody.isKinematic; } internal bool TryAttach(Collider surface, Vector3 point, Vector3 outwardNormal) { //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_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_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_0097: 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_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_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_00cf: 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_00dc: 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_010f: 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) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_0199: Unknown result type (might be due to invalid IL or missing references) if (IsAttached || ((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot != (Object)null || Time.time < retryAfter || !CanStick(surface) || ((Vector3)(ref outwardNormal)).sqrMagnitude < 0.9f) { return false; } Vector3 normalized = ((Vector3)(ref outwardNormal)).normalized; if (Vector3.Dot(((Component)this).transform.up, -normalized) < 0.15f) { return false; } Quaternion val = Quaternion.FromToRotation(((Component)this).transform.up, -normalized) * ((Component)this).transform.rotation; Vector3 val2 = ((Component)this).transform.InverseTransformPoint(HeadContact.position); Rigidbody rootRigidbody = ((FVRPhysicalObject)this).RootRigidbody; Vector3 zero = Vector3.zero; ((FVRPhysicalObject)this).RootRigidbody.angularVelocity = zero; rootRigidbody.velocity = zero; base.IsKinematicLocked = true; ((FVRPhysicalObject)this).RootRigidbody.isKinematic = true; ((FVRPhysicalObject)this).RootRigidbody.useGravity = false; ((Component)this).transform.rotation = val; ((Component)this).transform.position = point - val * val2 - normalized * 0.003f; ((FVRPhysicalObject)this).RootRigidbody.position = ((Component)this).transform.position; ((FVRPhysicalObject)this).RootRigidbody.rotation = val; anchor = surface; anchorPosition = ((Component)surface).transform.InverseTransformPoint(((Component)this).transform.position); anchorRotation = Quaternion.Inverse(((Component)surface).transform.rotation) * val; IsAttached = true; alignInFlight = false; throwDamageArmed = false; RefreshVolumes(); Play(AttachmentClick); return true; } private void TryHeadPlacement() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Vector3 up = ((Component)this).transform.up; RaycastHit[] array = Physics.RaycastAll(HeadContact.position - up * 0.035f, up, 0.055f, -1, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val = array2[num]; if (!((Component)((RaycastHit)(ref val)).collider).transform.IsChildOf(((Component)this).transform)) { TryAttach(((RaycastHit)(ref val)).collider, ((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal); break; } } } private void FollowAnchor() { //IL_0056: 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_0076: 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) if ((Object)(object)anchor == (Object)null || !anchor.enabled || !((Component)anchor).gameObject.activeInHierarchy) { Detach(sound: false); return; } ((FVRPhysicalObject)this).RootRigidbody.position = ((Component)anchor).transform.TransformPoint(anchorPosition); ((FVRPhysicalObject)this).RootRigidbody.rotation = ((Component)anchor).transform.rotation * anchorRotation; } internal void PickUpAttached(FVRViveHand hand) { if (IsAttached) { Detach(sound: true); hand.ForceSetInteractable((FVRInteractiveObject)(object)this); ((FVRInteractiveObject)this).BeginInteraction(hand); } } internal void DetachForLaser() { Detach(sound: true); } private void Detach(bool sound) { if (IsAttached) { if ((Object)(object)ClimbPoint != (Object)null) { ClimbPoint.ReleaseClimber(); } IsAttached = false; anchor = null; base.IsKinematicLocked = false; if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = false; ((FVRPhysicalObject)this).RootRigidbody.useGravity = base.UsesGravity; } retryAfter = Time.time + 0.25f; sweepReady = false; alignInFlight = false; RefreshVolumes(); if (sound) { Play(DetachmentClick); } } } private void RefreshVolumes() { if ((Object)(object)PickupVolume != (Object)null) { PickupVolume.enabled = ((Behaviour)this).isActiveAndEnabled && !IsAttached; } if ((Object)(object)ClimbPoint != (Object)null && (Object)(object)ClimbPoint.Volume != (Object)null) { ClimbPoint.Volume.enabled = ((Behaviour)this).isActiveAndEnabled; } } public override GameObject DuplicateFromSpawnLock(FVRViveHand hand) { GameObject val = ((FVRPhysicalObject)this).DuplicateFromSpawnLock(hand); MrGrippy mrGrippy = ((!((Object)(object)val != (Object)null)) ? null : val.GetComponent<MrGrippy>()); if ((Object)(object)hand != (Object)null && (Object)(object)mrGrippy != (Object)null) { foreach (ZippyHarness instance in ZippyHarness.Instances) { if ((Object)(object)instance != (Object)null) { instance.TransferGrippyTether(ClimbPoint, mrGrippy.ClimbPoint); } } } return val; } internal void SetDeployment(float amount) { //IL_0028: 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) Deployment = Mathf.Clamp01(amount); for (int i = 0; i < HookBones.Length; i++) { HookBones[i].localRotation = readyRotations[i] * Quaternion.AngleAxis(HookAngles[i] * Deployment, Vector3.back); } } private void Play(AudioClip clip) { if ((Object)(object)MechanismAudio != (Object)null && (Object)(object)clip != (Object)null) { MechanismAudio.PlayOneShot(clip, 0.9f); } } public override Dictionary<string, string> GetFlagDic() { Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic(); flagDic["IsKinematicLocked"] = "False"; return flagDic; } public override void ConfigureFromFlagDic(Dictionary<string, string> flags) { Dictionary<string, string> dictionary = new Dictionary<string, string>(flags); dictionary["IsKinematicLocked"] = "False"; ((FVRPhysicalObject)this).ConfigureFromFlagDic(dictionary); } private void OnEnable() { RefreshVolumes(); } private void OnDisable() { alignInFlight = false; throwDamageArmed = false; hitSosigs.Clear(); Detach(sound: false); RefreshVolumes(); } public override void OnDestroy() { Detach(sound: false); ((FVRPhysicalObject)this).OnDestroy(); } } public sealed class NativeBackpackSlots : MonoBehaviour { public ZippyHarness Harness; public bool IsReady { get; private set; } private void OnEnable() { if (Application.isPlaying && !IsReady) { ((MonoBehaviour)this).StartCoroutine(Load()); } } private void OnDisable() { ((MonoBehaviour)this).StopAllCoroutines(); } private IEnumerator Load() { if ((Object)(object)Harness == (Object)null) { Harness = ((Component)this).GetComponent<ZippyHarness>(); } float deadline = Time.realtimeSinceStartup + 90f; while ((IM.OD == null || !IM.OD.ContainsKey("BackpackA")) && Time.realtimeSinceStartup < deadline) { yield return null; } if ((Object)(object)Harness == (Object)null || IM.OD == null || !IM.OD.ContainsKey("BackpackA")) { yield break; } AnvilCallback<GameObject> request = ((AnvilAsset)IM.OD["BackpackA"]).GetGameObjectAsync(); while (((CustomYieldInstruction)request).keepWaiting && Time.realtimeSinceStartup < deadline) { yield return null; } if ((Object)(object)Harness == (Object)null || !((AnvilCallbackBase)request).IsCompleted || (Object)(object)request.Result == (Object)null) { yield break; } PlayerBackPack source = request.Result.GetComponent<PlayerBackPack>(); if ((Object)(object)source == (Object)null || ((FVRPhysicalObject)source).Slots == null) { yield break; } FVRQuickBeltSlot huge = ((IEnumerable<FVRQuickBeltSlot>)((FVRPhysicalObject)source).Slots).FirstOrDefault((Func<FVRQuickBeltSlot, bool>)((FVRQuickBeltSlot s) => (int)s.SizeLimit == 3)); FVRQuickBeltSlot sphere = ((IEnumerable<FVRQuickBeltSlot>)((FVRPhysicalObject)source).Slots).FirstOrDefault((Func<FVRQuickBeltSlot, bool>)((FVRQuickBeltSlot s) => (int)s.Shape == 0)); if ((Object)(object)huge == (Object)null || (Object)(object)sphere == (Object)null || ((FVRPhysicalObject)Harness).Slots.Length != 3) { yield break; } FVRQuickBeltSlot[] old = ((FVRPhysicalObject)Harness).Slots; FVRQuickBeltSlot[] replacement = (FVRQuickBeltSlot[])(object)new FVRQuickBeltSlot[3]; Transform waist = ((Component)Harness).GetComponentsInChildren<Transform>(true).First((Transform t) => ((Object)t).name == "WaistVisualPivot"); for (int num = 0; num < 3; num++) { Transform parent = ((Component)old[num]).transform.parent; Vector3 val = Vector3.ProjectOnPlane(parent.position - waist.position, waist.up); Vector3 normalized = ((Vector3)(ref val)).normalized; replacement[num] = Create((num != 0) ? sphere : huge, parent, (num != 0) ? 0.17f : 0.25f, (FVRPhysicalObjectSize)((num != 0) ? 2 : 3), normalized); OrientContents(replacement[num], waist, num == 0); replacement[num].IsSelectable = old[num].IsSelectable; replacement[num].SetAffixedTo((FVRPhysicalObject)(object)Harness); } ((FVRPhysicalObject)Harness).DeRegisterQuickbeltSlots(); ((FVRPhysicalObject)Harness).Slots = replacement; for (int num2 = 0; num2 < old.Length; num2++) { if ((Object)(object)old[num2].CurObject != (Object)null) { old[num2].CurObject.SetQuickBeltSlot(replacement[num2]); } ((Behaviour)old[num2]).enabled = false; ((Component)old[num2]).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)old[num2]).gameObject); } ((FVRPhysicalObject)Harness).RegisterQuickbeltSlots(); IsReady = true; } public static void OrientContents(FVRQuickBeltSlot slot, Transform waist, bool rear) { //IL_0024: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0045: Unknown result type (might be due to invalid IL or missing references) slot.PoseOverride.rotation = ((!rear) ? Quaternion.LookRotation(-waist.up, waist.forward) : Quaternion.LookRotation(waist.right, waist.up)); slot.SetBaseRotation(slot.PoseOverride.localRotation); } public static FVRQuickBeltSlot Create(FVRQuickBeltSlot sample, Transform mount, float diameter, FVRPhysicalObjectSize size, Vector3 outward) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00aa: 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_00b8: 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_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_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_00e5: 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_0101: 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_0112: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)sample).gameObject); ((Object)val).name = (((int)size != 3) ? "Large_NativeBackpackSlot" : "Huge_NativeBackpackSlot"); val.transform.SetParent(mount, false); val.transform.localRotation = (((int)size != 3) ? Quaternion.identity : Quaternion.Euler(90f, 0f, 0f)); val.transform.position = mount.position + outward * 0.055f; Mesh sharedMesh = sample.HoverGeo.GetComponent<MeshFilter>().sharedMesh; Transform transform = ((Component)sample).transform; Transform transform2 = sample.HoverGeo.transform; Vector3 right = Vector3.right; Bounds bounds = sharedMesh.bounds; Vector3 val2 = transform.InverseTransformVector(transform2.TransformVector(right * ((Bounds)(ref bounds)).size.x)); float magnitude = ((Vector3)(ref val2)).magnitude; val.transform.localScale = Vector3.one * (diameter / magnitude); FVRQuickBeltSlot component = val.GetComponent<FVRQuickBeltSlot>(); component.SizeLimit = size; component.IsPlayer = false; component.Type = (QuickbeltSlotType)0; component.CurObject = null; component.HeldObject = null; component.IsHovered = false; return component; } } internal static class NativeMovement { private static readonly FieldInfo Grounded = AccessTools.Field(typeof(FVRMovementManager), "m_isGrounded"); private static readonly FieldInfo Velocity = AccessTools.Field(typeof(FVRMovementManager), "m_smoothLocoVelocity"); internal static bool IsGrounded(FVRMovementManager manager) { return (Object)(object)manager != (Object)null && (bool)Grounded.GetValue(manager); } internal static Vector3 GetVelocity(FVRMovementManager manager) { //IL_0022: 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_0027: 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) return (Vector3)((!((Object)(object)manager != (Object)null)) ? Vector3.zero : ((Vector3)Velocity.GetValue(manager))); } internal static void SetVelocity(FVRMovementManager manager, Vector3 value) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)manager != (Object)null) { Velocity.SetValue(manager, value); } } } [HarmonyPatch(typeof(FVRViveHand), "TestQuickBeltDistances")] internal static class HarnessSlotHook { private static void Prefix(FVRViveHand __instance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ZippyHarness zippyHarness = __instance.CurrentInteractable as ZippyHarness; if (!((Object)(object)zippyHarness == (Object)null)) { ((FVRPhysicalObject)zippyHarness).QBSlotType = (QuickbeltSlotType)1; } } } [HarmonyPatch(typeof(FVRViveHand), "PollInput")] internal static class CarabinerInputHook { private static void Consume(FVRViveHand hand) { hand.Input.TriggerDown = (hand.Input.TriggerUp = (hand.Input.IsGrabDown = (hand.Input.IsGrabUp = false))); } private static void Postfix(FVRViveHand __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) if ((int)__instance.Mode != 0) { return; } PlayerHarnessPoint instance = PlayerHarnessPoint.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.EditingHand == (Object)(object)__instance) { instance.InputTick(__instance); } else if ((Object)(object)instance != (Object)null && ((FVRInteractiveObject)instance).IsInteractable() && (instance.Near(__instance) || (Object)(object)__instance.CurrentInteractable == (Object)(object)instance) && PlayerHarnessPoint.AdjustChord(__instance) && ((Object)(object)__instance.CurrentInteractable == (Object)null || (Object)(object)__instance.CurrentInteractable == (Object)(object)instance || ((Object)(object)ZippyHarness.Placing != (Object)null && (Object)(object)ZippyHarness.Placing.PlacementHand == (Object)(object)__instance))) { if ((Object)(object)ZippyHarness.Placing != (Object)null && (Object)(object)ZippyHarness.Placing.PlacementHand == (Object)(object)__instance) { ZippyHarness.Placing.Retrieve(); } instance.BeginAdjustment(__instance); } else { if ((Object)(object)instance != (Object)null && instance.ControlInput(__instance)) { return; } if ((Object)(object)ZippyHarness.Placing != (Object)null && (Object)(object)ZippyHarness.Placing.PlacementHand == (Object)(object)__instance) { ZippyHarness.Placing.PlacementInput(__instance); return; } ZippyRopeGrip zippyRopeGrip = __instance.CurrentInteractable as ZippyRopeGrip; if ((Object)(object)zippyRopeGrip != (Object)null) { zippyRopeGrip.InputTick(__instance); return; } ZippyRopeGrip zippyRopeGrip2 = ZippyRopeGrip.Resolve(__instance.ClosestPossibleInteractable); if (ZippyRopeGrip.V2Enabled && (Object)(object)__instance.CurrentInteractable == (Object)null && (Object)(object)zippyRopeGrip2 != (Object)null && ((FVRInteractiveObject)zippyRopeGrip2).IsInteractable() && __instance.Input.GripPressed && (__instance.Input.GripDown || __instance.Input.IsGrabDown)) { __instance.ForceSetInteractable((FVRInteractiveObject)(object)zippyRopeGrip2); ((FVRInteractiveObject)zippyRopeGrip2).BeginInteraction(__instance); Consume(__instance); __instance.Input.GripDown = false; } else { if ((Object)(object)__instance.CurrentInteractable != (Object)null || __instance.Input.GripPressed || !__instance.Input.TriggerDown) { return; } foreach (ZippyHarness instance2 in ZippyHarness.Instances) { if (!instance2.CanExtract(__instance)) { continue; } instance2.Extract(__instance); Consume(__instance); return; } ZippyRopeGrip zippyRopeGrip3 = zippyRopeGrip2; if (!ZippyRopeGrip.V2Enabled && (Object)(object)zippyRopeGrip3 != (Object)null && ((FVRInteractiveObject)zippyRopeGrip3).IsInteractable()) { __instance.ForceSetInteractable((FVRInteractiveObject)(object)zippyRopeGrip3); ((FVRInteractiveObject)zippyRopeGrip3).BeginInteraction(__instance); Consume(__instance); } else if ((Object)(object)ZippyHarness.Active != (Object)null && ZippyHarness.Active.NearAttachedCarabiner(__instance)) { ZippyHarness.Active.Extract(__instance); Consume(__instance); } } } } } [HarmonyPatch(typeof(FVRMovementManager), "FU")] internal static class HarnessMovementHook { private static void Prefix(FVRMovementManager __instance) { if ((Object)(object)ZippyHarness.Active != (Object)null) { ZippyHarness.Active.BeforeMovement(__instance); } } [HarmonyPriority(0)] private static void Postfix(FVRMovementManager __instance) { if ((Object)(object)ZippyHarness.Active != (Object)null) { ZippyHarness.Active.AfterMovement(__instance); } } } public sealed class PlayerHarnessPoint : FVRInteractiveObject { public const float InteractionRadius = 0.08f; public static PlayerHarnessPoint Instance; public FVRPlayerBody Body; private GameObject visual; private Collider volume; private readonly BeltControls controls = new BeltControls(); private FVRViveHand gestureHand; private Transform controllerVisual; internal Vector3 CollisionOffset; public FVRViveHand EditingHand { get; private set; } public bool IsAdjusting => (Object)(object)EditingHand != (Object)null; public ZippyStatusDisplay Display { get; private set; } public bool HasLockOverride => controls.HasLockOverride; internal Quaternion FrameRotation { get { //IL_0055: 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) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_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) Transform val = ((!((Object)(object)Body.TorsoTransform != (Object)null)) ? Body.Torso : Body.TorsoTransform); Vector3 val2 = Vector3.ProjectOnPlane((!((Object)(object)val != (Object)null)) ? Body.Head.forward : val.forward, Vector3.up); return Quaternion.LookRotation((!(((Vector3)(ref val2)).sqrMagnitude > 0.001f)) ? Vector3.forward : val2, Vector3.up); } } public Vector3 SavedLocalOffset => new Vector3((MrZippyPlugin.HarnessX != null) ? MrZippyPlugin.HarnessX.Value : 0.001974964f, (MrZippyPlugin.HarnessY != null) ? MrZippyPlugin.HarnessY.Value : (-0.4597312f), (MrZippyPlugin.HarnessZ != null) ? MrZippyPlugin.HarnessZ.Value : 0.1787724f); public Vector3 Position => UnconstrainedPosition + CollisionOffset; internal Vector3 UnconstrainedPosition => (!IsAdjusting) ? (Body.Head.position + FrameRotation * SavedLocalOffset) : ((HandInput)(ref EditingHand.Input)).Pos; public static PlayerHarnessPoint Ensure() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody; if ((Object)(object)currentPlayerBody == (Object)null) { return null; } if ((Object)(object)Instance != (Object)null && (Object)(object)Instance.Body == (Object)(object)currentPlayerBody) { return Instance; } if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)Instance).gameObject); } GameObject val = new GameObject("Mr.Zippy Harness Point"); val.layer = LayerMask.NameToLayer("Interactable"); val.transform.SetParent(((Component)currentPlayerBody).transform, false); SphereCollider val2 = val.AddComponent<SphereCollider>(); ((Collider)val2).isTrigger = true; val2.radius = 0.08f; PlayerHarnessPoint playerHarnessPoint = val.AddComponent<PlayerHarnessPoint>(); playerHarnessPoint.Body = currentPlayerBody; playerHarnessPoint.volume = (Collider)(object)val2; ((FVRInteractiveObject)playerHarnessPoint).IsSimpleInteract = false; ((FVRInteractiveObject)playerHarnessPoint).ControlType = (FVRInteractionControlType)1; ((FVRInteractiveObject)playerHarnessPoint).EndInteractionIfDistant = false; foreach (ZippyHarness instance in ZippyHarness.Instances) { if ((Object)(object)instance == (Object)null || !instance.PlayerCarried || (Object)(object)instance.HarnessPointPrefab == (Object)null) { continue; } playerHarnessPoint.visual = Object.Instantiate<GameObject>(instance.HarnessPointPrefab); playerHarnessPoint.visual.transform.SetParent(val.transform, false); playerHarnessPoint.Display = playerHarnessPoint.visual.GetComponent<ZippyStatusDisplay>(); break; } Instance = playerHarnessPoint; playerHarnessPoint.Refresh(); return playerHarnessPoint; } public override bool IsInteractable() { foreach (ZippyHarness instance in ZippyHarness.Instances) { if ((Object)(object)instance != (Object)null && ((Behaviour)instance).isActiveAndEnabled && instance.PlayerCarried) { return true; } } return false; } internal bool Near(FVRViveHand hand) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((HandInput)(ref hand.Input)).Pos, Position) <= 0.08f; } internal static bool AdjustChord(FVRViveHand hand) { return hand.Input.GripPressed && hand.Input.TriggerPressed && (hand.Input.TouchpadDown || hand.Input.Secondary2AxisInputDown); } internal void BeginAdjustment(FVRViveHand hand) { hand.ForceSetInteractable((FVRInteractiveObject)(object)this); EditingHand = hand; ((FVRInteractiveObject)this).BeginInteraction(hand); Consume(hand); Refresh(); } internal void InputTick(FVRViveHand hand) { if (!hand.Input.GripPressed || !hand.Input.TriggerPressed) { FinishAdjustment(save: true); } Consume(hand); } public override void BeginInteraction(FVRViveHand hand) { ((FVRInteractiveObject)this).BeginInteraction(hand); if ((Object)(object)ZippyHarness.Carried != (Object)null) { ZippyHarness.Carried.RebaseAfterTurn(); } if (!IsAdjusting && (Object)(object)hand.Display_Controller != (Object)null) { controllerVisual = hand.Display_Controller.transform; ((Component)controllerVisual).gameObject.SetActive(false); } } internal bool ControlInput(FVRViveHand hand) { bool flag = ((FVRInteractiveObject)this).IsHeld && (Object)(object)base.m_hand == (Object)(object)hand && !IsAdjusting; if (flag && !hand.Input.GripPressed) { hand.ForceSetInteractable((FVRInteractiveObject)null); Consume(hand); return true; } bool flag2 = ((FVRInteractiveObject)this).IsInteractable() && !IsAdjusting && (flag || (!((FVRInteractiveObject)this).IsHeld && (Object)(object)hand.CurrentInteractable == (Object)null && Near(hand))); if (flag2 && !flag && hand.Input.GripPressed && (hand.Input.IsGrabDown || hand.Input.GripDown)) { hand.ForceSetInteractable((FVRInteractiveObject)(object)this); ((FVRInteractiveObject)this).BeginInteraction(hand); flag = true; } if ((Object)(object)gestureHand != (Object)null && (Object)(object)gestureHand != (Object)(object)hand) { return flag; } bool wasLocked = (Object)(object)ZippyHarness.Carried != (Object)null && ZippyHarness.Carried.EffectiveLineLocked; bool flag3 = hand.Input.TouchpadDown || hand.Input.Secondary2AxisInputDown; BeltGesture beltGesture = controls.Update(flag2, new BeltPad(hand.Input.TouchpadAxes.x, hand.Input.TouchpadAxes.y, hand.Input.TouchpadDown, hand.Input.TouchpadPressed), new BeltPad(hand.Input.Secondary2AxisInputAxes.x, hand.Input.Secondary2AxisInputAxes.y, hand.Input.Secondary2AxisInputDown, hand.Input.Secondary2AxisInputPressed)); bool flag4 = hand.Input.TouchpadPressed || hand.Input.Secondary2AxisInputPressed; gestureHand = ((!flag2 || !flag4 || (!flag3 && !((Object)(object)gestureHand == (Object)(object)hand))) ? null : hand); ZippyHarness carried = ZippyHarness.Carried; if ((Object)(object)carried != (Object)null) { switch (beltGesture) { case BeltGesture.ToggleLock: carried.ToggleLineLock(); break; case BeltGesture.ToggleSlide: carried.ToggleBrake(); break; case BeltGesture.Detach: carried.ReleaseAttachment(); break; default: carried.RopeLockOverrideChanged(wasLocked); break; } } if (flag || (flag2 && (flag3 || flag4))) { Consume(hand); return true; } return false; } private void ClearControls() { ZippyHarness carried = ZippyHarness.Carried; bool wasLocked = (Object)(object)carried != (Object)null && carried.EffectiveLineLocked; controls.Clear(); gestureHand = null; if ((Object)(object)carried != (Object)null) { carried.RopeLockOverrideChanged(wasLocked); } } internal static void Consume(FVRViveHand hand) { //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_007d: 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_0084: Unknown result type (might be due to invalid IL or missing references) hand.Input.IsGrabDown = (hand.Input.IsGrabUp = (hand.Input.TriggerDown = (hand.Input.TriggerUp = false))); hand.Input.GripDown = (hand.Input.GripUp = false); hand.Input.TouchpadDown = (hand.Input.Secondary2AxisInputDown = false); hand.Input.TouchpadAxes = (hand.Input.Secondary2AxisInputAxes = Vector2.zero); hand.Input.TouchpadNorthDown = (hand.Input.TouchpadSouthDown = (hand.Input.TouchpadEastDown = (hand.Input.TouchpadWestDown = (hand.Input.TouchpadCenterDown = false)))); hand.Input.TouchpadNorthUp = (hand.Input.TouchpadSouthUp = (hand.Input.TouchpadEastUp = (hand.Input.TouchpadWestUp = (hand.Input.TouchpadCenterUp = false)))); hand.Input.TouchpadNorthPressed = (hand.Input.TouchpadSouthPressed = (hand.Input.TouchpadEastPressed = (hand.Input.TouchpadWestPressed = (hand.Input.TouchpadCenterPressed = false)))); hand.Input.Secondary2AxisNorthDown = (hand.Input.Secondary2AxisSouthDown = (hand.Input.Secondary2AxisEastDown = (hand.Input.Secondary2AxisWestDown = (hand.Input.Secondary2AxisCenterDown = false)))); hand.Input.Secondary2AxisNorthUp = (hand.Input.Secondary2AxisSouthUp = (hand.Input.Secondary2AxisEastUp = (hand.Input.Secondary2AxisWestUp = (hand.Input.Secondary2AxisCenterUp = false)))); hand.Input.Secondary2AxisNorthPressed = (hand.Input.Secondary2AxisSouthPressed = (hand.Input.Secondary2AxisEastPressed = (hand.Input.Secondary2AxisWestPressed = (hand.Input.Secondary2AxisCenterPressed = false)))); } internal void FinishAdjustment(bool save) { //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_0031: 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_0050: 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) FVRViveHand editingHand = EditingHand; if (!((Object)(object)editingHand == (Object)null)) { if (save) { Vector3 offset = Quaternion.Inverse(FrameRotation) * (((HandInput)(ref editingHand.Input)).Pos - Body.Head.position); ((Vector3)(ref offset))..ctor(Mathf.Clamp(offset.x, -2f, 2f), Mathf.Clamp(offset.y, -2f, 2f), Mathf.Clamp(offset.z, -2f, 2f)); MrZippyPlugin.SaveHarnessOffset(offset); } EditingHand = null; if ((Object)(object)editingHand.CurrentInteractable == (Object)(object)this) { editingHand.ForceSetInteractable((FVRInteractiveObject)null); } else if ((Object)(object)base.m_hand == (Object)(object)editingHand) { ((FVRInteractiveObject)this).EndInteraction(editingHand); } } } public override void EndInteraction(FVRViveHand hand) { ClearControls(); if ((Object)(object)controllerVisual != (Object)null) { ((Component)controllerVisual).gameObject.SetActive((Object)(object)hand.CurrentInteractable == (Object)null || !GM.Options.QuickbeltOptions.HideControllerGeoWhenObjectHeld); controllerVisual = null; } EditingHand = null; ((FVRInteractiveObject)this).EndInteraction(hand); if ((Object)(object)ZippyHarness.Carried != (Object)null) { ZippyHarness.Carried.RebaseAfterTurn(); } } public void Refresh() { //IL_005d: 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) bool flag = ((FVRInteractiveObject)this).IsInteractable(); if (!flag && IsAdjusting) { FinishAdjustment(save: false); } if (!flag) { ClearControls(); if (((FVRInteractiveObject)this).IsHeld && (Object)(object)base.m_hand != (Object)null) { base.m_hand.ForceSetInteractable((FVRInteractiveObject)null); } } ((Component)this).transform.position = Position; ((Component)this).transform.rotation = FrameRotation; if ((Object)(object)visual != (Object)null) { visual.SetActive(flag); } if ((Object)(object)volume != (Object)null) { volume.enabled = flag; } ZippyHarness carried = ZippyHarness.Carried; bool flag2 = (Object)(object)carried != (Object)null && carried.State == HarnessState.Attached; if ((Object)(object)Display != (Object)null) { Display.Refresh(flag, flag2, (Object)(object)carried == (Object)null || carried.LineLocked, (Object)(object)carried != (Object)null && carried.BrakeOn, flag2 && carried.CanSlide, (Object)(object)carried != (Object)null && carried.HasLockOverride); Display.Highlight(((FVRInteractiveObject)this).IsHovered || IsAdjusting || ((FVRInteractiveObject)this).IsHeld); } } private void LateUpdate() { //IL_0070: 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) if (((FVRInteractiveObject)this).IsHeld && !IsAdjusting && (Object)(object)base.m_hand != (Object)null && ((int)base.m_hand.Mode != 0 || !base.m_hand.Input.GripPressed)) { base.m_hand.ForceSetInteractable((FVRInteractiveObject)null); } if ((Object)(object)gestureHand != (Object)null && ((int)gestureHand.Mode != 0 || (!gestureHand.Input.TouchpadPressed && !gestureHand.Input.Secondary2AxisInputPressed))) { ClearControls(); } Refresh(); if (((FVRInteractiveObject)this).IsHeld && !IsAdjusting && (Object)(object)controllerVisual != (Object)null) { ((Component)controllerVisual).gameObject.SetActive(false); } } private void OnDisable() { FinishAdjustment(save: false); if (((FVRInteractiveObject)this).IsHeld && (Object)(object)base.m_hand != (Object)null) { base.m_hand.ForceSetInteractable((FVRInteractiveObject)null); } ClearControls(); } public override void OnDestroy() { FinishAdjustment(save: false); if (((FVRInteractiveObject)this).IsHeld && (Object)(object)base.m_hand != (Object)null) { base.m_hand.ForceSetInteractable((FVRInteractiveObject)null); } ClearControls(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } ((FVRInteractiveObject)this).OnDestroy(); } } [BepInPlugin("quaternion.MrZippy", "Mr.Zippy", "0.9.3")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("nrgill28.Sodalite", "1.4.1")] public sealed class MrZippyPlugin : BaseUnityPlugin { public const string Version = "0.9.3"; private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Log; internal static ConfigEntry<float> MaximumLength; internal static ConfigEntry<float> SwingDamping; internal static ConfigEntry<float> CarabinerReach; internal static ConfigEntry<float> HookPitch; internal static ConfigEntry<float> HookYaw; internal static ConfigEntry<float> HookRoll; internal static ConfigEntry<float> HarnessX; internal static ConfigEntry<float> HarnessY; internal static ConfigEntry<float> HarnessZ; internal static ConfigEntry<float> BodyMass; internal static ConfigEntry<float> ArmMass; internal static ConfigEntry<float> ThrowTimeout; internal static ConfigEntry<float> ThrowMinimumSpeed; internal static ConfigEntry<bool> LineGrabV2; internal static ConfigEntry<bool> GunWallReaction; internal static ConfigEntry<float> MaximumHandForce; internal static ConfigEntry<float> MaximumHaulSpeed; internal static ConfigEntry<float> GrippyImpactMultiplier; private DateTime configWriteTime; private float nextConfigRead; internal static MrZippyPlugin Instance; private Harmony harmony; private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; MaximumLength = ((BaseUnityPlugin)this).Config.Bind<float>("Harness", "Maximum Rope Length", 30f, new ConfigDescription("Maximum deployable rope in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 100f), new object[0])); SwingDamping = ((BaseUnityPlugin)this).Config.Bind<float>("Harness", "Swing Damping", 0.65f, new ConfigDescription("Tangential speed damping per second. Zero disables added damping.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), new object[0])); CarabinerReach = ((BaseUnityPlugin)this).Config.Bind<float>("Interaction", "Hook Pickup Radius", 0.09f, new ConfigDescription("Trigger pickup radius about the hook body; replaces the former backpack reach setting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.025f, 0.3f), new object[0])); HookPitch = ((BaseUnityPlugin)this).Config.Bind<float>("Held Hook Pose", "Pitch", 90f, new ConfigDescription("Hook pitch relative to controller interaction pose.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), new object[0])); HookYaw = ((BaseUnityPlugin)this).Config.Bind<float>("Held Hook Pose", "Yaw", 0f, new ConfigDescription("Hook yaw relative to controller interaction pose.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), new object[0])); HookRoll = ((BaseUnityPlugin)this).Config.Bind<float>("Held Hook Pose", "Roll", 0f, new ConfigDescription("Hook roll relative to controller interaction pose.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-180f, 180f), new object[0])); HarnessX = Offset("Local X", 0.001974964f); HarnessY = Offset("Local Y", -0.4597312f); HarnessZ = Offset("Local Z", 0.1787724f); BodyMass = ((BaseUnityPlugin)this).Config.Bind<float>("Arm Momentum", "Body Mass kg", 75f, new ConfigDescription("Body mass excluding the two modeled arm masses.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 200f), new object[0])); ArmMass = ((BaseUnityPlugin)this).Config.Bind<float>("Arm Momentum", "Each Arm Mass kg", 3.5f, new ConfigDescription("Effective moving mass of each arm. Zero disables arm momentum transfer.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 8f), new object[0])); ThrowTimeout = ((BaseUnityPlugin)this).Config.Bind<float>("Throwing", "Airborne Timeout", 2f, new ConfigDescription("Seconds before an unattached thrown hook retracts.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 10f), new object[0])); ThrowMinimumSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throwing", "Minimum Throw Speed", 0.7f, new ConfigDescription("Release speed in metres per second required to throw rather than immediately retrieve.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), new object[0])); LineGrabV2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Experiments", "Line Grab V2", true, "Grip steadies the line; add trigger for a force-limited hauling and payout. Disable to restore trigger-only hauling."); MaximumHandForce = ((BaseUnityPlugin)this).Config.Bind<float>("Line Grab", "Maximum Hand Force N", 1100f, new ConfigDescription("Maximum active force from the tracked hand, in newtons. Rope catches and native recoil are separate.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(100f, 3000f), new object[0])); MaximumHaulSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Line Grab", "Maximum Haul Speed", 1.2f, new ConfigDescription("Maximum manual shortening or payout speed in metres/second.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), new object[0])); GrippyImpactMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Mr.Grippy", "Thrown Impact Multiplier", 2f, new ConfigDescription("Blunt damage and stun multiplier for deliberate throws; physical mass and throw velocity stay native.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 5f), new object[0])); GunWallReaction = ((BaseUnityPlugin)this).Config.Bind<bool>("Experiments", "Held Gun Wall Reaction", true, "While airborne and tethered, transfer real held-firearm world collision impulses into player momentum. No additional force multiplier."); harmony = new Harmony("quaternion.MrZippy"); foreach (Type item in from t in typeof(MrZippyPlugin).Assembly.GetTypes() where t.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length > 0 select t) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Installing hook: " + item.Name)); harmony.CreateClassProcessor(item).Patch(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Mr.Zippy item definitions"); LoadAssets(); ((MonoBehaviour)this).StartCoroutine(SupportShellRound.ConfigureNativeAudio()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mr.Zippy 0.9.3 loaded. Harness, Mr.Grippy and GL Support ammunition enabled."); configWriteTime = File.GetLastWriteTimeUtc(((BaseUnityPlugin)this).Config.ConfigFilePath); } private void Update() { if (Time.unscaledTime < nextConfigRead) { return; } nextConfigRead = Time.unscaledTime + 1f; DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(((BaseUnityPlugin)this).Config.ConfigFi