using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib; using BoneLib.BoneMenu; using Flip; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(FlipMod), "Flip", "1.0.0", "Spoon1606", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] namespace Flip; public class FlipMod : MelonMod { private static MelonPreferences_Category _prefCategory; private static MelonPreferences_Entry _prefEnabled; private static MelonPreferences_Entry _prefStrength; private static BoolElement _enabledElement; private static float _inputDeadzone = 0.3f; private static float _groundCheckDistance = 1.2f; public static bool IsEnabled { get; private set; } = true; public static float Strength { get; private set; } = 20f; public override void OnInitializeMelon() { SetupPreferences(); SetupBoneMenu(); } private void SetupPreferences() { _prefCategory = MelonPreferences.CreateCategory("Flip"); _prefEnabled = _prefCategory.CreateEntry("IsEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); _prefStrength = _prefCategory.CreateEntry("Strength", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); IsEnabled = _prefEnabled.Value; Strength = _prefStrength.Value; } private void SetupBoneMenu() { //IL_000a: 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_0041: Unknown result type (might be due to invalid IL or missing references) Page obj = Page.Root.CreatePage("Flip", Color.white, 0, true); _enabledElement = obj.CreateBool("Enabled", Color.green, IsEnabled, (Action)OnSetEnabled); obj.CreateFloat("Strength", Color.blue, Strength, 1f, 1f, 100f, (Action)OnSetStrength); } private static void OnSetEnabled(bool value) { IsEnabled = value; _prefEnabled.Value = value; _prefCategory.SaveToFile(false); } private static void OnSetStrength(float value) { Strength = value; _prefStrength.Value = value; _prefCategory.SaveToFile(false); } public override void OnPreferencesLoaded() { if (_prefCategory != null) { IsEnabled = _prefEnabled.Value; Strength = _prefStrength.Value; if (_enabledElement != null) { _enabledElement.Value = IsEnabled; } } } public override void OnUpdate() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00e0: 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) if (!IsEnabled) { return; } RigManager rigManager = Player.RigManager; if ((Object)(object)rigManager == (Object)null) { return; } PhysicsRig physicsRig = rigManager.physicsRig; if ((Object)(object)physicsRig == (Object)null || (!physicsRig.torso.shutdown && physicsRig.ballLocoEnabled)) { return; } Transform transform = ((Component)((Rig)physicsRig).m_pelvis).transform; Rigidbody component = ((Component)transform).GetComponent(); if ((Object)(object)component == (Object)null) { return; } component.maxAngularVelocity = 200f; BaseController leftController = Player.LeftController; if ((Object)(object)leftController == (Object)null) { return; } float y = leftController.GetThumbStickAxis().y; if (Mathf.Abs(y) <= _inputDeadzone) { return; } bool num = !Physics.Raycast(transform.position, Vector3.down, _groundCheckDistance); float num2 = y * Strength * 10f; if (num) { num2 *= 2f; } Vector3 val = transform.right * num2; component.AddTorque(val, (ForceMode)2); Rigidbody[] array = Il2CppArrayBase.op_Implicit(((Component)transform).GetComponentsInChildren()); if (array == null) { return; } Rigidbody[] array2 = array; foreach (Rigidbody val2 in array2) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)component) { val2.maxAngularVelocity = 200f; val2.AddTorque(val, (ForceMode)2); } } } }