Decompiled source of VecelMods v1.0.0
Mods/VecelMods 5.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using SoldierSpawner; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Video; using VecelMods; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(VecelModsMelon), "Vecel Mods", "2.1.0", "vecel", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("VecelMods")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VecelMods")] [assembly: AssemblyTitle("VecelMods")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SoldierSpawner { public enum LeadLeg { Right, Left } public class FallPoseSystem { private bool _enabled = true; private MelonPreferences_Entry<bool> _enabledPref; private LeadLeg _extended; private float _strength = 25f; private float _holdSeconds = 6f; private bool _needFaceUp = true; private readonly List<Rigidbody> _bodies = new List<Rigidbody>(); private Rigidbody _pelvis; private Rigidbody _head; private Rigidbody _footPos; private Rigidbody _footNeg; private Rigidbody _kneePos; private Rigidbody _kneeNeg; private bool _posing; private float _poseTime; private float _lyingTime; private float _checkTimer; private float _refreshTimer; private float _groundY; private bool _warnedNoLegs; private readonly Instance _log; public FallPoseSystem(Instance log) { _log = log; } public void BuildMenu(Page root) { //IL_003a: 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_006f: 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_00bf: 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) MelonPreferences_Category val = MelonPreferences.CreateCategory("VecelMods_FallPose"); _enabledPref = val.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _enabled = _enabledPref.Value; root.CreateBool("Fall Pose ON / OFF", Color.green, _enabled, (Action<bool>)delegate(bool v) { //IL_003b: 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) _enabled = v; _enabledPref.Value = v; MelonPreferences.Save(); if (!v) { StopPose(); } Popup(v ? "Fall pose ON" : "Fall pose OFF", v ? Color.green : Color.red, (NotificationType)((!v) ? 1 : 3)); }); Page obj = root.CreatePage("Fall Pose Settings", Color.cyan, 0, true); obj.CreateEnum("Stretched Leg", Color.white, (Enum)_extended, (Action<Enum>)delegate(Enum v) { _extended = (LeadLeg)(object)v; }); obj.CreateInt("Pose Strength", Color.yellow, (int)_strength, 5, 5, 60, (Action<int>)delegate(int v) { _strength = v; }); obj.CreateFloat("Hold Time (s)", Color.yellow, _holdSeconds, 1f, 1f, 20f, (Action<float>)delegate(float v) { _holdSeconds = v; }); obj.CreateBool("Only When On Back", Color.white, _needFaceUp, (Action<bool>)delegate(bool v) { _needFaceUp = v; }); } public void Update() { //IL_0065: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (!_enabled) { return; } float deltaTime = Time.deltaTime; _checkTimer -= deltaTime; if (_checkTimer > 0f) { return; } _checkTimer = 0.1f; RefreshBodies(); if ((Object)(object)_pelvis == (Object)null || (Object)(object)_head == (Object)null) { StopPose(); return; } Vector3 val = _head.position - _pelvis.position; bool flag = ((Vector3)(ref val)).magnitude > 0.2f && ((Vector3)(ref val)).normalized.y < 0.45f; if (flag && _needFaceUp) { flag = IsFaceUp(); } if (flag) { _lyingTime += 0.1f; } else { _lyingTime = 0f; } if (!_posing && _lyingTime >= 0.4f) { Vector3 velocity = _pelvis.velocity; if (((Vector3)(ref velocity)).magnitude < 2.5f) { StartPose(); return; } } if (_posing && !flag) { StopPose(); } } public void FixedUpdate() { if (!_posing) { return; } if ((Object)(object)_pelvis == (Object)null || (Object)(object)_head == (Object)null) { StopPose(); return; } _poseTime += Time.fixedDeltaTime; if (_poseTime > _holdSeconds) { StopPose(); } else { ApplyPose(); } } private bool IsFaceUp() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Transform head = Player.Head; if ((Object)(object)head != (Object)null) { return Vector3.Dot(head.forward, Vector3.up) > 0.2f; } return false; } private Rigidbody GetPelvis() { try { PhysicsRig physicsRig = Player.PhysicsRig; if ((Object)(object)physicsRig != (Object)null && (Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) { return ((Component)((Rig)physicsRig).m_pelvis).GetComponent<Rigidbody>(); } } catch { } return null; } private void RefreshBodies() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) _refreshTimer -= 0.1f; if ((Object)(object)_pelvis != (Object)null && (Object)(object)_head != (Object)null && _refreshTimer > 0f) { return; } _refreshTimer = 5f; _bodies.Clear(); _pelvis = GetPelvis(); _head = null; if ((Object)(object)_pelvis == (Object)null) { return; } try { foreach (Rigidbody componentsInChild in ((Component)Player.PhysicsRig).GetComponentsInChildren<Rigidbody>()) { if (!((Object)(object)componentsInChild == (Object)null)) { _bodies.Add(componentsInChild); if (((Object)componentsInChild).name.ToLowerInvariant().Contains("head") && ((Object)(object)_head == (Object)null || componentsInChild.position.y > _head.position.y)) { _head = componentsInChild; } } } } catch { } } private bool TryGetGround(out float groundY) { //IL_0007: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_00a4: Unknown result type (might be due to invalid IL or missing references) groundY = _pelvis.position.y - 0.15f; Il2CppStructArray<RaycastHit> val = Physics.RaycastAll(_pelvis.position + Vector3.up * 0.2f, Vector3.down, 1.5f); float num = float.MaxValue; bool result = false; for (int i = 0; i < ((Il2CppArrayBase<RaycastHit>)(object)val).Length; i++) { RaycastHit val2 = ((Il2CppArrayBase<RaycastHit>)(object)val)[i]; Collider collider = ((RaycastHit)(ref val2)).collider; if ((Object)(object)collider == (Object)null || collider.isTrigger) { continue; } try { if ((Object)(object)((Component)collider).GetComponentInParent<RigManager>() != (Object)null) { continue; } } catch { } if (((RaycastHit)(ref val2)).distance < num) { num = ((RaycastHit)(ref val2)).distance; groundY = ((RaycastHit)(ref val2)).point.y; result = true; } } return result; } private void StartPose() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) Vector3 val = Flat(_head.position - _pelvis.position); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return; } Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); _footPos = (_footNeg = (_kneePos = (_kneeNeg = null))); foreach (Rigidbody body in _bodies) { if ((Object)(object)body == (Object)null || (Object)(object)body == (Object)(object)_pelvis) { continue; } string text = ((Object)body).name.ToLowerInvariant(); bool flag = text.Contains("foot") || text.Contains("ankle") || text.Contains("toe") || text.Contains("heel"); bool flag2 = !flag && (text.Contains("knee") || text.Contains("calf") || text.Contains("shin")); if (!flag && !flag2) { continue; } bool flag3 = Vector3.Dot(body.position - _pelvis.position, val2) > 0f; if (flag) { if (flag3) { if ((Object)(object)_footPos == (Object)null || body.position.y < _footPos.position.y) { _footPos = body; } } else if ((Object)(object)_footNeg == (Object)null || body.position.y < _footNeg.position.y) { _footNeg = body; } } else if (flag3) { if ((Object)(object)_kneePos == (Object)null || body.position.y > _kneePos.position.y) { _kneePos = body; } } else if ((Object)(object)_kneeNeg == (Object)null || body.position.y > _kneeNeg.position.y) { _kneeNeg = body; } } if ((Object)(object)_footPos == (Object)null || (Object)(object)_footNeg == (Object)null) { if (_warnedNoLegs) { return; } _warnedNoLegs = true; _log.Warning("Couldn't find your feet by name, so the fall pose is skipped. The rig body names are listed below."); StringBuilder stringBuilder = new StringBuilder(); foreach (Rigidbody body2 in _bodies) { if ((Object)(object)body2 != (Object)null) { stringBuilder.Append(((Object)body2).name).Append(", "); } } _log.Msg("Rig bodies: " + stringBuilder); } else { TryGetGround(out _groundY); _poseTime = 0f; _posing = true; } } private void StopPose() { _posing = false; _poseTime = 0f; _lyingTime = 0f; _footPos = (_footNeg = (_kneePos = (_kneeNeg = null))); } private static Vector3 Flat(Vector3 v) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return new Vector3(v.x, 0f, v.z); } private void ApplyPose() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0043: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Flat(_head.position - _pelvis.position); if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(Vector3.up, normalized); Vector3 position = _pelvis.position; float k = _strength * 0.4f; bool num = _extended == LeadLeg.Right; Rigidbody rb = (num ? _footPos : _footNeg); Rigidbody rb2 = (num ? _footNeg : _footPos); Rigidbody rb3 = (num ? _kneeNeg : _kneePos); float num2 = (num ? 1f : (-1f)); Vector3 target = position - normalized * 0.95f + val2 * (num2 * 0.12f); target.y = _groundY + 0.1f; Vector3 target2 = position - normalized * 0.4f - val2 * (num2 * 0.14f); target2.y = _groundY + 0.08f; Vector3 target3 = position - normalized * 0.28f - val2 * (num2 * 0.14f); target3.y = _groundY + 0.5f; Drive(rb, target, k); Drive(rb2, target2, k); Drive(rb3, target3, k); } } private void Drive(Rigidbody rb, Vector3 target, float k) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rb == (Object)null)) { Vector3 val = (target - rb.position) * k; if (((Vector3)(ref val)).magnitude > 4f) { val = ((Vector3)(ref val)).normalized * 4f; } Vector3 val2 = val + _pelvis.velocity * 0.5f; rb.velocity = Vector3.Lerp(rb.velocity, val2, 0.6f); } } private void Popup(string text, Color color, NotificationType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { Notifier.Send(new Notification { Title = new NotificationText("Fall Pose", color, true), Message = new NotificationText(text, color, true), PopupLength = 1f, ShowTitleOnPopup = true, Type = type }); } catch { } } } public enum ClipButton { LeftStick, X, Y } public class HarnessSystem { private bool _enabled = true; private MelonPreferences_Entry<bool> _enabledPref; private ClipButton _clipButton; private float _range = 60f; private float _strength = 800f; private float _slackPercent = 5f; private float _deleteWindow = 0.4f; private bool _showRope = true; private bool _leftUnclip = true; private float _leftWindow = 1.2f; private SpringJoint _joint; private Rigidbody _waist; private Rigidbody _targetRb; private Vector3 _localAnchor; private Vector3 _worldAnchor; private bool _prevClip; private bool _prevDelete; private float _lastDeleteTap = -10f; private bool _leftArmed = true; private int _leftPushes; private float _leftFirstPush; private LineRenderer _line; private bool _lineFailed; private Element _status; private readonly Instance _log; private bool _hasTarget; public HarnessSystem(Instance log) { _log = log; } public void BuildMenu(Page root) { //IL_003a: 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_0080: 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_00dc: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) MelonPreferences_Category val = MelonPreferences.CreateCategory("VecelMods_Harness"); _enabledPref = val.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _enabled = _enabledPref.Value; root.CreateBool("Harness ON / OFF", Color.green, _enabled, (Action<bool>)delegate(bool v) { //IL_003c: 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) _enabled = v; _enabledPref.Value = v; MelonPreferences.Save(); if (!v) { Unclip(notify: false); } Popup(v ? "Harness ON" : "Harness OFF", v ? Color.green : Color.red, (NotificationType)((!v) ? 1 : 3)); }); Page val2 = root.CreatePage("Harness", new Color(1f, 0.6f, 0.1f), 0, true); _status = (Element)(object)val2.CreateFunction("Clip: none", Color.gray, (Action)delegate { }); val2.CreateEnum("Clip Button", Color.white, (Enum)_clipButton, (Action<Enum>)delegate(Enum v) { _clipButton = (ClipButton)(object)v; }); val2.CreateInt("Clip Range (m)", Color.yellow, (int)_range, 10, 10, 200, (Action<int>)delegate(int v) { _range = v; }); val2.CreateInt("Rope Strength", Color.yellow, (int)_strength, 100, 100, 5000, (Action<int>)delegate(int v) { _strength = v; }); val2.CreateInt("Rope Slack %", Color.yellow, (int)_slackPercent, 5, 0, 50, (Action<int>)delegate(int v) { _slackPercent = v; }); val2.CreateFloat("Delete Window (s)", Color.yellow, _deleteWindow, 0.1f, 0.2f, 1f, (Action<float>)delegate(float v) { _deleteWindow = v; }); val2.CreateBool("Left Stick Down x3 Unclips", Color.white, _leftUnclip, (Action<bool>)delegate(bool v) { _leftUnclip = v; }); val2.CreateFloat("Triple Push Window (s)", Color.yellow, _leftWindow, 0.2f, 0.6f, 3f, (Action<float>)delegate(float v) { _leftWindow = v; }); val2.CreateBool("Show Rope", Color.white, _showRope, (Action<bool>)delegate(bool v) { _showRope = v; }); val2.CreateFunction("Remove Clip", Color.red, (Action)delegate { Unclip(notify: true); }); } public void Update() { if (!_enabled) { if ((Object)(object)_joint != (Object)null) { Unclip(notify: false); } HideRope(); return; } HandleInput(); if ((Object)(object)_joint != (Object)null) { if ((Object)(object)_joint == (Object)null || (Object)(object)_waist == (Object)null || ((Object)(object)_targetRb == (Object)null && _hasTarget)) { Unclip(notify: false); } else { UpdateRope(); } } else { HideRope(); } } private bool IsDown(BaseController c, ClipButton b) { return b switch { ClipButton.LeftStick => c.GetThumbStick(), ClipButton.X => c.GetAButton(), ClipButton.Y => c.GetBButton(), _ => false, }; } private void HandleInput() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bool flag2 = false; float num = 0f; try { BaseController leftController = Player.LeftController; BaseController rightController = Player.RightController; if ((Object)(object)leftController != (Object)null) { flag = IsDown(leftController, _clipButton); num = leftController.GetThumbStickAxis().y; } if ((Object)(object)rightController != (Object)null) { flag2 = rightController.GetThumbStick(); } } catch { return; } if (flag && !_prevClip) { TryClip(); } if (flag2 && !_prevDelete) { if (Time.time - _lastDeleteTap <= _deleteWindow) { if ((Object)(object)_joint != (Object)null) { Unclip(notify: true); } _lastDeleteTap = -10f; } else { _lastDeleteTap = Time.time; } } if (num > -0.4f) { _leftArmed = true; } if (_leftUnclip && _leftArmed && num <= -0.8f) { _leftArmed = false; if (_leftPushes == 0 || Time.time - _leftFirstPush > _leftWindow) { _leftPushes = 1; _leftFirstPush = Time.time; } else { _leftPushes++; } if (_leftPushes >= 3) { _leftPushes = 0; if ((Object)(object)_joint != (Object)null) { Unclip(notify: true); } } } _prevClip = flag; _prevDelete = flag2; } private Rigidbody GetWaistBody() { try { PhysicsRig physicsRig = Player.PhysicsRig; if ((Object)(object)physicsRig != (Object)null && (Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) { return ((Component)((Rig)physicsRig).m_pelvis).GetComponent<Rigidbody>(); } } catch { } return null; } private bool IsMine(Collider col) { try { return (Object)(object)((Component)col).GetComponentInParent<RigManager>() != (Object)null; } catch { return false; } } private void TryClip() { //IL_0011: 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_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_002c: 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_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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) Transform head = Player.Head; if ((Object)(object)head == (Object)null) { return; } Il2CppStructArray<RaycastHit> val = Physics.RaycastAll(head.position + head.forward * 0.2f, head.forward, _range); bool flag = false; RaycastHit val2 = default(RaycastHit); float num = float.MaxValue; for (int i = 0; i < ((Il2CppArrayBase<RaycastHit>)(object)val).Length; i++) { RaycastHit val3 = ((Il2CppArrayBase<RaycastHit>)(object)val)[i]; Collider collider = ((RaycastHit)(ref val3)).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && !IsMine(collider) && ((RaycastHit)(ref val3)).distance < num) { num = ((RaycastHit)(ref val3)).distance; val2 = val3; flag = true; } } if (!flag) { Popup("Nothing to clip to", Color.yellow, (NotificationType)1); return; } Rigidbody waistBody = GetWaistBody(); if ((Object)(object)waistBody == (Object)null) { _log.Warning("Couldn't find your waist body, so the harness can't attach. This needs a tweak for your game version."); return; } Unclip(notify: false); _waist = waistBody; Rigidbody attachedRigidbody = ((RaycastHit)(ref val2)).collider.attachedRigidbody; Vector3 point = ((RaycastHit)(ref val2)).point; float maxDistance = Mathf.Max(0.5f, ((RaycastHit)(ref val2)).distance * (1f + _slackPercent / 100f)); try { SpringJoint val4 = ((Component)waistBody).gameObject.AddComponent<SpringJoint>(); ((Joint)val4).autoConfigureConnectedAnchor = false; ((Joint)val4).anchor = Vector3.zero; if ((Object)(object)attachedRigidbody != (Object)null) { ((Joint)val4).connectedBody = attachedRigidbody; ((Joint)val4).connectedAnchor = ((Component)attachedRigidbody).transform.InverseTransformPoint(point); _localAnchor = ((Joint)val4).connectedAnchor; _hasTarget = true; } else { ((Joint)val4).connectedBody = null; ((Joint)val4).connectedAnchor = point; _worldAnchor = point; _hasTarget = false; } val4.minDistance = 0f; val4.maxDistance = maxDistance; val4.spring = _strength; val4.damper = _strength * 0.1f; val4.tolerance = 0.025f; ((Joint)val4).enableCollision = false; ((Joint)val4).breakForce = float.PositiveInfinity; ((Joint)val4).breakTorque = float.PositiveInfinity; _joint = val4; _targetRb = attachedRigidbody; } catch (Exception ex) { _log.Error("Couldn't create the harness clip: " + ex.Message); _joint = null; _targetRb = null; _waist = null; return; } if (_status != null) { _status.ElementName = "Clip: attached"; } Popup("Clipped", Color.green, (NotificationType)3); } private void Unclip(bool notify) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)_joint != (Object)null; try { if ((Object)(object)_joint != (Object)null) { Object.Destroy((Object)(object)_joint); } } catch { } _joint = null; _targetRb = null; _waist = null; _hasTarget = false; HideRope(); if (_status != null) { _status.ElementName = "Clip: none"; } if (notify && flag) { Popup("Clip removed", Color.white, (NotificationType)0); } } private static Shader FindShader() { string[] array = new string[4] { "Sprites/Default", "UI/Default", "Unlit/Color", "Hidden/Internal-Colored" }; for (int i = 0; i < array.Length; i++) { Shader val = Shader.Find(array[i]); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void EnsureRope() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_line != (Object)null) && !_lineFailed) { Shader val = FindShader(); if ((Object)(object)val == (Object)null) { _lineFailed = true; _log.Warning("No shader available for the harness rope on this device; the clip still works, just without a visible rope."); return; } GameObject val2 = new GameObject("VecelMods_HarnessRope"); Object.DontDestroyOnLoad((Object)(object)val2); _line = val2.AddComponent<LineRenderer>(); _line.useWorldSpace = true; _line.positionCount = 2; _line.startWidth = 0.025f; _line.endWidth = 0.025f; ((Renderer)_line).shadowCastingMode = (ShadowCastingMode)0; Material val3 = new Material(val); val3.renderQueue = 3000; Color val4 = (val3.color = Color.black); ((Renderer)_line).material = val3; _line.startColor = val4; _line.endColor = val4; } } private void HideRope() { if ((Object)(object)_line != (Object)null && ((Renderer)_line).enabled) { ((Renderer)_line).enabled = false; } } private void UpdateRope() { //IL_0054: 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_0041: 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_006c: 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) if (!_showRope) { HideRope(); return; } EnsureRope(); if (!((Object)(object)_line == (Object)null) && !((Object)(object)_waist == (Object)null)) { Vector3 val = (((Object)(object)_targetRb != (Object)null) ? ((Component)_targetRb).transform.TransformPoint(_localAnchor) : _worldAnchor); _line.SetPosition(0, _waist.position); _line.SetPosition(1, val); ((Renderer)_line).enabled = true; } } private void Popup(string text, Color color, NotificationType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { Notifier.Send(new Notification { Title = new NotificationText("Harness", color, true), Message = new NotificationText(text, color, true), PopupLength = 1f, ShowTitleOnPopup = true, Type = type }); } catch { } } } public enum LeanSide { ByButton, AlwaysRight, AlwaysLeft } public class LeanOutSystem { private bool _enabled = true; private MelonPreferences_Entry<bool> _enabledPref; private LeanSide _sideMode; private float _distance = 0.6f; private int _presses = 3; private float _window = 1f; private float _leanTime = 0.35f; private float _minMass = 250f; private bool _prevB; private bool _prevY; private int _tapsB; private int _tapsY; private float _firstB; private float _firstY; private bool _leaning; private float _amount; private Rigidbody _pelvis; private Rigidbody _chassis; private Vector3 _sideLocal; private readonly List<Rigidbody> _upper = new List<Rigidbody>(); private readonly List<float> _weights = new List<float>(); private readonly List<Vector3> _rest = new List<Vector3>(); private readonly Instance _log; public LeanOutSystem(Instance log) { _log = log; } public void BuildMenu(Page root) { //IL_003a: 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_006f: 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_00c7: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) MelonPreferences_Category val = MelonPreferences.CreateCategory("VecelMods_LeanOut"); _enabledPref = val.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _enabled = _enabledPref.Value; root.CreateBool("Lean Out ON / OFF", Color.green, _enabled, (Action<bool>)delegate(bool v) { //IL_0043: 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) _enabled = v; _enabledPref.Value = v; MelonPreferences.Save(); if (!v && _leaning) { StopLean(); } Popup(v ? "Lean out ON" : "Lean out OFF", v ? Color.green : Color.red, (NotificationType)((!v) ? 1 : 3)); }); Page obj = root.CreatePage("Lean Out Settings", Color.cyan, 0, true); obj.CreateEnum("Which Side", Color.white, (Enum)_sideMode, (Action<Enum>)delegate(Enum v) { _sideMode = (LeanSide)(object)v; }); obj.CreateInt("Lean Distance (cm)", Color.yellow, (int)(_distance * 100f), 10, 20, 120, (Action<int>)delegate(int v) { _distance = (float)v / 100f; }); obj.CreateInt("Presses Needed", Color.yellow, _presses, 1, 2, 5, (Action<int>)delegate(int v) { _presses = v; }); obj.CreateFloat("Press Window (s)", Color.yellow, _window, 0.1f, 0.5f, 2f, (Action<float>)delegate(float v) { _window = v; }); obj.CreateFloat("Lean Time (s)", Color.yellow, _leanTime, 0.05f, 0.1f, 1f, (Action<float>)delegate(float v) { _leanTime = v; }); obj.CreateInt("Min Vehicle Mass (kg)", Color.yellow, (int)_minMass, 50, 50, 2000, (Action<int>)delegate(int v) { _minMass = v; }); } private bool Tap(bool now, ref bool prev, ref int taps, ref float first) { bool result = false; if (now && !prev) { if (taps == 0 || Time.time - first > _window) { taps = 1; first = Time.time; } else { taps++; } if (taps >= _presses) { taps = 0; result = true; } } prev = now; return result; } public void Update() { if (!_enabled) { return; } bool now = false; bool now2 = false; try { BaseController rightController = Player.RightController; BaseController leftController = Player.LeftController; if ((Object)(object)rightController != (Object)null) { now = rightController.GetBButton(); } if ((Object)(object)leftController != (Object)null) { now2 = leftController.GetBButton(); } } catch { return; } bool flag = Tap(now, ref _prevB, ref _tapsB, ref _firstB); bool flag2 = Tap(now2, ref _prevY, ref _tapsY, ref _firstY); if (flag || flag2) { if (_leaning) { StopLean(); return; } float sign = ((_sideMode == LeanSide.AlwaysRight) ? 1f : ((_sideMode == LeanSide.AlwaysLeft) ? (-1f) : (flag ? 1f : (-1f)))); StartLean(sign); } } private Rigidbody GetPelvis() { try { PhysicsRig physicsRig = Player.PhysicsRig; if ((Object)(object)physicsRig != (Object)null && (Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) { return ((Component)((Rig)physicsRig).m_pelvis).GetComponent<Rigidbody>(); } } catch { } return null; } private bool IsMine(Collider c) { try { return (Object)(object)((Component)c).GetComponentInParent<RigManager>() != (Object)null; } catch { return false; } } private Rigidbody FindVehicleAround(Rigidbody pelvis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(pelvis.position, 3f); Transform val2 = null; float num = float.MaxValue; for (int i = 0; i < ((Il2CppArrayBase<Collider>)(object)val).Length; i++) { Collider val3 = ((Il2CppArrayBase<Collider>)(object)val)[i]; if ((Object)(object)val3 == (Object)null || val3.isTrigger || IsMine(val3)) { continue; } Rigidbody attachedRigidbody = val3.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null) { continue; } Transform root = ((Component)attachedRigidbody).transform.root; string input = Regex.Replace(((Object)root).name.ToLowerInvariant(), "[^a-z]+", " "); if (LockOnSystem.VehicleRegex.IsMatch(input) || attachedRigidbody.mass >= _minMass) { Vector3 val4 = attachedRigidbody.worldCenterOfMass - pelvis.position; float sqrMagnitude = ((Vector3)(ref val4)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val2 = root; } } } if ((Object)(object)val2 == (Object)null) { return null; } Rigidbody val5 = null; foreach (Rigidbody componentsInChild in ((Component)val2).GetComponentsInChildren<Rigidbody>()) { if ((Object)(object)componentsInChild != (Object)null && ((Object)(object)val5 == (Object)null || componentsInChild.mass > val5.mass)) { val5 = componentsInChild; } } if ((Object)(object)val5 == (Object)null) { return null; } Bounds val6 = default(Bounds); bool flag = true; foreach (Collider componentsInChild2 in ((Component)val2).GetComponentsInChildren<Collider>()) { if (!((Object)(object)componentsInChild2 == (Object)null) && !componentsInChild2.isTrigger) { if (flag) { val6 = componentsInChild2.bounds; flag = false; } else { ((Bounds)(ref val6)).Encapsulate(componentsInChild2.bounds); } } } if (flag) { return null; } ((Bounds)(ref val6)).Expand(0.4f); if (!((Bounds)(ref val6)).Contains(pelvis.position)) { return null; } return val5; } private void StartLean(float sign) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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) Rigidbody pelvis = GetPelvis(); if ((Object)(object)pelvis == (Object)null) { _log.Warning("Couldn't find your pelvis body, so leaning out can't start. This needs a tweak for your game version."); return; } Rigidbody val = FindVehicleAround(pelvis); if ((Object)(object)val == (Object)null) { Popup("Get in a vehicle first", Color.yellow, (NotificationType)1); return; } _upper.Clear(); _weights.Clear(); _rest.Clear(); try { foreach (Rigidbody componentsInChild in ((Component)Player.PhysicsRig).GetComponentsInChildren<Rigidbody>()) { if (!((Object)(object)componentsInChild == (Object)null) && !((Object)(object)componentsInChild == (Object)(object)pelvis)) { string text = ((Object)componentsInChild).name.ToLowerInvariant(); float num = 0f; if (text.Contains("head")) { num = 1f; } else if (text.Contains("neck")) { num = 0.9f; } else if (text.Contains("shoulder") || text.Contains("clavicle")) { num = 0.7f; } else if (text.Contains("chest") || text.Contains("spine") || text.Contains("torso")) { num = 0.6f; } if (!(num <= 0f)) { _upper.Add(componentsInChild); _weights.Add(num); _rest.Add(((Component)val).transform.InverseTransformVector(componentsInChild.position - pelvis.position)); } } } } catch { } if (_upper.Count == 0) { _log.Warning("Couldn't find your head/chest bodies by name, so leaning out is skipped."); return; } Transform head = Player.Head; if (!((Object)(object)head == (Object)null)) { Vector3 val2 = Vector3.ProjectOnPlane(head.right, Vector3.up); Vector3 val3 = ((Vector3)(ref val2)).normalized * sign; _sideLocal = ((Component)val).transform.InverseTransformDirection(val3); _pelvis = pelvis; _chassis = val; _leaning = true; } } private void StopLean() { _leaning = false; } public void FixedUpdate() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if (_upper.Count == 0) { return; } float num = (_leaning ? 1f : 0f); _amount = Mathf.MoveTowards(_amount, num, Time.fixedDeltaTime / Mathf.Max(0.05f, _leanTime)); if ((Object)(object)_pelvis == (Object)null || (Object)(object)_chassis == (Object)null) { _leaning = false; _amount = 0f; _upper.Clear(); return; } if (_leaning) { Vector3 val = _pelvis.position - _chassis.worldCenterOfMass; if (((Vector3)(ref val)).magnitude > 4f) { _leaning = false; } } if (!_leaning && _amount <= 0f) { _upper.Clear(); _weights.Clear(); _rest.Clear(); return; } Transform transform = ((Component)_chassis).transform; Vector3 val2 = transform.TransformDirection(_sideLocal); val2.y = 0f; ((Vector3)(ref val2)).Normalize(); Vector3 position = _pelvis.position; Vector3 velocity = _chassis.velocity; for (int i = 0; i < _upper.Count; i++) { Rigidbody val3 = _upper[i]; if (!((Object)(object)val3 == (Object)null)) { float num2 = _weights[i]; Vector3 val4 = (position + transform.TransformVector(_rest[i]) + val2 * (_distance * _amount * num2) + Vector3.down * (0.12f * _amount * num2) - val3.position) * 10f; if (((Vector3)(ref val4)).magnitude > 4f) { val4 = ((Vector3)(ref val4)).normalized * 4f; } val3.velocity = Vector3.Lerp(val3.velocity, val4 + velocity, 0.6f); } } } private void Popup(string text, Color color, NotificationType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { Notifier.Send(new Notification { Title = new NotificationText("Lean Out", color, true), Message = new NotificationText(text, color, true), PopupLength = 1f, ShowTitleOnPopup = true, Type = type }); } catch { } } } public class LoadingScreenVideo { private readonly Instance _log; private bool _enabled; private MelonPreferences_Entry<bool> _enabledPref; private MelonPreferences_Entry<string> _urlPref; private int _volume = 80; private GameObject _root; private VideoPlayer _vp; private Element _status; public LoadingScreenVideo(Instance log) { _log = log; } public void BuildMenu(Page root) { //IL_005a: 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_0092: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) MelonPreferences_Category val = MelonPreferences.CreateCategory("VecelMods_LoadingVideo"); _enabledPref = val.CreateEntry<bool>("Enabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _urlPref = val.CreateEntry<string>("VideoUrl", "", (string)null, "Direct link to an .mp4 file.", false, false, (ValueValidator)null, (string)null); _enabled = _enabledPref.Value; root.CreateBool("Loading Video ON / OFF", Color.magenta, _enabled, (Action<bool>)delegate(bool v) { //IL_003b: 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) _enabled = v; _enabledPref.Value = v; MelonPreferences.Save(); if (!v) { Stop(); } Popup(v ? "Loading video ON" : "Loading video OFF", v ? Color.green : Color.red, (NotificationType)((!v) ? 1 : 3)); }); Page val2 = root.CreatePage("Loading Video", Color.magenta, 0, true); _status = (Element)(object)val2.CreateFunction(StatusText(), Color.gray, (Action)delegate { }); val2.CreateFunction("Use Clipboard Link", Color.green, (Action)UseClipboard); val2.CreateFunction("Clear Link", Color.red, (Action)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) _urlPref.Value = ""; MelonPreferences.Save(); RefreshStatus(); Popup("Link cleared", Color.white, (NotificationType)0); }); val2.CreateInt("Volume %", Color.yellow, _volume, 10, 0, 100, (Action<int>)delegate(int v) { _volume = v; }); val2.CreateFunction("Test Play", Color.cyan, (Action)delegate { Play(); }); val2.CreateFunction("Stop", Color.red, (Action)Stop); Hooking.OnLevelLoaded += OnLevel; } private string StatusText() { string text = _urlPref.Value ?? ""; if (text.Length == 0) { return "Link: none"; } return "Link: " + ((text.Length > 28) ? (text.Substring(0, 28) + "...") : text); } private void RefreshStatus() { if (_status != null) { _status.ElementName = StatusText(); } } private void UseClipboard() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) string text = ""; try { text = (GUIUtility.systemCopyBuffer ?? "").Trim(); } catch { } if (!text.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { Popup("Your clipboard has no link", Color.yellow, (NotificationType)1); return; } _urlPref.Value = text; MelonPreferences.Save(); RefreshStatus(); if (!text.ToLowerInvariant().Contains(".mp4")) { Popup("Saved, but it should be a direct .mp4 link", Color.yellow, (NotificationType)1); } else { Popup("Link saved", Color.green, (NotificationType)3); } } private void OnLevel(LevelInfo info) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) string text = ""; try { text = (info.title + " " + info.barcode).ToLowerInvariant(); } catch { } if (_enabled && text.Contains("loading")) { Play(); } else { Stop(); } } public void Play() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown string value = _urlPref.Value; if (string.IsNullOrWhiteSpace(value)) { Popup("Set a video link first", Color.yellow, (NotificationType)1); return; } Transform head = Player.Head; if ((Object)(object)head == (Object)null) { return; } Stop(); try { _root = new GameObject("VecelMods_LoadingVideo"); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)5); Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } obj.transform.SetParent(_root.transform, false); obj.transform.localScale = new Vector3(4.6f, 2.6f, 1f); Vector3 val = Vector3.ProjectOnPlane(head.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); _root.transform.position = head.position + val * 1.6f; _root.transform.rotation = Quaternion.LookRotation(val, Vector3.up); Shader val2 = Shader.Find("Unlit/Texture"); if ((Object)(object)val2 == (Object)null) { val2 = Shader.Find("Sprites/Default"); } Renderer component2 = obj.GetComponent<Renderer>(); Material val3 = new Material(val2); val3.renderQueue = 5000; component2.material = val3; AudioSource val4 = _root.AddComponent<AudioSource>(); val4.spatialBlend = 0f; val4.volume = (float)_volume / 100f; val4.playOnAwake = false; _vp = _root.AddComponent<VideoPlayer>(); _vp.playOnAwake = false; _vp.source = (VideoSource)1; _vp.url = value; _vp.isLooping = true; _vp.renderMode = (VideoRenderMode)3; _vp.targetMaterialRenderer = component2; _vp.targetMaterialProperty = "_MainTex"; _vp.audioOutputMode = (VideoAudioOutputMode)1; _vp.controlledAudioTrackCount = 1; _vp.SetTargetAudioSource((ushort)0, val4); _vp.Play(); } catch (Exception ex) { _log.Warning("Couldn't play the loading video: " + ex.Message); Stop(); } } public void Stop() { try { if ((Object)(object)_vp != (Object)null) { _vp.Stop(); } if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } } catch { } _vp = null; _root = null; } private void Popup(string text, Color color, NotificationType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { Notifier.Send(new Notification { Title = new NotificationText("Loading Video", color, true), Message = new NotificationText(text, color, true), PopupLength = 1.5f, ShowTitleOnPopup = true, Type = type }); } catch { } } } public enum NvMode { Green, Thermal } public enum GoggleTubes { One, Two, Four, Eight } public class NightVisionSystem { private class Warm { public Rigidbody Rb; public float Size; public Color Col; } private bool _nvOn; private NvMode _mode; private GoggleTubes _tubes = GoggleTubes.Two; private int _brightness = 200; private bool _illum = true; private float _heatRange = 60f; private bool _irLasers; private bool _gesture = true; private float _reach = 0.17f; private bool _prevGripL; private bool _prevGripR; private float _gestureCooldown; private object _onElement; private bool _syncing; private MethodInfo _gripMethod; private bool _gripLooked; private GameObject _quad; private Material _mat; private Texture2D _tex; private int _texKey = -1; private bool _savedAmbient; private float _origIntensity; private Color _origAmbient; private Light _light; private const int MaxBlobs = 40; private readonly List<Warm> _warm = new List<Warm>(); private readonly List<GameObject> _blobs = new List<GameObject>(); private readonly List<Material> _blobMats = new List<Material>(); private float _heatScan; private readonly List<Renderer> _lasers = new List<Renderer>(); private readonly HashSet<Renderer> _hiddenByUs = new HashSet<Renderer>(); private float _laserScan; private readonly Instance _log; public NightVisionSystem(Instance log) { _log = log; } public void BuildMenu(Page gear) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0091: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) Page val = gear.CreatePage("Night Vision", Color.green, 0, true); _onElement = val.CreateBool("Night Vision ON / OFF", Color.green, _nvOn, (Action<bool>)delegate(bool v) { if (!_syncing) { SetOn(v); } }); val.CreateEnum("Vision: Green / Thermal", Color.white, (Enum)_mode, (Action<Enum>)delegate(Enum v) { _mode = (NvMode)(object)v; Refresh(); }); val.CreateEnum("Goggle Tubes: 1 / 2 / 4 / 8", Color.white, (Enum)_tubes, (Action<Enum>)delegate(Enum v) { _tubes = (GoggleTubes)(object)v; Refresh(); }); val.CreateInt("Brightness %", Color.yellow, _brightness, 25, 100, 400, (Action<int>)delegate(int v) { _brightness = v; if (_nvOn) { ApplyBrightness(on: true); } }); val.CreateBool("IR Illuminator Light", Color.white, _illum, (Action<bool>)delegate(bool v) { _illum = v; }); val.CreateInt("Thermal Range (m)", Color.yellow, (int)_heatRange, 10, 20, 150, (Action<int>)delegate(int v) { _heatRange = v; }); val.CreateBool("IR Lasers (only seen in goggles)", Color.red, _irLasers, (Action<bool>)SetIrLasers); val.CreateBool("Head Gesture Toggle", Color.white, _gesture, (Action<bool>)delegate(bool v) { _gesture = v; }); val.CreateInt("Gesture Reach (cm)", Color.yellow, (int)(_reach * 100f), 1, 8, 35, (Action<int>)delegate(int v) { _reach = (float)v / 100f; }); Hooking.OnLevelLoaded += OnLevel; } public void Dispose() { Hooking.OnLevelLoaded -= OnLevel; RestoreLasers(); _irLasers = false; if (_nvOn) { _nvOn = false; if ((Object)(object)_quad != (Object)null) { _quad.SetActive(false); } ApplyBrightness(on: false); if ((Object)(object)_light != (Object)null) { ((Behaviour)_light).enabled = false; } HideHeat(); } } private void OnLevel(LevelInfo info) { _savedAmbient = false; if (_nvOn) { ApplyBrightness(on: true); } } private void SetOn(bool on) { //IL_0074: 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) _nvOn = on; if (on) { EnsureOverlay(); ApplyBrightness(on: true); } else { if ((Object)(object)_quad != (Object)null) { _quad.SetActive(false); } ApplyBrightness(on: false); if ((Object)(object)_light != (Object)null) { ((Behaviour)_light).enabled = false; } HideHeat(); } Popup(on ? "Night vision ON" : "Night vision OFF", on ? Color.green : Color.red, (NotificationType)((!on) ? 1 : 3)); } private void Refresh() { if (_nvOn) { EnsureOverlay(); } } private void SetIrLasers(bool on) { //IL_002a: 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) _irLasers = on; if (!on) { RestoreLasers(); } Popup(on ? "IR lasers ON (visible only in night vision)" : "IR lasers OFF", on ? Color.green : Color.white, (NotificationType)0); } public void LateUpdate() { float deltaTime = Time.deltaTime; PollGesture(deltaTime); if (_nvOn) { Transform head = Player.Head; if ((Object)(object)head != (Object)null) { PlaceOverlay(head); UpdateLight(head); if (_mode == NvMode.Thermal) { UpdateHeat(head, deltaTime); } else { HideHeat(); } } } if (_irLasers) { UpdateLasers(deltaTime); } } private void PollGesture(float dt) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00dc: 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_00f3: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!_gesture) { return; } _gestureCooldown -= dt; Transform head = Player.Head; if (!((Object)(object)head == (Object)null)) { Vector3 val = head.position + head.up * 0.13f - head.forward * 0.04f; bool flag; bool flag2; Vector3 position; Vector3 position2; try { flag = ReadGrip(Player.LeftController); flag2 = ReadGrip(Player.RightController); position = ((Component)Player.LeftHand).transform.position; position2 = ((Component)Player.RightHand).transform.position; } catch { return; } bool flag3 = flag && !_prevGripL; bool flag4 = flag2 && !_prevGripR; _prevGripL = flag; _prevGripR = flag2; float num = _reach * _reach; Vector3 val2 = position - val; bool flag5 = ((Vector3)(ref val2)).sqrMagnitude <= num; val2 = position2 - val; bool flag6 = ((Vector3)(ref val2)).sqrMagnitude <= num; if (_gestureCooldown <= 0f && ((flag3 && flag5) || (flag4 && flag6))) { _gestureCooldown = 0.6f; SetOn(!_nvOn); SyncMenu(); } } } private bool ReadGrip(BaseController c) { if ((Object)(object)c == (Object)null) { return false; } if (!_gripLooked) { _gripLooked = true; string[] array = new string[3] { "GetGrabbedButton", "GetGripButton", "GetSecondaryInteractionButton" }; foreach (string name in array) { MethodInfo method = ((object)c).GetType().GetMethod(name, Type.EmptyTypes); if (method != null && method.ReturnType == typeof(bool)) { _gripMethod = method; break; } } if (_gripMethod != null) { _log.Msg("Night vision gesture is using " + _gripMethod.Name + " for the side trigger."); } else { StringBuilder stringBuilder = new StringBuilder(); MethodInfo[] methods = ((object)c).GetType().GetMethods(); foreach (MethodInfo methodInfo in methods) { string text = methodInfo.Name.ToLowerInvariant(); if (text.Contains("grab") || text.Contains("grip") || text.Contains("interaction")) { stringBuilder.Append(methodInfo.Name).Append(", "); } } _log.Warning("Couldn't find the side trigger button, so the head gesture is off. Controller methods that might match: " + stringBuilder); } } if (_gripMethod == null) { return false; } try { return (bool)_gripMethod.Invoke(c, null); } catch { return false; } } private void SyncMenu() { if (_onElement == null) { return; } try { PropertyInfo property = _onElement.GetType().GetProperty("Value"); if (property != null && property.CanWrite) { _syncing = true; property.SetValue(_onElement, _nvOn); _syncing = false; } } catch { _syncing = false; } } private void EnsureOverlay() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_quad == (Object)null) { Shader val = Shader.Find("UI/Default"); bool flag = (Object)(object)val != (Object)null; if ((Object)(object)val == (Object)null) { val = FireEffects.GetShader(); } if ((Object)(object)val == (Object)null) { _log.Warning("No shader available for night vision on this device."); return; } _quad = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_quad).name = "VecelMods_NightVision"; Collider component = _quad.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Object.DontDestroyOnLoad((Object)(object)_quad); _mat = new Material(val); _mat.renderQueue = 5000; if (flag) { _mat.SetInt("unity_GUIZTestMode", 8); } _quad.GetComponent<Renderer>().material = _mat; _quad.transform.localScale = new Vector3(6f, 6f, 1f); } int num = (int)((int)_mode * 10 + _tubes); if (num != _texKey) { if ((Object)(object)_tex != (Object)null) { Object.Destroy((Object)(object)_tex); } _tex = BuildTexture(_mode, _tubes); _texKey = num; _mat.mainTexture = (Texture)(object)_tex; } _quad.SetActive(true); } private void PlaceOverlay(Transform head) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_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) if (!((Object)(object)_quad == (Object)null)) { _quad.transform.position = head.position + head.forward * 1.5f; _quad.transform.rotation = Quaternion.LookRotation(head.forward, head.up); } } private static Texture2D BuildTexture(NvMode mode, GoggleTubes tubes) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_008f: 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_00a5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) Vector2[] array; float num; switch (tubes) { case GoggleTubes.One: array = (Vector2[])(object)new Vector2[1] { new Vector2(0.5f, 0.5f) }; num = 0.36f; break; case GoggleTubes.Two: array = (Vector2[])(object)new Vector2[2] { new Vector2(0.34f, 0.5f), new Vector2(0.66f, 0.5f) }; num = 0.22f; break; case GoggleTubes.Four: array = (Vector2[])(object)new Vector2[4] { new Vector2(0.2f, 0.5f), new Vector2(0.4f, 0.5f), new Vector2(0.6f, 0.5f), new Vector2(0.8f, 0.5f) }; num = 0.1f; break; default: array = (Vector2[])(object)new Vector2[8] { new Vector2(0.2f, 0.38f), new Vector2(0.4f, 0.38f), new Vector2(0.6f, 0.38f), new Vector2(0.8f, 0.38f), new Vector2(0.2f, 0.62f), new Vector2(0.4f, 0.62f), new Vector2(0.6f, 0.62f), new Vector2(0.8f, 0.62f) }; num = 0.095f; break; } Color val = ((mode == NvMode.Green) ? new Color(0.05f, 0.95f, 0.15f, 0.38f) : new Color(0.1f, 0.1f, 0.12f, 0.5f)); Color val2 = default(Color); ((Color)(ref val2))..ctor(0f, 0f, 0f, 1f); Color[] array2 = (Color[])(object)new Color[262144]; Color val3 = default(Color); for (int i = 0; i < 512; i++) { for (int j = 0; j < 512; j++) { float num2 = ((float)j + 0.5f) / 512f; float num3 = ((float)i + 0.5f) / 512f; float num4 = float.MaxValue; for (int k = 0; k < array.Length; k++) { float num5 = Vector2.Distance(new Vector2(num2, num3), array[k]) / num; if (num5 < num4) { num4 = num5; } } if (num4 >= 1f) { val3 = val2; } else { ((Color)(ref val3))..ctor(val.r, val.g, val.b, val.a + 0.35f * num4 * num4); if (num4 > 0.94f) { val3 = Color.Lerp(val3, val2, Mathf.InverseLerp(0.94f, 1f, num4)); } } array2[i * 512 + j] = val3; } } Texture2D val4 = new Texture2D(512, 512, (TextureFormat)4, false); val4.SetPixels(Il2CppStructArray<Color>.op_Implicit(array2)); ((Texture)val4).wrapMode = (TextureWrapMode)1; ((Texture)val4).filterMode = (FilterMode)1; val4.Apply(); return val4; } private void ApplyBrightness(bool on) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) try { if (on) { if (!_savedAmbient) { _origIntensity = RenderSettings.ambientIntensity; _origAmbient = RenderSettings.ambientLight; _savedAmbient = true; } float num = (float)_brightness / 100f; RenderSettings.ambientIntensity = _origIntensity * num; RenderSettings.ambientLight = Color.Lerp(_origAmbient, Color.white, Mathf.Clamp01(((float)_brightness - 100f) / 300f)); } else if (_savedAmbient) { RenderSettings.ambientIntensity = _origIntensity; RenderSettings.ambientLight = _origAmbient; _savedAmbient = false; } } catch { } } private void UpdateLight(Transform head) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) if ((Object)(object)_light == (Object)null) { GameObject val = new GameObject("VecelMods_NVLight"); Object.DontDestroyOnLoad((Object)(object)val); _light = val.AddComponent<Light>(); _light.type = (LightType)2; _light.range = 25f; _light.color = new Color(0.7f, 1f, 0.75f); _light.shadows = (LightShadows)0; } ((Behaviour)_light).enabled = _illum && _mode == NvMode.Green; _light.intensity = 1f * ((float)_brightness / 100f); ((Component)_light).transform.position = head.position + head.forward * 0.2f; } private static bool IsMine(Collider c) { try { return (Object)(object)((Component)c).GetComponentInParent<RigManager>() != (Object)null; } catch { return false; } } private void UpdateHeat(Transform head, float dt) { //IL_008c: 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_00be: Unknown result type (might be due to invalid IL or missing references) _heatScan -= dt; if (_heatScan <= 0f) { _heatScan = 0.5f; ScanHeat(head); } for (int i = 0; i < _warm.Count; i++) { if (i >= _blobs.Count) { MakeBlob(); } Warm warm = _warm[i]; GameObject val = _blobs[i]; if ((Object)(object)warm.Rb == (Object)null) { val.SetActive(false); continue; } val.SetActive(true); val.transform.position = warm.Rb.worldCenterOfMass; val.transform.localScale = Vector3.one * warm.Size; _blobMats[i].color = warm.Col; } for (int j = _warm.Count; j < _blobs.Count; j++) { _blobs[j].SetActive(false); } } private void ScanHeat(Transform head) { //IL_000c: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) _warm.Clear(); Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(head.position, _heatRange); HashSet<int> hashSet = new HashSet<int>(); for (int i = 0; i < ((Il2CppArrayBase<Collider>)(object)val).Length; i++) { if (_warm.Count >= 40) { break; } Collider val2 = ((Il2CppArrayBase<Collider>)(object)val)[i]; if ((Object)(object)val2 == (Object)null) { continue; } Rigidbody attachedRigidbody = val2.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && hashSet.Add(((Object)attachedRigidbody).GetInstanceID()) && !IsMine(val2)) { string text = ((Object)attachedRigidbody).name.ToLowerInvariant(); Transform root = ((Component)attachedRigidbody).transform.root; string input = Regex.Replace(((Object)root).name.ToLowerInvariant(), "[^a-z]+", " "); if (FireEffects.IsBurning(((Component)root).gameObject)) { _warm.Add(new Warm { Rb = attachedRigidbody, Size = 1.6f, Col = new Color(1f, 1f, 0.9f, 0.9f) }); } else if (text.Contains("head")) { _warm.Add(new Warm { Rb = attachedRigidbody, Size = 0.25f, Col = new Color(1f, 1f, 0.9f, 0.95f) }); } else if (text.Contains("chest") || text.Contains("spine") || text.Contains("torso")) { _warm.Add(new Warm { Rb = attachedRigidbody, Size = 0.4f, Col = new Color(1f, 0.95f, 0.75f, 0.9f) }); } else if (text.Contains("pelvis")) { _warm.Add(new Warm { Rb = attachedRigidbody, Size = 0.3f, Col = new Color(1f, 0.6f, 0.2f, 0.85f) }); } else if (LockOnSystem.VehicleRegex.IsMatch(input) && attachedRigidbody.mass >= 150f) { _warm.Add(new Warm { Rb = attachedRigidbody, Size = 1f, Col = new Color(1f, 0.55f, 0.15f, 0.7f) }); } } } } private void MakeBlob() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown Shader val = Shader.Find("UI/Default"); bool flag = (Object)(object)val != (Object)null; if ((Object)(object)val == (Object)null) { val = FireEffects.GetShader(); } GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val2).name = "VecelMods_HeatGlow"; Collider component = val2.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Object.DontDestroyOnLoad((Object)(object)val2); Material val3 = new Material(val); val3.renderQueue = 4999; if (flag) { val3.SetInt("unity_GUIZTestMode", 8); } val2.GetComponent<Renderer>().material = val3; _blobs.Add(val2); _blobMats.Add(val3); } private void HideHeat() { foreach (GameObject blob in _blobs) { if ((Object)(object)blob != (Object)null) { blob.SetActive(false); } } } private void ScanLasers() { _lasers.Clear(); try { foreach (Gun item in Object.FindObjectsOfType<Gun>()) { if ((Object)(object)item == (Object)null) { continue; } foreach (Renderer componentsInChild in ((Component)item).GetComponentsInChildren<Renderer>(true)) { if ((Object)(object)componentsInChild != (Object)null && LooksLikeLaser(componentsInChild)) { _lasers.Add(componentsInChild); } } } foreach (LineRenderer item2 in Object.FindObjectsOfType<LineRenderer>()) { if ((Object)(object)item2 != (Object)null && LooksLikeLaser((Renderer)(object)item2) && !_lasers.Contains((Renderer)(object)item2)) { _lasers.Add((Renderer)(object)item2); } } } catch { } } private static bool LooksLikeLaser(Renderer r) { string text = ((Object)((Component)r).gameObject).name.ToLowerInvariant(); if (text.StartsWith("vecelmods_")) { return false; } return text.Contains("laser"); } private void UpdateLasers(float dt) { _laserScan -= dt; if (_laserScan <= 0f) { _laserScan = 1.5f; ScanLasers(); } foreach (Renderer laser in _lasers) { if ((Object)(object)laser == (Object)null) { continue; } if (_nvOn) { if (_hiddenByUs.Contains(laser) && ((Component)laser).gameObject.activeInHierarchy) { laser.enabled = true; _hiddenByUs.Remove(laser); } } else if (laser.enabled) { laser.enabled = false; _hiddenByUs.Add(laser); } } } private void RestoreLasers() { foreach (Renderer hiddenByU in _hiddenByUs) { if ((Object)(object)hiddenByU != (Object)null) { hiddenByU.enabled = true; } } _hiddenByUs.Clear(); } private void Popup(string text, Color color, NotificationType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { Notifier.Send(new Notification { Title = new NotificationText("Night Vision", color, true), Message = new NotificationText(text, color, true), PopupLength = 1.5f, ShowTitleOnPopup = true, Type = type }); } catch { } } } } namespace VecelMods { public enum PlaceButton { X, Y, A, MenuOnly } public class BreachingChargeSystem { private class Charge { public GameObject Root; public GameObject Led; public Rigidbody Target; public Vector3 PushDir; public readonly List<Material> Mats = new List<Material>(); } private bool _enabled = true; private MelonPreferences_Entry<bool> _enabledPref; private PlaceButton _placeButton; private int _tapsNeeded = 3; private float _window = 1f; private float _range = 3f; private int _maxCharges = 4; private float _radius = 5f; private float _force = 900f; private float _doorForce = 2500f; private readonly List<Charge> _charges = new List<Charge>(); private bool _prevPlace; private bool _prevStick; private int _taps; private float _firstTap; private AudioClip[] _beeps; private readonly Instance _log; public BreachingChargeSystem(Instance log) { _log = log; } public void BuildMenu(Page gear) { //IL_003a: 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_006f: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) MelonPreferences_Category val = MelonPreferences.CreateCategory("VecelMods_Breach"); _enabledPref = val.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _enabled = _enabledPref.Value; gear.CreateBool("Breaching Charge ON / OFF", Color.green, _enabled, (Action<bool>)delegate(bool v) { //IL_003b: 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) _enabled = v; _enabledPref.Value = v; MelonPreferences.Save(); if (!v) { RemoveAll(); } Popup(v ? "Breaching charge ON" : "Breaching charge OFF", v ? Color.green : Color.red, (NotificationType)((!v) ? 1 : 3)); }); Page obj = gear.CreatePage("Breaching Charge", Color.red, 0, true); obj.CreateEnum("Place Button", Color.white, (Enum)_placeButton, (Action<Enum>)delegate(Enum v) { _placeButton = (PlaceButton)(object)v; }); obj.CreateFunction("Place Charge (where I'm looking)", Color.green, (Action)PlaceCharge); obj.CreateFunction("Detonate All Now", Color.red, (Action)DetonateAll); obj.CreateFunction("Remove All Charges", Color.gray, (Action)RemoveAll); obj.CreateInt("Taps To Detonate", Color.yellow, _tapsNeeded, 1, 2, 5, (Action<int>)delegate(int v) { _tapsNeeded = v; }); obj.CreateFloat("Tap Window (s)", Color.yellow, _window, 0.1f, 0.5f, 2f, (Action<float>)delegate(float v) { _window = v; }); obj.CreateInt("Place Range (m)", Color.yellow, (int)_range, 1, 1, 10, (Action<int>)delegate(int v) { _range = v; }); obj.CreateInt("Max Charges", Color.yellow, _maxCharges, 1, 1, 10, (Action<int>)delegate(int v) { _maxCharges = v; }); obj.CreateInt("Blast Radius (m)", Color.yellow, (int)_radius, 1, 2, 12, (Action<int>)delegate(int v) { _radius = v; }); obj.CreateInt("Blast Force", Color.yellow, (int)_force, 100, 100, 3000, (Action<int>)delegate(int v) { _force = v; }); obj.CreateInt("Door Push Force", Color.yellow, (int)_doorForce, 250, 0, 6000, (Action<int>)delegate(int v) { _doorForce = v; }); } public void Update() { if (!_enabled) { return; } bool active = Mathf.Repeat(Time.time, 1f) < 0.2f; for (int num = _charges.Count - 1; num >= 0; num--) { Charge charge = _charges[num]; if ((Object)(object)charge.Root == (Object)null) { _charges.RemoveAt(num); } else if ((Object)(object)charge.Led != (Object)null) { charge.Led.SetActive(active); } } bool flag = false; bool flag2 = false; try { BaseController leftController = Player.LeftController; BaseController rightController = Player.RightController; switch (_placeButton) { case PlaceButton.X: flag = (Object)(object)leftController != (Object)null && leftController.GetAButton(); break; case PlaceButton.Y: flag = (