using System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BoneLib; using BoneLib.BoneMenu; using HarmonyLib; using HideConstraint; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; 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(Core), "HideConstraint", "1.0.0", "CAitStudio", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("HideConstraint")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HideConstraint")] [assembly: AssemblyTitle("HideConstraint")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 HideConstraint { public class Core : MelonMod { [HarmonyPatch(typeof(Constrainer), "PrimaryButtonUp")] private static class makeNewConstraintHide { private static void Postfix(Constrainer __instance) { if (ShowConstraint != null && !ShowConstraint.Value) { MelonCoroutines.Start(waitNewConstraint()); } } } private Page ModPage; private static MelonPreferences_Category cat; private static MelonPreferences_Entry ShowConstraint; public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("HideConstraintMod: Initialized."); cat = MelonPreferences.CreateCategory("HideConstraint"); ShowConstraint = cat.CreateEntry("ShowConstraint", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); CreateBoneMenu(); ((MelonBase)this).HarmonyInstance.PatchAll(); Hooking.OnLevelLoaded += delegate { if (!ShowConstraint.Value) { MelonCoroutines.Start(waitHide()); } }; } public void CreateBoneMenu() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) ModPage = Page.Root.CreatePage("Constraint", Color.cyan, 0, true); ModPage.CreateBool("ShowConstraint?", Color.white, ShowConstraint.Value, (Action)delegate(bool b) { ShowConstraint.Value = b; MelonPreferences.Save(); if (b) { showAllConstraintRopes(); } else { HideAllConstraintRopes(); } }); } private static IEnumerator waitHide() { yield return null; yield return (object)new WaitForSeconds(1f); HideAllConstraintRopes(); } private static void showAllConstraintRopes() { ConstraintTracker[] array = Il2CppArrayBase.op_Implicit(Object.FindObjectsOfType(true)); ConstraintTracker[] array2 = array; foreach (ConstraintTracker val in array2) { if (!((Object)(object)val == (Object)null) && !((Il2CppObjectBase)val).WasCollected) { GameObject gameObject = ((Component)val).gameObject; if (!((Object)(object)gameObject == (Object)null)) { setRopeRenderers(gameObject, show: true); } } } } private static void HideAllConstraintRopes() { ConstraintTracker[] array = Il2CppArrayBase.op_Implicit(Object.FindObjectsOfType(true)); ConstraintTracker[] array2 = array; foreach (ConstraintTracker val in array2) { if (!((Object)(object)val == (Object)null) && !((Il2CppObjectBase)val).WasCollected) { GameObject gameObject = ((Component)val).gameObject; if (!((Object)(object)gameObject == (Object)null)) { setRopeRenderers(gameObject, show: false); } } } } private static void setRopeRenderers(GameObject root, bool show) { LineRenderer[] array = Il2CppArrayBase.op_Implicit(root.GetComponentsInChildren(true)); LineRenderer[] array2 = array; foreach (LineRenderer val in array2) { if (!((Object)(object)val == (Object)null) && !((Il2CppObjectBase)val).WasCollected) { ((Renderer)val).enabled = show; } } Renderer[] array3 = Il2CppArrayBase.op_Implicit(root.GetComponentsInChildren(true)); Renderer[] array4 = array3; foreach (Renderer val2 in array4) { if (!((Object)(object)val2 == (Object)null) && !((Il2CppObjectBase)val2).WasCollected) { string text = ((Object)((Component)val2).gameObject).name.ToLowerInvariant(); if (text.Contains("line")) { val2.enabled = show; } if (text.Contains("rope")) { val2.enabled = show; } if (text.Contains("cable")) { val2.enabled = show; } if (text.Contains("beam")) { val2.enabled = show; } } } } private static IEnumerator waitNewConstraint() { yield return null; yield return null; yield return (object)new WaitForSeconds(0.05f); HideAllConstraintRopes(); } } }