using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using ForeverAloneP6; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Pool; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [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), "ForeverAlonePatch6", "1.1.0", "YourName", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ForeverAloneP6")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ForeverAloneP6")] [assembly: AssemblyTitle("ForeverAloneP6")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ForeverAloneP6 { public class Class1 { } public class Core : MelonMod { private static readonly string[] SceneObjectNamesToHide = new string[10] { "peasant", "cultist", "staticvillagers", "jimmy_v5", "articulatedarm", "forcefields", "elevators", "heavyhunterchopper", "mirror_animation", "progpoint" }; private static readonly string[] ForceEnable = new string[4] { "loadbuttons", "4melevatorshaft", "float_powered_entity", "shaftsegment" }; private static readonly List _forceEnableCache = new List(); private float _recheckTimer = 0f; public override void OnInitializeMelon() { ((MelonBase)this).HarmonyInstance.PatchAll(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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) Scene sceneByName = SceneManager.GetSceneByName(sceneName); if (((Scene)(ref sceneByName)).IsValid()) { FullScanAndApply(sceneByName); } } public override void OnUpdate() { _recheckTimer += Time.deltaTime; if (_recheckTimer < 2f) { return; } _recheckTimer = 0f; foreach (GameObject item in _forceEnableCache) { if (!((Object)(object)item == (Object)null)) { ForceEnableObject(item); } } } private void FullScanAndApply(Scene scene) { _forceEnableCache.Clear(); int num = 0; int num2 = 0; foreach (GameObject item in (Il2CppArrayBase)(object)((Scene)(ref scene)).GetRootGameObjects()) { Il2CppArrayBase componentsInChildren = item.GetComponentsInChildren(true); foreach (Transform item2 in componentsInChildren) { if (!((Object)(object)item2 == (Object)null)) { string lowerName = ((Object)item2).name.ToLowerInvariant(); if (ForceEnable.Any((string key) => lowerName.Contains(key))) { _forceEnableCache.Add(((Component)item2).gameObject); ForceEnableObject(((Component)item2).gameObject); num2++; } else if (SceneObjectNamesToHide.Any((string key) => lowerName.Contains(key))) { ((Component)item2).gameObject.SetActive(false); num++; } } } } if (num > 0 || num2 > 0) { MelonLogger.Msg($"[Core] Hid {num}, force-enabled {num2} object(s) in '{((Scene)(ref scene)).name}'."); } } private void ForceEnableObject(GameObject go) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 if (!go.activeSelf) { go.SetActive(true); } foreach (Collider componentsInChild in go.GetComponentsInChildren(true)) { if ((Object)(object)componentsInChild != (Object)null && !componentsInChild.enabled) { componentsInChild.enabled = true; } } foreach (MonoBehaviour componentsInChild2 in go.GetComponentsInChildren(true)) { if ((Object)(object)componentsInChild2 != (Object)null && !((Behaviour)componentsInChild2).enabled) { ((Behaviour)componentsInChild2).enabled = true; } } foreach (Rigidbody componentsInChild3 in go.GetComponentsInChildren(true)) { if ((Object)(object)componentsInChild3 != (Object)null && (int)componentsInChild3.constraints == 126) { componentsInChild3.constraints = (RigidbodyConstraints)0; } } } } [HarmonyPatch(typeof(Poolee), "OnSpawn")] public class SpawnPatch { public static void Postfix(Poolee __instance) { if (!((Object)(object)__instance == (Object)null)) { MelonLogger.Msg("[SpawnPatch] OnSpawn fired for: " + ((Object)((Component)__instance).gameObject).name); AIBrain component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null) { MelonLogger.Msg("[SpawnPatch] AIBrain found on: " + ((Object)((Component)__instance).gameObject).name + " — destroying."); Object.Destroy((Object)(object)((Component)component).gameObject); } Transform val = ((Component)__instance).gameObject.transform.Find("AudioSourceAnnouncement"); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } Transform val2 = ((Component)__instance).gameObject.transform.Find("AudioSourceBase"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } } } } }