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 MushTestPack v1.0.1
BepInEx/plugins/BetterLights.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterLights")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterLights")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("12bba4e0-b44f-4506-b6e9-66809878ed49")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public static class PluginInfo { public const string PLUGIN_GUID = "MushLights"; public const string PLUGIN_NAME = "MushLights"; public const string PLUGIN_VERSION = "1.0.1"; } namespace MushLights; [BepInPlugin("MushLights", "MushLights", "1.0.1")] public class MushLights : BaseUnityPlugin { private static GameObject gameObject; private void Awake() { Harmony.CreateAndPatchAll(typeof(MushLights), (string)null); } [HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void PostfixOnPlayerConnectedClientRpc(StartOfRound __instance, ulong clientId, int connectedPlayers, ulong[] connectedPlayerIdsOrdered, int assignedPlayerObjectId, int serverMoneyAmount, int levelID, int profitQuota, int timeUntilDeadline, int quotaFulfilled, int randomSeed) { if (clientId == NetworkManager.Singleton.LocalClientId) { DoAllTheThings(); } } [HarmonyPatch(typeof(StartOfRound), "LoadUnlockables")] [HarmonyPostfix] private static void PostfixLoadUnlockables(StartOfRound __instance) { DoAllTheThings(); } private static void DoAllTheThings() { makeObjectsGlow(); spawnStorageLights(); } private static void makeObjectsGlow() { //IL_004a: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) _ = GameNetworkManager.Instance.localPlayerController; GameObject[] array = GameObject.FindGameObjectsWithTag("InteractTrigger"); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == "LightSwitch") { makeEmissive(array[i], new Color32((byte)182, (byte)240, (byte)150, (byte)102)); makeEmissive(((Component)array[i].transform.GetChild(0)).gameObject, new Color32((byte)241, (byte)80, (byte)80, (byte)10), 0.15f); } if (((Object)array[i]).name == "Trigger") { GameObject val = ((Component)array[i].transform.parent.parent).gameObject; GameObject val2 = new GameObject("ChargeStationLight"); Light val3 = val2.AddComponent<Light>(); val3.type = (LightType)2; val3.color = Color32.op_Implicit(new Color32((byte)240, (byte)240, (byte)140, byte.MaxValue)); val3.intensity = 0.05f; val3.range = 0.3f; val3.shadows = (LightShadows)2; val2.layer = LayerMask.NameToLayer("Room"); val2.transform.localPosition = new Vector3(0.5f, 0f, 0f); val2.transform.SetParent(val.transform, false); } } } private static void makeEmissive(GameObject gameObject, Color32 glowColor, float brightness = 0.02f) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //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_001c: 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) MeshRenderer component = gameObject.GetComponent<MeshRenderer>(); Color val = Color32.op_Implicit(glowColor); Material material = ((Renderer)component).material; material.SetColor("_EmissiveColor", val * brightness); ((Renderer)component).material = material; } private static void spawnStorageLights() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_00e7: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>(); for (int i = 0; i < array.Length; i++) { UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID]; _ = val.unlockableType; if (val.unlockableName == "Cupboard") { gameObject = ((Component)array[i].parentObject).gameObject; break; } } if (!((Object)gameObject == (Object)null)) { float num = -1.1175f; List<float> list = new List<float> { 2.804f, 2.163f, 1.48f, 0.999f }; float num2 = 0.55f; float num3 = list[0]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); num3 = list[1]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); num3 = list[2]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3), 2f); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3), 2f); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3), 2f); num3 = list[3]; AttachLightToStorageCloset(gameObject, new Vector3(num - num2, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num, 0.4f, num3)); AttachLightToStorageCloset(gameObject, new Vector3(num + num2, 0.4f, num3)); } } private static void AttachLightToStorageCloset(GameObject closet, Vector3 lightPositionOffset, float intensity = 3f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b8: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("StorageClosetLight"); MeshFilter val2 = val.AddComponent<MeshFilter>(); MeshRenderer val3 = val.AddComponent<MeshRenderer>(); GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0); val2.mesh = val4.GetComponent<MeshFilter>().mesh; Material val5 = new Material(Shader.Find("HDRP/Lit")); Color val6 = Color32.op_Implicit(new Color32((byte)249, (byte)240, (byte)202, byte.MaxValue)); val5.SetColor("_BaseColor", val6); float num = 1f; val5.SetColor("_EmissiveColor", val6 * num); ((Renderer)val3).material = val5; Object.DestroyImmediate((Object)val4); Light val7 = val.AddComponent<Light>(); val7.type = (LightType)0; val7.color = val6; val7.intensity = intensity; val7.range = 1.05f; val7.spotAngle = 125f; val7.shadows = (LightShadows)2; val.layer = LayerMask.NameToLayer("Room"); val.transform.localScale = new Vector3(0.125f, 0.125f, 0.04f); val.transform.localPosition = lightPositionOffset; val.transform.rotation = Quaternion.Euler(170f, 0f, 0f); val.transform.SetParent(closet.transform, false); } private static string padString(string baseStr, char padChar, int width) { int totalWidth = (width - (baseStr.Length + 8)) / 2 + (baseStr.Length + 8); return (" " + baseStr + " ").PadLeft(totalWidth, padChar).PadRight(width, padChar); } private static void obviousDebug(string baseStr) { } }