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 RemoverOfFog v1.0.5
BepInEx/plugins/Azure0219-RemoverOfFog/FogRemover.dll
Decompiled 21 hours agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FogRemover.Components; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FogRemover")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c0a12d6585c2d677b0a52cff774c2cb6d981cda4")] [assembly: AssemblyProduct("FogRemover")] [assembly: AssemblyTitle("FogRemover")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [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 FogRemover { [BepInPlugin("grug.lethalcompany.fogremover", "Remove fog", "1.0.5")] public class FogRemover : BaseUnityPlugin { public const string modGUID = "grug.lethalcompany.fogremover"; public const string modName = "Remove fog"; public const string modVersion = "1.0.5"; private readonly Harmony harmony = new Harmony("grug.lethalcompany.fogremover"); public static ManualLogSource mls; private static FogRemover instance; public static GameObject holder; public static ConfigEntry<bool> disableAll; public void Awake() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown disableAll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "All fog disable?", false, "This may cause major amounts of lag. Use at your own risk."); mls = ((BaseUnityPlugin)this).Logger; if ((Object)(object)instance == (Object)null) { instance = this; } if ((Object)(object)holder == (Object)null) { holder = new GameObject("FogRemoverHolder"); Object.DontDestroyOnLoad((Object)(object)holder); ((Object)holder).hideFlags = (HideFlags)61; holder.AddComponent<RemoveFog>(); } } } [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPrefabPatch { private static readonly string MOD_GUID = "grug.lethalcompany.fogremover"; [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0017: 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) GameObject val = new GameObject(MOD_GUID + " Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj, GetHash(MOD_GUID)); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); } private static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } namespace FogRemover.Components { internal class RemoveFog : MonoBehaviour { private bool initialized; public void Awake() { FogRemover.mls.LogInfo((object)"Removing fog..."); } public void Update() { if (initialized) { return; } Volume[] array = Object.FindObjectsOfType<Volume>(); Fog val2 = default(Fog); Fog val3 = default(Fog); foreach (Volume val in array) { if (FogRemover.disableAll.Value) { if ((Object)(object)val.sharedProfile != (Object)null && val.sharedProfile.TryGet<Fog>(ref val2)) { ((VolumeComponent)val2).active = false; ((VolumeParameter<bool>)(object)val2.enabled).value = false; ((VolumeParameter)val2.enabled).overrideState = false; FogRemover.mls.LogInfo((object)"Fog removed"); } } else if (((Object)((Component)val).gameObject).name == "VolumeMain" && (Object)(object)val.sharedProfile != (Object)null && val.sharedProfile.TryGet<Fog>(ref val3)) { ((VolumeComponent)val3).active = false; ((VolumeParameter<bool>)(object)val3.enabled).value = false; ((VolumeParameter)val3.enabled).overrideState = false; FogRemover.mls.LogInfo((object)"Fog removed"); } } initialized = true; } public void OnEnable() { initialized = false; } } }