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 RemoveAshlandsHeatHaze v0.0.1
plugins\RemoveAshlandsHeatHaze.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Jotunn; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using RemoveAshlandsHeatHaze.Helpers; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("RemoveAshlandsHeatHaze")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RemoveAshlandsHeatHaze")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] namespace RemoveAshlandsHeatHaze { [BepInPlugin("DeathWizsh.RemoveAshlandsHeatHaze", "RemoveAshlandsHeatHaze", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class RemoveAshlandsHeatHaze : BaseUnityPlugin { public const string PluginGUID = "DeathWizsh.RemoveAshlandsHeatHaze"; public const string PluginName = "RemoveAshlandsHeatHaze"; public const string PluginVersion = "0.0.1"; private static readonly Harmony harmony = new Harmony("DeathWizsh.RemoveAshlandsHeatHaze"); public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization(); private void Awake() { harmony.PatchAll(Assembly.GetExecutingAssembly()); } } } namespace RemoveAshlandsHeatHaze.Helpers { internal static class AshlandsHeatHazeHelper { private const string NameFilter = "HeatDistortion"; private static readonly List<GameObject> _targets = new List<GameObject>(); private static bool _found; private static float _nextSearchTime; public static void SuppressIfActive(string envName) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 if (!_found) { if ((Object)(object)Player.m_localPlayer != (Object)null && (int)Player.m_localPlayer.GetCurrentBiome() == 32 && Time.unscaledTime >= _nextSearchTime) { FindTargets(); _nextSearchTime = Time.unscaledTime + 3f; } if (!_found) { return; } } foreach (GameObject target in _targets) { if ((Object)(object)target != (Object)null && target.activeSelf) { Logger.LogWarning((object)("[RemoveAshlandsHeatHaze] Suppressing '" + ((Object)target).name + "' (weather: " + envName + ").")); target.SetActive(false); } } } private static void FindTargets() { //IL_0014: 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) Transform[] array = Resources.FindObjectsOfTypeAll<Transform>(); foreach (Transform val in array) { Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Object)val).name.IndexOf("HeatDistortion", StringComparison.OrdinalIgnoreCase) >= 0 && !_targets.Contains(((Component)val).gameObject)) { _targets.Add(((Component)val).gameObject); } } if (_targets.Count > 0) { _found = true; Logger.LogWarning((object)("[RemoveAshlandsHeatHaze] Found heat-haze object(s): " + string.Join(", ", _targets.Select((GameObject g) => ((Object)g).name)))); } } } } namespace RemoveAshlandsHeatHaze.Harmony { [HarmonyPatch] public class EnvManPatches { [HarmonyPostfix] [HarmonyPatch(typeof(EnvMan), "SetEnv")] public static void SetEnv_Postfix(EnvSetup env) { try { AshlandsHeatHazeHelper.SuppressIfActive(env?.m_name); } catch (Exception ex) { Logger.LogError((object)("Something went wrong in EnvMan.SetEnv_Postfix: " + ex)); } } } }