Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NewGameMirrorDecor v1.0.0
BepInEx/plugins/NewGameMirrorDecor/NewGameMirrorDecor.dll
Decompiled 16 hours agousing System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NewGameMirrorDecor")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NewGameMirrorDecor")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("288494e5-a426-47c5-be47-17505ff2065d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace NewGameMirrorDecor; [BepInPlugin("Edwin.NewGameMirrorDecor", "New Game Mirror Decor", "1.0.0.0")] public class NewGameMirrorDecor : BaseUnityPlugin { public const string modGUID = "Edwin.NewGameMirrorDecor"; public const string modName = "New Game Mirror Decor"; public const string modVersion = "1.0.0.0"; internal static ManualLogSource Log; private readonly Harmony harmony = new Harmony("Edwin.NewGameMirrorDecor"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(typeof(UnlockMirrorOnStart)); } } [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] internal class UnlockMirrorOnStart { private const string MirrorName = "Mirror"; private const string SuitRackPath = "Environment/HangarShip/NurbsPath.002"; [HarmonyPostfix] private static void Postfix(ref StartOfRound __instance) { if (!((NetworkBehaviour)__instance).IsServer) { return; } List<UnlockableItem> unlockables = __instance.unlockablesList.unlockables; int num = -1; UnlockableItem val = null; for (int i = 0; i < unlockables.Count; i++) { UnlockableItem val2 = unlockables[i]; if (!(val2.unlockableName != "Mirror")) { num = i; val = val2; } } if (val == null || num < 0) { NewGameMirrorDecor.Log.LogError((object)"Could not find `Mirror` in the list of ship unlocks. Is the `MirrorDecor` mod installed?"); } else if (!val.hasBeenUnlockedByPlayer && !val.alreadyUnlocked) { Terminal val3 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val3 == (Object)null) { NewGameMirrorDecor.Log.LogError((object)"The terminal object was not found. Cannot unlock `Mirror`."); return; } __instance.BuyShipUnlockableServerRpc(num, val3.groupCredits); NewGameMirrorDecor.Log.LogInfo((object)"Unlocked `Mirror`."); ((MonoBehaviour)__instance).StartCoroutine(FindAndMoveMirror(num)); } } private static IEnumerator FindAndMoveMirror(int mirrorId) { PlaceableShipObject mirrorObj = null; int tries = 100; while (tries > 0 && (Object)(object)mirrorObj == (Object)null) { PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); foreach (PlaceableShipObject val in array) { if (val.unlockableID == mirrorId) { mirrorObj = val; break; } } if ((Object)(object)mirrorObj == (Object)null) { yield return (object)new WaitForSeconds(0.1f); } tries--; } if ((Object)(object)mirrorObj == (Object)null) { NewGameMirrorDecor.Log.LogError((object)"Could not move `Mirror`: The object was never spawned."); yield break; } GameObject val2 = GameObject.Find("Environment/HangarShip/NurbsPath.002"); if ((Object)(object)val2 == (Object)null) { NewGameMirrorDecor.Log.LogError((object)"Could not find suit rack at path `Environment/HangarShip/NurbsPath.002`."); yield break; } float y = ((Component)mirrorObj).transform.position.y; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(-1.84f, -0.06f, -0.16f); Vector3 val4 = val2.transform.TransformPoint(val3); val4.y = y; Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(270f, -90f, 90f); ShipBuildModeManager.Instance.PlaceShipObject(val4, val5, mirrorObj, false); NewGameMirrorDecor.Log.LogInfo((object)string.Format("Moved `{0}` next to suit rack ({1}, {2}, {3}).", "Mirror", val4.x, val4.y, val4.z)); } }