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 CelestialTintShadowFix v1.0.0
CelestialTintShadowFix.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CelestialTintShadowFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A small patch to fix celestial tint shadow cascading")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("CelestialTintShadowFix")] [assembly: AssemblyTitle("CelestialTintShadowFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 CelestialTintShadowFix { [BepInPlugin("funky.celestialTintShadowFix", "CelestialTintShadowFix", "1.0.0")] public class CTShadowFix : BaseUnityPlugin { public const string modGUID = "funky.celestialTintShadowFix"; public const string modName = "CelestialTintShadowFix"; public const string modVersion = "1.0.0"; private Harmony _harmony = new Harmony("funky.celestialTintShadowFix"); internal static ManualLogSource mls = Logger.CreateLogSource("funky.celestialTintShadowFix"); private void Awake() { mls.LogInfo((object)"Awake called, patching methods for CelestialTintShadowFix"); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { FixDirectionalLights(); } private void FixDirectionalLights() { List<Light> list = (from l in Object.FindObjectsOfType<Light>() where (int)l.type == 1 select l).ToList(); if (list.Count <= 1) { mls.LogDebug((object)$"Found {list.Count} directional light(s). No need to adjust shadows."); return; } try { mls.LogDebug((object)$"Found {list.Count} directional lights. Setting shadows to None for all but the brightest one"); Light val = list.OrderByDescending((Light l) => l.intensity).First(); foreach (Light item in list) { if ((Object)(object)item != (Object)(object)val) { mls.LogDebug((object)$"Setting shadows to None for light: {((Object)item).name} with intensity {item.intensity}"); item.shadows = (LightShadows)0; } } } catch (Exception arg) { mls.LogError((object)$"Error while fixing directional lights: {arg}"); } } } public static class PluginInfo { public const string PLUGIN_GUID = "CelestialTintShadowFix"; public const string PLUGIN_NAME = "CelestialTintShadowFix"; public const string PLUGIN_VERSION = "0.1.0"; } }