using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.PuppetMasta; using MelonLoader; using MelonLoader.Preferences; using UltimateRagdoll; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(UltimateRagdollMod), "Ultimate Ragdoll", "4.4.6", "Int_Void", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("UltimateRagdoll")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UltimateRagdoll")] [assembly: AssemblyTitle("UltimateRagdoll")] [assembly: AssemblyVersion("1.0.0.0")] namespace UltimateRagdoll; public class UltimateRagdollMod : MelonMod { public enum RagdollMode { Limp, ArmControl } public enum ControllerSide { Left, Right, Both } public enum InputMode { ThumbstickPress, DoubleTapB } public const string Version = "4.4.6"; private static MelonPreferences_Category _cat; public static MelonPreferences_Entry PrefEnabled; public static MelonPreferences_Entry PrefMode; public static MelonPreferences_Entry PrefSide; public static MelonPreferences_Entry PrefInputMode; public static MelonPreferences_Entry PrefKeyboardKey; public static MelonPreferences_Entry PrefDropItems; public static MelonPreferences_Entry PrefFastExit; public static MelonPreferences_Entry PrefRagdollCooldown; public static MelonPreferences_Entry PrefPreventUnragdollMoving; public static MelonPreferences_Entry PrefUnragdollMaxVelocity; public static MelonPreferences_Entry PrefResetCooldownOnDamage; public static MelonPreferences_Entry PrefMaxRagdollTime; public static MelonPreferences_Entry PrefTwoTapDamage; public static MelonPreferences_Entry PrefTwoTapTimeWindow; public static MelonPreferences_Entry PrefDownedEnabled; public static MelonPreferences_Entry PrefDownedDuration; public static MelonPreferences_Entry PrefStayRagdolledOnDeath; public static MelonPreferences_Entry PrefFallEnabled; public static MelonPreferences_Entry PrefFallThresh; public static MelonPreferences_Entry PrefImpactEnabled; public static MelonPreferences_Entry PrefImpactThresh; public static MelonPreferences_Entry PrefLaunchEnabled; public static MelonPreferences_Entry PrefLaunchThresh; public static MelonPreferences_Entry PrefSlipEnabled; public static MelonPreferences_Entry PrefSlipFriction; public static MelonPreferences_Entry PrefSlipVelocity; public static MelonPreferences_Entry PrefWallPushEnabled; public static MelonPreferences_Entry PrefWallPushVelocity; public static MelonPreferences_Entry PrefImpactDamageEnabled; public static MelonPreferences_Entry PrefImpactDamageMultiplier; public static MelonPreferences_Entry PrefImpactDamageThreshold; public static MelonPreferences_Entry PrefDragEnabled; public static MelonPreferences_Entry PrefDragStrength; public static MelonPreferences_Entry PrefFloppyLeftArm; public static MelonPreferences_Entry PrefFloppyRightArm; public static MelonPreferences_Entry PrefFixEnabled; public static MelonPreferences_Entry PrefFixFly; public static MelonPreferences_Entry PrefFixVel; public static MelonPreferences_Entry PrefFixVelLimit; private Vector3 _lastVelocity; private Vector3 _prevVelocity; private float _nextRagdollTime; private float _unragdollTime; private bool _isDowned; private bool _isDead; private float _deathTime; private float _downedStartTime; private float _lastInputTime; private bool _doubleTapReady; private bool _wasRagdolled; private float _ragdollStartTime; private bool _levelLoaded; private int _damageHits; private float _lastDamageTime; private float _safeDamageTime; private float _safeRagdollTime; private bool _cachedSupported; private float _cachedFriction; private int _cachedGroundFrame; private const int GROUND_CHECK_INTERVAL = 3; private int _framesSinceUnragdoll; private bool _fixPending; private Vector3 _savedPelvisPos; private Quaternion _savedPelvisRot; private float _savedPelvisY; private float _lastImpactDamageTime; private const float IMPACT_DAMAGE_IMMUNITY = 0.5f; private static readonly Vector3[] _sphereDirections; private static Dictionary _savedWeights; private BoolElement _uiEnabled; private BoolElement _uiDropItems; private BoolElement _uiFastExit; private EnumElement _uiMode; private EnumElement _uiInputMode; private EnumElement _uiSide; private FloatElement _uiRagdollCooldown; private FloatElement _uiUnragdollMaxVelocity; private FloatElement _uiMaxRagdollTime; private BoolElement _uiPreventUnragdollMoving; private BoolElement _uiResetCooldownOnDamage; private BoolElement _uiTwoTapDamage; private BoolElement _uiDownedEnabled; private BoolElement _uiStayRagdolledOnDeath; private FloatElement _uiTwoTapTimeWindow; private FloatElement _uiDownedDuration; private BoolElement _uiFallEnabled; private BoolElement _uiImpactEnabled; private BoolElement _uiLaunchEnabled; private BoolElement _uiSlipEnabled; private BoolElement _uiWallPushEnabled; private FloatElement _uiFallThresh; private FloatElement _uiImpactThresh; private FloatElement _uiLaunchThresh; private FloatElement _uiSlipFriction; private FloatElement _uiSlipVelocity; private FloatElement _uiWallPushVelocity; private BoolElement _uiImpactDamageEnabled; private FloatElement _uiImpactDamageMultiplier; private FloatElement _uiImpactDamageThreshold; private BoolElement _uiDragEnabled; private BoolElement _uiFloppyLeft; private BoolElement _uiFloppyRight; private BoolElement _uiFixEnabled; private BoolElement _uiFixFly; private BoolElement _uiFixVel; private FloatElement _uiDragStrength; private FloatElement _uiFixVelLimit; private static int _groundLayerMask; public override void OnInitializeMelon() { SetupPreferences(); BuildBoneMenu(); Hooking.OnLevelLoaded += OnLevelLoaded; Hooking.OnPlayerDamageReceived += OnPlayerDamageReceived; Hooking.OnPlayerDeath += OnPlayerDeath; _groundLayerMask = -1025; ((MelonBase)this).LoggerInstance.Msg("UltimateRagdoll 4.4.6 Loaded!"); } public override void OnApplicationQuit() { Hooking.OnLevelLoaded -= OnLevelLoaded; Hooking.OnPlayerDamageReceived -= OnPlayerDamageReceived; Hooking.OnPlayerDeath -= OnPlayerDeath; } private void SetupPreferences() { _cat = MelonPreferences.CreateCategory("UltimateRagdoll"); PrefEnabled = _cat.CreateEntry("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefMode = _cat.CreateEntry("RagdollMode", RagdollMode.Limp, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefSide = _cat.CreateEntry("ControllerSide", ControllerSide.Right, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefInputMode = _cat.CreateEntry("InputMode", InputMode.ThumbstickPress, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefKeyboardKey = _cat.CreateEntry("KeyboardFallbackKey", (KeyCode)306, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefDropItems = _cat.CreateEntry("DropItemsOnRagdoll", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFastExit = _cat.CreateEntry("FastExitVehicles", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefRagdollCooldown = _cat.CreateEntry("RagdollCooldown", 1.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefPreventUnragdollMoving = _cat.CreateEntry("PreventUnragdollMoving", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefUnragdollMaxVelocity = _cat.CreateEntry("UnragdollMaxVelocity", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefResetCooldownOnDamage = _cat.CreateEntry("ResetCooldownOnDamage", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefMaxRagdollTime = _cat.CreateEntry("MaxRagdollTime", 8f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefTwoTapDamage = _cat.CreateEntry("TwoTapDamage", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefTwoTapTimeWindow = _cat.CreateEntry("TwoTapTimeWindow", 4f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefDownedEnabled = _cat.CreateEntry("DownedEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefDownedDuration = _cat.CreateEntry("DownedDuration", 6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefStayRagdolledOnDeath = _cat.CreateEntry("StayRagdolledOnDeath", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFallEnabled = _cat.CreateEntry("FallEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFallThresh = _cat.CreateEntry("FallThreshold", 9f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefImpactEnabled = _cat.CreateEntry("ImpactEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefImpactThresh = _cat.CreateEntry("ImpactThreshold", 3.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefLaunchEnabled = _cat.CreateEntry("LaunchEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefLaunchThresh = _cat.CreateEntry("LaunchThreshold", 6f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefSlipEnabled = _cat.CreateEntry("SlipEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefSlipFriction = _cat.CreateEntry("SlipFriction", 0.25f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefSlipVelocity = _cat.CreateEntry("SlipVelocity", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefWallPushEnabled = _cat.CreateEntry("WallPushEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefWallPushVelocity = _cat.CreateEntry("WallPushVelocity", 2.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefImpactDamageEnabled = _cat.CreateEntry("ImpactDamageEnabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefImpactDamageMultiplier = _cat.CreateEntry("ImpactDamageMultiplier", 5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefImpactDamageThreshold = _cat.CreateEntry("ImpactDamageThreshold", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefDragEnabled = _cat.CreateEntry("DragEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefDragStrength = _cat.CreateEntry("DragStrength", 3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFloppyLeftArm = _cat.CreateEntry("FloppyLeftArm", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFloppyRightArm = _cat.CreateEntry("FloppyRightArm", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFixEnabled = _cat.CreateEntry("RagdollFixEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFixFly = _cat.CreateEntry("RagdollFixFly", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFixVel = _cat.CreateEntry("RagdollFixVelocity", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); PrefFixVelLimit = _cat.CreateEntry("RagdollFixVelLimit", 5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } private void ResetToDefault() { PrefEnabled.Value = true; PrefMode.Value = RagdollMode.Limp; PrefSide.Value = ControllerSide.Right; PrefInputMode.Value = InputMode.ThumbstickPress; PrefKeyboardKey.Value = (KeyCode)306; PrefDropItems.Value = true; PrefFastExit.Value = true; PrefRagdollCooldown.Value = 1.5f; PrefPreventUnragdollMoving.Value = true; PrefUnragdollMaxVelocity.Value = 2.5f; PrefResetCooldownOnDamage.Value = true; PrefMaxRagdollTime.Value = 8f; PrefTwoTapDamage.Value = false; PrefTwoTapTimeWindow.Value = 4f; PrefDownedEnabled.Value = false; PrefDownedDuration.Value = 6f; PrefStayRagdolledOnDeath.Value = true; PrefFallEnabled.Value = true; PrefFallThresh.Value = 9f; PrefImpactEnabled.Value = true; PrefImpactThresh.Value = 3.5f; PrefLaunchEnabled.Value = true; PrefLaunchThresh.Value = 6f; PrefSlipEnabled.Value = true; PrefSlipFriction.Value = 0.25f; PrefSlipVelocity.Value = 2.5f; PrefWallPushEnabled.Value = true; PrefWallPushVelocity.Value = 2.5f; PrefImpactDamageEnabled.Value = false; PrefImpactDamageMultiplier.Value = 5f; PrefImpactDamageThreshold.Value = 20f; PrefDragEnabled.Value = true; PrefDragStrength.Value = 3f; PrefFloppyLeftArm.Value = false; PrefFloppyRightArm.Value = false; PrefFixEnabled.Value = true; PrefFixFly.Value = true; PrefFixVel.Value = true; PrefFixVelLimit.Value = 5f; _cat.SaveToFile(false); ((MelonBase)this).LoggerInstance.Msg("Settings reset to default."); } private void BuildBoneMenu() { //IL_000b: 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_003c: 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_008e: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_093b: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_0a11: Unknown result type (might be due to invalid IL or missing references) //IL_0a2f: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0a80: Unknown result type (might be due to invalid IL or missing references) //IL_0ac0: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0bbc: Unknown result type (might be due to invalid IL or missing references) Page val = Page.Root.CreatePage("Ultimate Ragdoll", Color.green, 0, true); val.CreateFunction("RESET ALL TO DEFAULT", Color.red, (Action)ResetToDefault); _uiEnabled = val.CreateBool("Mod Enabled", Color.green, PrefEnabled.Value, (Action)delegate(bool v) { PrefEnabled.Value = v; _cat.SaveToFile(false); }); Page val2 = val.CreatePage("1. General Controls", Color.white, 0, true); _uiMode = val2.CreateEnum("Ragdoll Mode", Color.white, (Enum)PrefMode.Value, (Action)delegate(Enum v) { PrefMode.Value = (RagdollMode)(object)v; _cat.SaveToFile(false); }); _uiInputMode = val2.CreateEnum("Button Mode", Color.white, (Enum)PrefInputMode.Value, (Action)delegate(Enum v) { PrefInputMode.Value = (InputMode)(object)v; _cat.SaveToFile(false); }); _uiSide = val2.CreateEnum("Controller Side", Color.white, (Enum)PrefSide.Value, (Action)delegate(Enum v) { PrefSide.Value = (ControllerSide)(object)v; _cat.SaveToFile(false); }); _uiDropItems = val2.CreateBool("Drop Items On Ragdoll", Color.white, PrefDropItems.Value, (Action)delegate(bool v) { PrefDropItems.Value = v; _cat.SaveToFile(false); }); _uiFastExit = val2.CreateBool("Fast Exit Vehicles", Color.white, PrefFastExit.Value, (Action)delegate(bool v) { PrefFastExit.Value = v; _cat.SaveToFile(false); }); Page val3 = val.CreatePage("2. Cooldowns & StandUp", Color.yellow, 0, true); _uiRagdollCooldown = val3.CreateFloat("StandUp Cooldown (Sec)", Color.white, PrefRagdollCooldown.Value, 0.1f, 0f, 10f, (Action)delegate(float v) { PrefRagdollCooldown.Value = v; _cat.SaveToFile(false); }); _uiMaxRagdollTime = val3.CreateFloat("MAX Ragdoll Time (Force Stand)", Color.red, PrefMaxRagdollTime.Value, 1f, 2f, 30f, (Action)delegate(float v) { PrefMaxRagdollTime.Value = v; _cat.SaveToFile(false); }); _uiPreventUnragdollMoving = val3.CreateBool("Freeze Timer In Air/Moving", Color.yellow, PrefPreventUnragdollMoving.Value, (Action)delegate(bool v) { PrefPreventUnragdollMoving.Value = v; _cat.SaveToFile(false); }); _uiUnragdollMaxVelocity = val3.CreateFloat("Max Velocity To StandUp", Color.white, PrefUnragdollMaxVelocity.Value, 0.5f, 0.1f, 10f, (Action)delegate(float v) { PrefUnragdollMaxVelocity.Value = v; _cat.SaveToFile(false); }); _uiResetCooldownOnDamage = val3.CreateBool("Reset Timer On Damage", Color.red, PrefResetCooldownOnDamage.Value, (Action)delegate(bool v) { PrefResetCooldownOnDamage.Value = v; _cat.SaveToFile(false); }); Page val4 = val.CreatePage("3. Damage & Health", Color.red, 0, true); _uiTwoTapDamage = val4.CreateBool("Two-Tap Damage Ragdoll", Color.white, PrefTwoTapDamage.Value, (Action)delegate(bool v) { PrefTwoTapDamage.Value = v; _cat.SaveToFile(false); }); _uiTwoTapTimeWindow = val4.CreateFloat("Two-Tap Time Window (Sec)", Color.white, PrefTwoTapTimeWindow.Value, 0.1f, 1f, 10f, (Action)delegate(float v) { PrefTwoTapTimeWindow.Value = v; _cat.SaveToFile(false); }); _uiDownedEnabled = val4.CreateBool("Downed (Injured) Enabled", Color.red, PrefDownedEnabled.Value, (Action)delegate(bool v) { PrefDownedEnabled.Value = v; _cat.SaveToFile(false); }); _uiDownedDuration = val4.CreateFloat("Downed Duration", Color.red, PrefDownedDuration.Value, 1f, 1f, 15f, (Action)delegate(float v) { PrefDownedDuration.Value = v; _cat.SaveToFile(false); }); _uiStayRagdolledOnDeath = val4.CreateBool("Stay Ragdolled On Death", Color.red, PrefStayRagdolledOnDeath.Value, (Action)delegate(bool v) { PrefStayRagdolledOnDeath.Value = v; _cat.SaveToFile(false); }); Page val5 = val4.CreatePage("Impact Damage (Fling-style)", new Color(1f, 0.65f, 0f), 0, true); _uiImpactDamageEnabled = val5.CreateBool("Impact Damage Enabled (OFF=default)", new Color(1f, 0.65f, 0f), PrefImpactDamageEnabled.Value, (Action)delegate(bool v) { PrefImpactDamageEnabled.Value = v; _cat.SaveToFile(false); }); _uiImpactDamageMultiplier = val5.CreateFloat("Damage Multiplier", Color.white, PrefImpactDamageMultiplier.Value, 0.5f, 1f, 50f, (Action)delegate(float v) { PrefImpactDamageMultiplier.Value = v; _cat.SaveToFile(false); }); _uiImpactDamageThreshold = val5.CreateFloat("Damage Threshold", Color.white, PrefImpactDamageThreshold.Value, 1f, 1f, 100f, (Action)delegate(float v) { PrefImpactDamageThreshold.Value = v; _cat.SaveToFile(false); }); Page val6 = val.CreatePage("4. Auto-Ragdoll Physics", Color.cyan, 0, true); Page val7 = val6.CreatePage("Fall & Impact", Color.white, 0, true); _uiFallEnabled = val7.CreateBool("Fall Enabled", Color.white, PrefFallEnabled.Value, (Action)delegate(bool v) { PrefFallEnabled.Value = v; _cat.SaveToFile(false); }); _uiFallThresh = val7.CreateFloat("Fall Velocity (higher=longer fall)", Color.white, PrefFallThresh.Value, 0.5f, 1f, 30f, (Action)delegate(float v) { PrefFallThresh.Value = v; _cat.SaveToFile(false); }); _uiImpactEnabled = val7.CreateBool("Impact Enabled", Color.white, PrefImpactEnabled.Value, (Action)delegate(bool v) { PrefImpactEnabled.Value = v; _cat.SaveToFile(false); }); _uiImpactThresh = val7.CreateFloat("Impact Threshold (lower=easier)", Color.white, PrefImpactThresh.Value, 0.5f, 1f, 40f, (Action)delegate(float v) { PrefImpactThresh.Value = v; _cat.SaveToFile(false); }); Page val8 = val6.CreatePage("Slip & Launch", Color.white, 0, true); _uiSlipEnabled = val8.CreateBool("Slip Enabled", Color.blue, PrefSlipEnabled.Value, (Action)delegate(bool v) { PrefSlipEnabled.Value = v; _cat.SaveToFile(false); }); _uiSlipFriction = val8.CreateFloat("Slip Friction", Color.blue, PrefSlipFriction.Value, 0.01f, 0f, 1f, (Action)delegate(float v) { PrefSlipFriction.Value = v; _cat.SaveToFile(false); }); _uiSlipVelocity = val8.CreateFloat("Slip Velocity", Color.blue, PrefSlipVelocity.Value, 0.5f, 1f, 10f, (Action)delegate(float v) { PrefSlipVelocity.Value = v; _cat.SaveToFile(false); }); _uiLaunchEnabled = val8.CreateBool("Launch Enabled", Color.magenta, PrefLaunchEnabled.Value, (Action)delegate(bool v) { PrefLaunchEnabled.Value = v; _cat.SaveToFile(false); }); _uiLaunchThresh = val8.CreateFloat("Launch Threshold", Color.magenta, PrefLaunchThresh.Value, 0.5f, 1f, 50f, (Action)delegate(float v) { PrefLaunchThresh.Value = v; _cat.SaveToFile(false); }); Page val9 = val6.CreatePage("Wall Crashes", Color.white, 0, true); _uiWallPushEnabled = val9.CreateBool("Wall Crash Enabled", Color.gray, PrefWallPushEnabled.Value, (Action)delegate(bool v) { PrefWallPushEnabled.Value = v; _cat.SaveToFile(false); }); _uiWallPushVelocity = val9.CreateFloat("Wall Crash Velocity", Color.gray, PrefWallPushVelocity.Value, 0.5f, 1f, 20f, (Action)delegate(float v) { PrefWallPushVelocity.Value = v; _cat.SaveToFile(false); }); Page val10 = val.CreatePage("5. Crawl (Drag) System", Color.magenta, 0, true); _uiDragEnabled = val10.CreateBool("Crawl Enabled", Color.cyan, PrefDragEnabled.Value, (Action)delegate(bool v) { PrefDragEnabled.Value = v; _cat.SaveToFile(false); }); _uiDragStrength = val10.CreateFloat("Crawl Strength", Color.cyan, PrefDragStrength.Value, 0.5f, 1f, 20f, (Action)delegate(float v) { PrefDragStrength.Value = v; _cat.SaveToFile(false); }); Page val11 = val.CreatePage("6. NPC Ragdoll Tools", Color.yellow, 0, true); val11.CreateFunction("Ragdoll Nearest NPC", Color.cyan, (Action)RagdollNearestNPC); val11.CreateFunction("Restore Nearest NPC", Color.green, (Action)RestoreNearestNPC); val11.CreateFunction("Ragdoll All NPCs", Color.red, (Action)RagdollAllNPCs); val11.CreateFunction("Restore All NPCs", Color.green, (Action)RestoreAllNPCs); Page val12 = val.CreatePage("7. Bug Fixes & Visuals", Color.blue, 0, true); _uiFixEnabled = val12.CreateBool("Ragdoll Fix Enabled", Color.green, PrefFixEnabled.Value, (Action)delegate(bool v) { PrefFixEnabled.Value = v; _cat.SaveToFile(false); }); _uiFixFly = val12.CreateBool("Flight Fix (Recommended: ON)", Color.white, PrefFixFly.Value, (Action)delegate(bool v) { PrefFixFly.Value = v; _cat.SaveToFile(false); }); _uiFixVel = val12.CreateBool("Velocity Fix (Recommended: ON)", Color.white, PrefFixVel.Value, (Action)delegate(bool v) { PrefFixVel.Value = v; _cat.SaveToFile(false); }); _uiFixVelLimit = val12.CreateFloat("Velocity Limit", Color.yellow, PrefFixVelLimit.Value, 1f, 0f, 200f, (Action)delegate(float v) { PrefFixVelLimit.Value = v; _cat.SaveToFile(false); }); _uiFloppyLeft = val12.CreateBool("Floppy Left Arm", Color.white, PrefFloppyLeftArm.Value, (Action)delegate(bool v) { PrefFloppyLeftArm.Value = v; _cat.SaveToFile(false); ApplyFloppyArms(); }); _uiFloppyRight = val12.CreateBool("Floppy Right Arm", Color.white, PrefFloppyRightArm.Value, (Action)delegate(bool v) { PrefFloppyRightArm.Value = v; _cat.SaveToFile(false); ApplyFloppyArms(); }); } private void ApplyFloppyArms() { try { if (!((Object)(object)Player.PhysicsRig == (Object)null)) { if ((Object)(object)Player.PhysicsRig.leftHand != (Object)null && (Object)(object)Player.PhysicsRig.leftHand.physHand != (Object)null) { Player.PhysicsRig.leftHand.physHand._forceMultiplier = (PrefFloppyLeftArm.Value ? 0f : 1f); } if ((Object)(object)Player.PhysicsRig.rightHand != (Object)null && (Object)(object)Player.PhysicsRig.rightHand.physHand != (Object)null) { Player.PhysicsRig.rightHand.physHand._forceMultiplier = (PrefFloppyRightArm.Value ? 0f : 1f); } } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("ApplyFloppyArms: " + ex.Message); } } private void OnLevelLoaded(LevelInfo info) { //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_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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) _isDowned = false; _isDead = false; _wasRagdolled = false; _nextRagdollTime = 0f; _unragdollTime = 0f; _lastVelocity = Vector3.zero; _prevVelocity = Vector3.zero; _damageHits = 0; _lastDamageTime = 0f; _levelLoaded = true; _cachedGroundFrame = -100; _savedWeights.Clear(); _fixPending = false; _framesSinceUnragdoll = 0; _savedPelvisPos = Vector3.zero; _savedPelvisY = 0f; _lastImpactDamageTime = 0f; _safeDamageTime = Time.time + 3f; _safeRagdollTime = Time.time + 3f; } private bool IsLocalPlayer() { try { if ((Object)(object)Player.RigManager == (Object)null) { return false; } RigManager rigManager = Player.RigManager; Component component = ((Component)rigManager).GetComponent("Fusion.NetworkObject"); if ((Object)(object)component != (Object)null) { PropertyInfo property = ((object)component).GetType().GetProperty("IsProxy"); if (property != null && (bool)property.GetValue(component)) { return false; } } return true; } catch { return true; } } private bool CheckSupported360(PhysicsRig phys, out float friction) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) int frameCount = Time.frameCount; if (frameCount - _cachedGroundFrame < 3) { friction = _cachedFriction; return _cachedSupported; } friction = 1f; bool flag = false; if ((Object)(object)phys == (Object)null || (Object)(object)((Rig)phys).m_pelvis == (Object)null) { _cachedSupported = false; _cachedFriction = 1f; _cachedGroundFrame = frameCount; return false; } Vector3 position = ((Rig)phys).m_pelvis.position; Transform root = ((Component)phys).transform.root; Collider[] array = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(position, 0.6f, _groundLayerMask, (QueryTriggerInteraction)1)); if (array != null) { foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).transform.root == (Object)(object)root)) { flag = true; if ((Object)(object)val.sharedMaterial != (Object)null) { friction = val.sharedMaterial.dynamicFriction; } break; } } } if (!flag) { RaycastHit val2 = default(RaycastHit); for (int j = 0; j < _sphereDirections.Length; j++) { if (Physics.Raycast(position, _sphereDirections[j], ref val2, 1f, _groundLayerMask, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val2)).collider).transform.root != (Object)(object)root) { flag = true; if ((Object)(object)((RaycastHit)(ref val2)).collider.sharedMaterial != (Object)null) { friction = ((RaycastHit)(ref val2)).collider.sharedMaterial.dynamicFriction; } break; } } } if (!flag && (Object)(object)phys.feet != (Object)null) { Vector3 position2 = phys.feet.transform.position; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(position2, Vector3.down, ref val3, 0.8f, _groundLayerMask, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val3)).collider).transform.root != (Object)(object)root) { flag = true; if ((Object)(object)((RaycastHit)(ref val3)).collider.sharedMaterial != (Object)null) { friction = ((RaycastHit)(ref val3)).collider.sharedMaterial.dynamicFriction; } } } _cachedSupported = flag; _cachedFriction = friction; _cachedGroundFrame = frameCount; return flag; } private bool CheckGroundBelow(PhysicsRig phys) { //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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ea: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_0113: 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_0123: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)phys == (Object)null || (Object)(object)((Rig)phys).m_pelvis == (Object)null) { return false; } Vector3 position = ((Rig)phys).m_pelvis.position; Transform root = ((Component)phys).transform.root; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, Vector3.down, ref val, 1.2f, _groundLayerMask, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val)).collider).transform.root != (Object)(object)root) { return true; } Vector3[] array = new Vector3[4]; Vector3 val2 = new Vector3(0.5f, -1f, 0f); array[0] = ((Vector3)(ref val2)).normalized; val2 = new Vector3(-0.5f, -1f, 0f); array[1] = ((Vector3)(ref val2)).normalized; val2 = new Vector3(0f, -1f, 0.5f); array[2] = ((Vector3)(ref val2)).normalized; val2 = new Vector3(0f, -1f, -0.5f); array[3] = ((Vector3)(ref val2)).normalized; Vector3[] array2 = (Vector3[])(object)array; RaycastHit val3 = default(RaycastHit); for (int i = 0; i < array2.Length; i++) { if (Physics.Raycast(position, array2[i], ref val3, 1f, _groundLayerMask, (QueryTriggerInteraction)1) && (Object)(object)((Component)((RaycastHit)(ref val3)).collider).transform.root != (Object)(object)root) { return true; } } return false; } private bool IsHoldingNimbus(PhysicsRig phys) { try { if ((Object)(object)phys.leftHand != (Object)null && (Object)(object)phys.leftHand.m_CurrentAttachedGO != (Object)null && ((Object)phys.leftHand.m_CurrentAttachedGO).name.IndexOf("nimbus", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if ((Object)(object)phys.rightHand != (Object)null && (Object)(object)phys.rightHand.m_CurrentAttachedGO != (Object)null && ((Object)phys.rightHand.m_CurrentAttachedGO).name.IndexOf("nimbus", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } catch { } return false; } private static AIBrain GetClosestBrain(Il2CppArrayBase brains, Vector3 playerPos) { //IL_0066: 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) AIBrain result = null; float num = float.MaxValue; if (brains == null) { return null; } foreach (AIBrain brain in brains) { if (!((Object)(object)brain == (Object)null) && !((Object)(object)brain.puppetMaster == (Object)null) && ((Component)brain).gameObject.activeInHierarchy) { float num2 = Vector3.Distance(playerPos, ((Component)brain).transform.position); if (num2 < num) { num = num2; result = brain; } } } return result; } private static void RagdollBrain(AIBrain brain) { if ((Object)(object)brain == (Object)null || (Object)(object)brain.puppetMaster == (Object)null) { return; } PuppetMaster puppetMaster = brain.puppetMaster; int instanceID = ((Object)puppetMaster).GetInstanceID(); if (!_savedWeights.ContainsKey(instanceID)) { _savedWeights[instanceID] = puppetMaster.muscleWeight; } puppetMaster.muscleWeight = 0f; Il2CppArrayBase componentsInChildren = ((Component)((Component)brain).transform.root).GetComponentsInChildren(true); if (componentsInChildren == null) { return; } foreach (Behaviour item in componentsInChildren) { if ((Object)(object)item != (Object)null && ((object)item).GetType().Name.Contains("Animator")) { item.enabled = false; } } } private static void RestoreBrain(AIBrain brain) { if ((Object)(object)brain == (Object)null || (Object)(object)brain.puppetMaster == (Object)null) { return; } PuppetMaster puppetMaster = brain.puppetMaster; int instanceID = ((Object)puppetMaster).GetInstanceID(); if (_savedWeights.TryGetValue(instanceID, out var value)) { puppetMaster.muscleWeight = value; _savedWeights.Remove(instanceID); } else { puppetMaster.muscleWeight = 1f; } Il2CppArrayBase componentsInChildren = ((Component)((Component)brain).transform.root).GetComponentsInChildren(true); if (componentsInChildren == null) { return; } foreach (Behaviour item in componentsInChildren) { if ((Object)(object)item != (Object)null && ((object)item).GetType().Name.Contains("Animator")) { item.enabled = true; } } } private static void RagdollNearestNPC() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009f: Expected O, but got Unknown try { if (!((Object)(object)Player.RigManager == (Object)null) && !((Object)(object)Player.RigManager.physicsRig == (Object)null)) { Vector3 position = ((Rig)Player.RigManager.physicsRig).m_pelvis.position; Il2CppArrayBase brains = Object.FindObjectsOfType(); AIBrain closestBrain = GetClosestBrain(brains, position); if ((Object)(object)closestBrain != (Object)null) { RagdollBrain(closestBrain); Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit("Ragdolled!"), Type = (NotificationType)3, PopupLength = 2f }); } else { Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit("No NPCs."), Type = (NotificationType)1, PopupLength = 2f }); } } } catch (Exception ex) { MelonLogger.Warning("RagdollNearestNPC: " + ex.Message); } } private static void RestoreNearestNPC() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009f: Expected O, but got Unknown try { if (!((Object)(object)Player.RigManager == (Object)null) && !((Object)(object)Player.RigManager.physicsRig == (Object)null)) { Vector3 position = ((Rig)Player.RigManager.physicsRig).m_pelvis.position; Il2CppArrayBase brains = Object.FindObjectsOfType(); AIBrain closestBrain = GetClosestBrain(brains, position); if ((Object)(object)closestBrain != (Object)null) { RestoreBrain(closestBrain); Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit("Restored!"), Type = (NotificationType)3, PopupLength = 2f }); } else { Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit("No NPCs."), Type = (NotificationType)1, PopupLength = 2f }); } } } catch (Exception ex) { MelonLogger.Warning("RestoreNearestNPC: " + ex.Message); } } private static void RagdollAllNPCs() { //IL_001c: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown try { Il2CppArrayBase val = Object.FindObjectsOfType(); if (val == null || val.Count == 0) { Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit("No NPCs."), Type = (NotificationType)1, PopupLength = 2f }); return; } int num = 0; foreach (AIBrain item in val) { if ((Object)(object)item != (Object)null && (Object)(object)item.puppetMaster != (Object)null && ((Component)item).gameObject.activeInHierarchy) { RagdollBrain(item); num++; } } Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit($"Ragdolled {num}!"), Type = (NotificationType)3, PopupLength = 2f }); } catch (Exception ex) { MelonLogger.Warning("RagdollAllNPCs: " + ex.Message); } } private static void RestoreAllNPCs() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown try { Il2CppArrayBase val = Object.FindObjectsOfType(); if (val == null || val.Count == 0) { return; } int num = 0; foreach (AIBrain item in val) { if ((Object)(object)item != (Object)null && (Object)(object)item.puppetMaster != (Object)null) { RestoreBrain(item); num++; } } _savedWeights.Clear(); Notifier.Send(new Notification { Title = NotificationText.op_Implicit("NPC"), Message = NotificationText.op_Implicit($"Restored {num}!"), Type = (NotificationType)3, PopupLength = 2f }); } catch (Exception ex) { MelonLogger.Warning("RestoreAllNPCs: " + ex.Message); } } private bool CheckJumpInput() { if (Input.GetKeyDown((KeyCode)32)) { return true; } if (Input.GetKeyDown((KeyCode)332)) { return true; } return false; } public override void OnUpdate() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) if (!PrefEnabled.Value || !_levelLoaded || !IsLocalPlayer() || (Object)(object)Player.RigManager == (Object)null) { return; } RigManager rigManager = Player.RigManager; PhysicsRig physicsRig = rigManager.physicsRig; if ((Object)(object)physicsRig == (Object)null) { return; } bool flag = IsRagdolled(physicsRig); if ((Object)(object)rigManager.health != (Object)null && (_isDead || _isDowned) && rigManager.health.curr_Health >= rigManager.health.max_Health * 0.9f && (!_isDead || !(Time.time - _deathTime < 4f))) { _isDead = false; _isDowned = false; _unragdollTime = 0f; _safeDamageTime = Time.time + 3f; _safeRagdollTime = Time.time + 3f; if ((Object)(object)physicsRig != (Object)null) { _lastVelocity = physicsRig.wholeBodyVelocity; _prevVelocity = physicsRig.wholeBodyVelocity; } if (flag) { UnragdollRig(rigManager); } } if (_isDead) { return; } bool flag2 = CheckInput(); bool flag3 = CheckJumpInput(); if (flag2) { if ((Object)(object)rigManager.activeSeat != (Object)null && PrefFastExit.Value) { try { rigManager.activeSeat.EgressRig(true); } catch { } if (Time.time >= _nextRagdollTime) { ExecuteRagdoll(rigManager); } } else { if ((Object)(object)rigManager.activeSeat != (Object)null) { return; } if (flag) { if (CanUnragdoll(physicsRig)) { UnragdollRig(rigManager); } } else if (Time.time >= _nextRagdollTime) { ExecuteRagdoll(rigManager); } } } else if (flag3 && flag) { if (CanUnragdoll(physicsRig)) { UnragdollRig(rigManager); } } else if (!((Object)(object)rigManager.activeSeat != (Object)null) && _isDowned && Time.time - _downedStartTime >= PrefDownedDuration.Value && CanUnragdoll(physicsRig)) { UnragdollRig(rigManager); } } public override void OnFixedUpdate() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_01cb: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) if (!PrefEnabled.Value || !_levelLoaded || !IsLocalPlayer() || (Object)(object)Player.RigManager == (Object)null) { return; } RigManager rigManager = Player.RigManager; PhysicsRig physicsRig = rigManager.physicsRig; if ((Object)(object)physicsRig == (Object)null || (Object)(object)rigManager.activeSeat != (Object)null) { return; } bool flag = IsRagdolled(physicsRig); HandleRagdollFix(rigManager, physicsRig, flag); if (flag) { Vector3 wholeBodyVelocity = physicsRig.wholeBodyVelocity; Vector3 val = wholeBodyVelocity - _lastVelocity; _prevVelocity = _lastVelocity; _lastVelocity = wholeBodyVelocity; if (_isDead) { return; } TryApplyImpactDamage(rigManager, ((Vector3)(ref val)).magnitude); if (PrefDragEnabled.Value) { HandleDrag(physicsRig); } if (!PrefPreventUnragdollMoving.Value) { return; } float num = Time.time - _ragdollStartTime; if (num < PrefMaxRagdollTime.Value) { float friction; bool flag2 = CheckSupported360(physicsRig, out friction); float magnitude = ((Vector3)(ref wholeBodyVelocity)).magnitude; if (!flag2 || magnitude > PrefUnragdollMaxVelocity.Value) { float num2 = Time.time + PrefRagdollCooldown.Value; float num3 = _ragdollStartTime + PrefMaxRagdollTime.Value; _unragdollTime = Mathf.Min(num2, num3); } } } else if (Time.time >= _nextRagdollTime && !_isDead) { HandleAutoRagdoll(rigManager, physicsRig); _prevVelocity = _lastVelocity; _lastVelocity = physicsRig.wholeBodyVelocity; } } private bool CanUnragdoll(PhysicsRig phys) { if (_isDead) { return false; } float num = Time.time - _ragdollStartTime; if (num >= PrefMaxRagdollTime.Value) { return true; } if (Time.time < _unragdollTime) { return false; } return true; } private bool IsRagdolled(PhysicsRig phys) { try { if ((Object)(object)phys == (Object)null) { return false; } bool flag = (Object)(object)phys.torso != (Object)null && phys.torso.shutdown; bool flag2 = !phys.ballLocoEnabled; return flag || flag2; } catch { return false; } } private void HandleRagdollFix(RigManager rig, PhysicsRig phys, bool isRagdolled) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) if (!_wasRagdolled && isRagdolled) { _ragdollStartTime = Time.time; _fixPending = false; _framesSinceUnragdoll = 0; } else if (_wasRagdolled && !isRagdolled) { float num = Time.time - _ragdollStartTime; bool flag = num > 0.5f; Vector3 wholeBodyVelocity = phys.wholeBodyVelocity; bool flag2 = ((Vector3)(ref wholeBodyVelocity)).magnitude > PrefFixVelLimit.Value; if (PrefFixEnabled.Value) { bool value = PrefFixFly.Value; bool value2 = PrefFixVel.Value; bool flag3 = false; if (value && value2 && flag && !flag2) { flag3 = true; } else if (value2 && !value && !flag2) { flag3 = true; } else if (value && !value2 && flag) { flag3 = true; } else if (!value2 && !value) { flag3 = true; } if (flag3) { _savedPelvisPos = ((Rig)phys).m_pelvis.position; _savedPelvisRot = ((Rig)phys).m_pelvis.rotation; _savedPelvisY = _savedPelvisPos.y; _fixPending = true; _framesSinceUnragdoll = 0; } } } if (_fixPending) { _framesSinceUnragdoll++; if (_framesSinceUnragdoll >= 1 && _framesSinceUnragdoll <= 4) { Vector3 position = ((Rig)phys).m_pelvis.position; Vector3 wholeBodyVelocity2 = phys.wholeBodyVelocity; bool flag4 = false; if (PrefFixFly.Value && position.y > _savedPelvisY + 0.8f) { flag4 = true; } if (PrefFixVel.Value && ((Vector3)(ref wholeBodyVelocity2)).magnitude > PrefFixVelLimit.Value) { flag4 = true; } if (PrefFixFly.Value && wholeBodyVelocity2.y > 3f) { flag4 = true; } if (flag4) { Vector3 val = _savedPelvisPos + new Vector3(0f, 0.5f, 0f); rig.Teleport(val, true); try { Rigidbody component = ((Component)((Rig)phys).m_pelvis).GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } catch { } _fixPending = false; } } if (_framesSinceUnragdoll > 4) { _fixPending = false; } } _wasRagdolled = isRagdolled; } private void HandleAutoRagdoll(RigManager rig, PhysicsRig phys) { //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: 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_0031: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _safeRagdollTime || IsHoldingNimbus(phys)) { return; } Vector3 wholeBodyVelocity = phys.wholeBodyVelocity; Vector3 val = wholeBodyVelocity - _lastVelocity; float y = wholeBodyVelocity.y; float magnitude = ((Vector3)(ref val)).magnitude; bool flag = CheckGroundBelow(phys); float friction; bool flag2 = CheckSupported360(phys, out friction); if (PrefFallEnabled.Value && !flag && y < 0f - PrefFallThresh.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude); return; } Vector3 val2 = wholeBodyVelocity - _prevVelocity; float magnitude2 = ((Vector3)(ref val2)).magnitude; if (magnitude > 0.3f) { if (PrefImpactEnabled.Value && ((Vector3)(ref _lastVelocity)).sqrMagnitude > 0.01f) { float num = Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref _lastVelocity)).normalized); if (num < -0.05f && magnitude > PrefImpactThresh.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude); return; } } if (PrefLaunchEnabled.Value) { float num2 = ((((Vector3)(ref wholeBodyVelocity)).sqrMagnitude > 0.01f) ? Vector3.Dot(((Vector3)(ref val)).normalized, ((Vector3)(ref wholeBodyVelocity)).normalized) : 0f); if ((num2 > 0.4f || val.y > 0.4f) && magnitude > PrefLaunchThresh.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude); return; } } } if (PrefImpactEnabled.Value && magnitude2 > PrefImpactThresh.Value * 1.3f && ((Vector3)(ref _lastVelocity)).sqrMagnitude > 0.5f) { float num3 = Vector3.Angle(_lastVelocity, wholeBodyVelocity); if (num3 > 80f) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude2); return; } } if (PrefSlipEnabled.Value && flag2) { Vector3 val3 = wholeBodyVelocity; val3.y = 0f; bool flag3 = Mathf.Abs(val.y) > 3f && y < -1.5f; if ((friction < PrefSlipFriction.Value && ((Vector3)(ref val3)).magnitude > PrefSlipVelocity.Value) || (friction < PrefSlipFriction.Value && flag3)) { ExecuteRagdoll(rig); return; } } if (PrefWallPushEnabled.Value) { bool flag4 = false; try { flag4 = ((Object)(object)phys.leftHand != (Object)null && (Object)(object)phys.leftHand.physHand != (Object)null && phys.leftHand.physHand._colliding) || ((Object)(object)phys.rightHand != (Object)null && (Object)(object)phys.rightHand.physHand != (Object)null && phys.rightHand.physHand._colliding); } catch { } Vector3 val4 = wholeBodyVelocity; val4.y = 0f; Vector3 lastVelocity = _lastVelocity; lastVelocity.y = 0f; Vector3 val5 = val4 - lastVelocity; float magnitude3 = ((Vector3)(ref val5)).magnitude; if (flag4 && !flag2 && ((Vector3)(ref val4)).magnitude > PrefWallPushVelocity.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, ((Vector3)(ref val4)).magnitude); } else if (flag4 && magnitude3 > 1.2f && ((Vector3)(ref lastVelocity)).magnitude > PrefWallPushVelocity.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude3); } else if (magnitude3 > 3f && ((Vector3)(ref lastVelocity)).magnitude > PrefWallPushVelocity.Value) { ExecuteRagdoll(rig); TryApplyImpactDamage(rig, magnitude3); } } } private void TryApplyImpactDamage(RigManager rig, float velocityDelta) { if (!PrefImpactDamageEnabled.Value || (Object)(object)rig == (Object)null || (Object)(object)rig.health == (Object)null || _isDead || Time.time < _safeDamageTime || velocityDelta < 1f || Time.time - _lastImpactDamageTime < 0.5f) { return; } float num = velocityDelta * PrefImpactDamageMultiplier.Value; float num2 = num - PrefImpactDamageThreshold.Value; if (!(num2 > 0f)) { return; } try { rig.health.TAKEDAMAGE(num2); _lastImpactDamageTime = Time.time; } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("ImpactDamage: " + ex.Message); } } private void HandleDrag(PhysicsRig phys) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.zero; try { BaseController val2 = ((PrefSide.Value == ControllerSide.Left) ? Player.LeftController : Player.RightController); if (PrefSide.Value == ControllerSide.Both && (Object)(object)Player.RightController != (Object)null) { val2 = Player.RightController; } if ((Object)(object)val2 != (Object)null) { val = val2.GetThumbStickAxis(); } } catch { } if (((Vector2)(ref val)).magnitude <= 0.1f) { if (Input.GetKey((KeyCode)119) || Input.GetKey((KeyCode)273)) { val.y += 1f; } if (Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274)) { val.y -= 1f; } if (Input.GetKey((KeyCode)100) || Input.GetKey((KeyCode)275)) { val.x += 1f; } if (Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)276)) { val.x -= 1f; } val = ((Vector2)(ref val)).normalized; } if (((Vector2)(ref val)).magnitude <= 0.1f) { return; } try { Rigidbody val3 = (((Object)(object)((Rig)phys).m_pelvis != (Object)null) ? ((Component)((Rig)phys).m_pelvis).GetComponent() : null); if (!((Object)(object)val3 == (Object)null)) { Rigidbody val4 = (((Object)(object)((Rig)phys).m_chest != (Object)null) ? ((Component)((Rig)phys).m_chest).GetComponent() : null); Rigidbody val5 = (((Object)(object)phys.leftHand != (Object)null) ? ((Component)phys.leftHand).GetComponent() : null); Rigidbody val6 = (((Object)(object)phys.rightHand != (Object)null) ? ((Component)phys.rightHand).GetComponent() : null); Transform val7 = (((Object)(object)Player.RigManager != (Object)null && (Object)(object)Player.RigManager.ControllerRig != (Object)null) ? ((Rig)Player.RigManager.ControllerRig).m_head : null); Vector3 val8 = (((Object)(object)val7 != (Object)null) ? val7.forward : Vector3.forward); Vector3 val9 = (((Object)(object)val7 != (Object)null) ? val7.right : Vector3.right); val8.y = 0f; ((Vector3)(ref val8)).Normalize(); val9.y = 0f; ((Vector3)(ref val9)).Normalize(); if (((Vector3)(ref val8)).sqrMagnitude < 0.01f) { val8 = Vector3.forward; val9 = Vector3.right; } Vector3 val10 = val8 * val.y + val9 * val.x; Vector3 normalized = ((Vector3)(ref val10)).normalized; float friction; bool flag = !CheckSupported360(phys, out friction); float num = PrefDragStrength.Value * 15f; if (flag) { num *= 1.5f; } Vector3 val11 = normalized * num; val3.AddForce(val11, (ForceMode)5); if ((Object)(object)val4 != (Object)null) { val4.AddForce(val11 * 0.8f, (ForceMode)5); } if ((Object)(object)val5 != (Object)null) { val5.AddForce(val11 * 0.4f, (ForceMode)5); } if ((Object)(object)val6 != (Object)null) { val6.AddForce(val11 * 0.4f, (ForceMode)5); } } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("HandleDrag: " + ex.Message); } } private void OnPlayerDamageReceived(RigManager rigManager, float damage) { if (!PrefEnabled.Value || _isDead || (Object)(object)rigManager == (Object)null || (Object)(object)rigManager.physicsRig == (Object)null) { return; } PhysicsRig physicsRig = rigManager.physicsRig; if (IsRagdolled(physicsRig)) { if (PrefResetCooldownOnDamage.Value) { float num = Time.time + PrefRagdollCooldown.Value; float num2 = _ragdollStartTime + PrefMaxRagdollTime.Value; _unragdollTime = Mathf.Min(num, num2); } return; } if (PrefTwoTapDamage.Value) { if (Time.time - _lastDamageTime < PrefTwoTapTimeWindow.Value) { _damageHits++; } else { _damageHits = 1; } _lastDamageTime = Time.time; if (_damageHits >= 2) { _damageHits = 0; ExecuteRagdoll(rigManager); return; } } if (damage >= 30f) { ExecuteRagdoll(rigManager); } else { if (!PrefDownedEnabled.Value) { return; } try { if (rigManager.health.curr_Health <= 0f) { HandleDownedOrDeath(rigManager); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Damage: " + ex.Message); } } } private void HandleDownedOrDeath(RigManager rigManager) { if (_isDowned) { _isDead = true; _deathTime = Time.time; try { rigManager.health.Dying(5f); return; } catch { return; } } if (!_isDead) { _isDowned = true; _downedStartTime = Time.time; try { TryInvokeLifeSavingDamageDealt(rigManager.health); rigManager.health.curr_Health = rigManager.health.max_Health * 0.25f; } catch { } ExecuteRagdoll(rigManager); } } private void OnPlayerDeath(RigManager rigManager) { if (!PrefEnabled.Value) { return; } _isDowned = false; _isDead = true; _deathTime = Time.time; if (PrefStayRagdolledOnDeath.Value) { if ((Object)(object)rigManager != (Object)null && (Object)(object)rigManager.physicsRig != (Object)null && !IsRagdolled(rigManager.physicsRig)) { ExecuteRagdoll(rigManager); } _unragdollTime = float.MaxValue; } else if ((Object)(object)rigManager != (Object)null) { UnragdollRig(rigManager); } } private void ExecuteRagdoll(RigManager rig) { if ((Object)(object)rig == (Object)null) { return; } try { PhysicsRig physicsRig = rig.physicsRig; if ((Object)(object)physicsRig == (Object)null) { return; } if (PrefDropItems.Value) { ForceDrop(physicsRig.leftHand); ForceDrop(physicsRig.rightHand); } if (PrefMode.Value == RagdollMode.Limp) { physicsRig.ShutdownRig(); } physicsRig.RagdollRig(); if (PrefMode.Value == RagdollMode.ArmControl) { physicsRig.DisableBallLoco(); physicsRig.PhysicalLegs(); if ((Object)(object)physicsRig.legLf != (Object)null) { physicsRig.legLf.ShutdownLimb(); } if ((Object)(object)physicsRig.legRt != (Object)null) { physicsRig.legRt.ShutdownLimb(); } } _ragdollStartTime = Time.time; _nextRagdollTime = Time.time + 1f; _unragdollTime = Time.time + PrefRagdollCooldown.Value; _fixPending = false; _framesSinceUnragdoll = 0; } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("ExecuteRagdoll: " + ex.Message); } } private void ForceDrop(Hand hand) { try { if ((Object)(object)hand == (Object)null || !hand.HasAttachedObject()) { return; } HandReciever attachedReceiver = hand.AttachedReceiver; if (!((Object)(object)attachedReceiver == (Object)null)) { Grip val = ((Il2CppObjectBase)attachedReceiver).TryCast(); if ((Object)(object)val != (Object)null) { val.ForceDetach(true); } else { hand.DetachObject(); } } } catch { } } private void UnragdollRig(RigManager rig) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rig == (Object)null) { return; } try { PhysicsRig physicsRig = rig.physicsRig; if (!((Object)(object)physicsRig == (Object)null)) { Vector3 val = (((Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) ? ((Rig)physicsRig).m_pelvis.position : Vector3.zero); Quaternion val2 = (((Object)(object)((Rig)physicsRig).m_pelvis != (Object)null) ? ((Rig)physicsRig).m_pelvis.rotation : Quaternion.identity); physicsRig.TurnOnRig(); physicsRig.UnRagdollRig(); if (!physicsRig.ballLocoEnabled) { physicsRig.EnableBallLoco(); } if ((Object)(object)physicsRig.knee != (Object)null && (Object)(object)physicsRig.feet != (Object)null) { physicsRig.knee.transform.SetPositionAndRotation(val, val2); physicsRig.feet.transform.SetPositionAndRotation(val, val2); } ApplyFloppyArms(); _nextRagdollTime = Time.time + 1f; _unragdollTime = 0f; _fixPending = false; _framesSinceUnragdoll = 0; _isDowned = false; _isDead = false; } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("UnragdollRig: " + ex.Message); } } private bool CheckInput() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(PrefKeyboardKey.Value)) { return true; } bool flag = false; try { BaseController rightController = Player.RightController; BaseController leftController = Player.LeftController; if (PrefInputMode.Value == InputMode.ThumbstickPress) { if ((PrefSide.Value == ControllerSide.Right || PrefSide.Value == ControllerSide.Both) && (Object)(object)rightController != (Object)null) { flag |= rightController.GetThumbStickDown(); } if ((PrefSide.Value == ControllerSide.Left || PrefSide.Value == ControllerSide.Both) && (Object)(object)leftController != (Object)null) { flag |= leftController.GetThumbStickDown(); } } else if (PrefInputMode.Value == InputMode.DoubleTapB) { bool flag2 = false; if ((PrefSide.Value == ControllerSide.Right || PrefSide.Value == ControllerSide.Both) && (Object)(object)rightController != (Object)null) { flag2 |= rightController.GetBButtonDown(); } if ((PrefSide.Value == ControllerSide.Left || PrefSide.Value == ControllerSide.Both) && (Object)(object)leftController != (Object)null) { flag2 |= leftController.GetBButtonDown(); } float unscaledTime = Time.unscaledTime; if (flag2 && _doubleTapReady) { if (unscaledTime - _lastInputTime <= 0.35f) { flag = true; } _doubleTapReady = false; _lastInputTime = 0f; } else if (flag2) { _lastInputTime = unscaledTime; _doubleTapReady = true; } else if (unscaledTime - _lastInputTime > 0.35f) { _doubleTapReady = false; _lastInputTime = 0f; } } } catch { } return flag; } private static void TryInvokeLifeSavingDamageDealt(object health) { try { if (health != null) { MethodInfo method = health.GetType().GetMethod("LifeSavingDamgeDealt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(health, null); } } } catch { } } static UltimateRagdollMod() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) Vector3[] obj = new Vector3[14] { Vector3.down, Vector3.up, Vector3.left, Vector3.right, Vector3.forward, Vector3.back, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; Vector3 val = new Vector3(0.7f, -0.7f, 0f); obj[6] = ((Vector3)(ref val)).normalized; val = new Vector3(-0.7f, -0.7f, 0f); obj[7] = ((Vector3)(ref val)).normalized; val = new Vector3(0f, -0.7f, 0.7f); obj[8] = ((Vector3)(ref val)).normalized; val = new Vector3(0f, -0.7f, -0.7f); obj[9] = ((Vector3)(ref val)).normalized; val = new Vector3(0.5f, -0.7f, 0.5f); obj[10] = ((Vector3)(ref val)).normalized; val = new Vector3(-0.5f, -0.7f, 0.5f); obj[11] = ((Vector3)(ref val)).normalized; val = new Vector3(0.5f, -0.7f, -0.5f); obj[12] = ((Vector3)(ref val)).normalized; val = new Vector3(-0.5f, -0.7f, -0.5f); obj[13] = ((Vector3)(ref val)).normalized; _sphereDirections = (Vector3[])(object)obj; _savedWeights = new Dictionary(); } }