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 MrovWeathers v0.0.7
MrovWeathers.dll
Decompiled 2 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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MrovLib; using MrovLib.Events; using UnityEngine; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using WeatherRegistry; using WeatherRegistry.Definitions; using WeatherRegistry.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("WeatherRegistry")] [assembly: AssemblyCompany("MrovWeathers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("0.0.7.0")] [assembly: AssemblyInformationalVersion("0.0.7+62ffd68b2cee5f81377712542d5f6daec41de42d")] [assembly: AssemblyProduct("MrovWeathers")] [assembly: AssemblyTitle("MrovWeathers")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/AndreyMrovol/MrovWeathers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.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 MrovWeathers { public class LevelListConfigHandler : LevelListConfigHandler { public override SelectableLevel[] Value => ConfigHelper.ConvertStringToLevels(((ConfigHandler<SelectableLevel[], string>)(object)this).ConfigEntry.Value); public LevelListConfigHandler(string defaultValue, bool enabled = true) : base(defaultValue, enabled) { } public void CreateConfigEntry(string configTitle, ConfigDescription configDescription = null) { ((ConfigHandler<SelectableLevel[], string>)(object)this).ConfigEntry = ConfigManager.configFile.Bind<string>("Foggy", configTitle, ((ConfigHandler<SelectableLevel[], string>)(object)this).DefaultValue, configDescription); } } public class ConfigManager { internal static ConfigFile configFile; public static LevelListConfigHandler FoggyIgnoreLevels; public static ConfigManager Instance { get; private set; } public static void Init(ConfigFile config) { Instance = new ConfigManager(config); } private ConfigManager(ConfigFile config) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown configFile = config; FoggyIgnoreLevels = new LevelListConfigHandler("", enabled: false); FoggyIgnoreLevels.CreateConfigEntry("Foggy weather override", new ConfigDescription("Levels to blacklist fog override from applying on (semicolon-separated)", (AcceptableValueBase)null, Array.Empty<object>())); } } internal class FoggyPatches { public static void CreateEffectOverrides() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown Plugin.logger.LogInfo((object)"CreateEffectOverrides called"); Weather weather = WeatherManager.GetWeather((LevelWeatherType)3); ImprovedWeatherEffect val = new ImprovedWeatherEffect(weather.Effect.EffectObject, Object.Instantiate<GameObject>(weather.Effect.WorldObject)); GameObject worldObject = val.WorldObject; LocalVolumetricFog component = worldObject.GetComponent<LocalVolumetricFog>(); LocalVolumetricFog item = ChangeFogParams(component); List<LocalVolumetricFog> list = worldObject.GetComponents<LocalVolumetricFog>().ToList(); list.Remove(component); list.Add(item); val.WorldObject = worldObject; foreach (SelectableLevel level in LevelHelper.Levels) { if (!((ConfigHandler<SelectableLevel[], string>)(object)ConfigManager.FoggyIgnoreLevels).Value.Contains(level)) { WeatherEffectOverride val2 = new WeatherEffectOverride(weather, level, val, "SuperFoggy", ColorConverter.ToTMPColorGradient(Color.red), 1f); } } } public static LocalVolumetricFog ChangeFogParams(LocalVolumetricFog Fog) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogInfo((object)"ChangeFog called"); Plugin.logger.LogInfo((object)$"is null? {(Object)(object)Fog == (Object)null}"); try { LocalVolumetricFogArtistParameters parameters = Fog.parameters; Plugin.DebugLogger.LogWarning($"FOG: {((Object)Fog).name} {parameters.size} {((Component)Fog).transform.position} {parameters.albedo} {parameters.meanFreePath}"); ((Component)Fog).transform.position = new Vector3(((Component)Fog).transform.position.x, ((Component)Fog).transform.position.y + 128f, ((Component)Fog).transform.position.z); parameters.albedo = new Color(0.25f, 0.35f, 0.55f, 1f); parameters.meanFreePath = 11f; parameters.falloffMode = (LocalVolumetricFogFalloffMode)0; parameters.distanceFadeEnd = 200f; parameters.distanceFadeStart = 0f; parameters.blendingMode = (LocalVolumetricFogBlendingMode)1; parameters.size.y += 256f; parameters.size.x *= 5f; parameters.size.z *= 5f; Plugin.DebugLogger.LogWarning($"FOG: {((Object)Fog).name} {parameters.size} {((Component)Fog).transform.position} {parameters.albedo} {parameters.meanFreePath}"); Fog.parameters = parameters; } catch (Exception) { Plugin.logger.LogWarning((object)"Failed to change fog"); } return Fog; } public static void ToggleFogExclusionZones(SelectableLevel level, bool enable = true) { Plugin.logger.LogDebug((object)"DisableFogExclusionZones called"); List<GameObject> list = (from obj in Object.FindObjectsOfType<GameObject>() where ((Object)obj).name == "FogExclusionZone" select obj).ToList(); foreach (GameObject item in list) { if (!(((Object)item.transform.parent).name == "HangarShip")) { Plugin.DebugLogger.LogDebug($"Setting fog exclusion zone {((Object)item).name} (parent {((Object)item.transform.parent).name}) to {enable}"); item.SetActive(enable); } } } } public static class InitWeathers { public static Weather Blackout; public static Weather Cloudy; public static void Init() { InitCloudy(); InitBlackout(); } public static void InitCloudy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown Weather val = new Weather("Cloudy", new ImprovedWeatherEffect((GameObject)null, (GameObject)null) { SunAnimatorBool = "overcast" }); val.Color = new Color(0f, 1f, 0.55f, 1f); val.Config.ScrapAmountMultiplier = new FloatConfigHandler(1.6f, true); val.Config.ScrapValueMultiplier = new FloatConfigHandler(0.8f, true); val.Config.WeatherToWeatherWeights = new WeatherWeightsConfigHandler(new string[2] { "Eclipsed@50", "Stormy@80" }, true); val.Config.DefaultWeight = new IntegerConfigHandler(25, true); Cloudy = val; WeatherManager.RegisterWeather(Cloudy); } public static void InitBlackout() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00b5: 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_00cb: Expected O, but got Unknown //IL_00d0: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(new GameObject { name = "BlackoutWeather" }); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<Blackout>(); Blackout = new Weather("Blackout", new ImprovedWeatherEffect((GameObject)null, val) { SunAnimatorBool = "eclipse" }) { Color = new Color(0.5f, 0.4f, 0.5f, 1f), Config = { ScrapAmountMultiplier = new FloatConfigHandler(0.65f, true) }, Config = { ScrapValueMultiplier = new FloatConfigHandler(1.7f, true) }, Config = { DefaultWeight = new IntegerConfigHandler(35, true) }, Config = { LevelWeights = new LevelWeightsConfigHandler("Rend@200; Dine@200; Titan@200", true) }, Config = { WeatherToWeatherWeights = new WeatherWeightsConfigHandler("None@200; Cloudy@250", true) } }; WeatherManager.RegisterWeather(Blackout); } } public class LightUtils { public static List<Light> GetLightsInScene(string sceneName) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) List<Light> list = new List<Light>(); Scene sceneByName = SceneManager.GetSceneByName(sceneName); if (!((Scene)(ref sceneByName)).isLoaded) { Plugin.DebugLogger.LogWarning("Scene " + sceneName + " is not loaded!"); return list; } GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); GameObject[] array = rootGameObjects; foreach (GameObject val in array) { Light[] componentsInChildren = val.GetComponentsInChildren<Light>(true); list.AddRange(componentsInChildren); } return list; } public static List<Light> GetLightsUnderParent(Transform parent, bool includeInactive = true) { List<Light> list = new List<Light>(); if ((Object)(object)parent == (Object)null) { return list; } Light[] componentsInChildren = ((Component)parent).GetComponentsInChildren<Light>(includeInactive); list.AddRange(componentsInChildren); return list; } public static List<Light> GetLightsInSceneUnderParent(string sceneName, string parentName, bool includeInactive = true) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) List<Light> list = new List<Light>(); Scene sceneByName = SceneManager.GetSceneByName(sceneName); if (!((Scene)(ref sceneByName)).isLoaded) { Plugin.DebugLogger.LogWarning("Scene " + sceneName + " is not loaded!"); return list; } GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); GameObject[] array = rootGameObjects; foreach (GameObject val in array) { if (((Object)val).name == parentName) { list.AddRange(GetLightsUnderParent(val.transform, includeInactive)); break; } Transform val2 = val.transform.Find(parentName); if ((Object)(object)val2 != (Object)null) { list.AddRange(GetLightsUnderParent(val2, includeInactive)); break; } } return list; } public static Dictionary<string, List<Light>> GetLightsInScenes(string[] sceneNames) { Dictionary<string, List<Light>> dictionary = new Dictionary<string, List<Light>>(); foreach (string text in sceneNames) { dictionary[text] = GetLightsInScene(text); } return dictionary; } public static Light[] GetAllLightsInScene(bool includeInactive = true) { return Resources.FindObjectsOfTypeAll<Light>(); } public static Light[] GetActiveLightsInScene() { return Object.FindObjectsOfType<Light>(); } public static List<Light> GetLightsByType(LightType lightType) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Light[] allLightsInScene = GetAllLightsInScene(); List<Light> list = new List<Light>(); Light[] array = allLightsInScene; foreach (Light val in array) { if (val.type == lightType) { list.Add(val); } } return list; } } [BepInPlugin("MrovWeathers", "MrovWeathers", "0.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ParameterEvent<(SelectableLevel level, Weather weather)> <>9__4_0; public static Event <>9__4_1; public static Event <>9__4_2; internal void <Awake>b__4_0((SelectableLevel level, Weather weather) args) { FoggyPatches.ToggleFogExclusionZones(args.level, enable: false); } internal void <Awake>b__4_1() { FoggyPatches.ToggleFogExclusionZones(StartOfRound.Instance.currentLevel); } internal void <Awake>b__4_2() { FoggyPatches.CreateEffectOverrides(); } } internal static ManualLogSource logger; internal static Logger DebugLogger = new Logger("MrovWeathers"); internal static Harmony harmony = new Harmony("MrovWeathers"); internal static PluginInfo PluginInformation; private void Awake() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown logger = ((BaseUnityPlugin)this).Logger; harmony.PatchAll(); ConfigManager.Init(((BaseUnityPlugin)this).Config); PluginInformation = ((BaseUnityPlugin)this).Info; InitWeathers.Init(); ((CustomEvent<(SelectableLevel, Weather)>)(object)EventManager.ShipLanding).AddListener((ParameterEvent<(SelectableLevel, Weather)>)delegate((SelectableLevel level, Weather weather) args) { FoggyPatches.ToggleFogExclusionZones(args.level, enable: false); }); WeatherRegistryEvent disableAllWeathers = EventManager.DisableAllWeathers; object obj = <>c.<>9__4_1; if (obj == null) { Event val = delegate { FoggyPatches.ToggleFogExclusionZones(StartOfRound.Instance.currentLevel); }; <>c.<>9__4_1 = val; obj = (object)val; } ((CustomEvent)disableAllWeathers).AddListener((Event)obj); WeatherRegistryEvent setupFinished = EventManager.SetupFinished; object obj2 = <>c.<>9__4_2; if (obj2 == null) { Event val2 = delegate { FoggyPatches.CreateEffectOverrides(); }; <>c.<>9__4_2 = val2; obj2 = (object)val2; } ((CustomEvent)setupFinished).AddListener((Event)obj2); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MrovWeathers is loaded!"); } } public class Blackout : MonoBehaviour { private List<Light> AllPoweredLights = new List<Light>(); private List<HDAdditionalLightData> Floodlights = new List<HDAdditionalLightData>(); private float FloodlightRange = 44f; private float FloodlightAngle = 116.7f; private float FloodlightIntensity = 762f; private Logger Logger => Plugin.DebugLogger; private void OnEnable() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!WeatherManager.IsSetupFinished) { Logger.LogError("WeatherManager is not set up yet!"); return; } LungProp val = Object.FindObjectOfType<LungProp>(); ItemDropship val2 = Object.FindObjectOfType<ItemDropship>(); List<Light> lightsUnderParent = LightUtils.GetLightsUnderParent(((Component)val2).transform); Scene sceneByName = SceneManager.GetSceneByName(StartOfRound.Instance.currentLevel.sceneName); List<Light> list = (from rootObject in ((Scene)(ref sceneByName)).GetRootGameObjects() where ((Object)rootObject).name.Contains("Turret") select rootObject).SelectMany((GameObject turret) => LightUtils.GetLightsUnderParent(turret.transform)).ToList(); List<Light> list2 = (from obj in Object.FindObjectsOfType<GameObject>() where ((Object)obj).name == "BlackoutIgnore" select obj).SelectMany((GameObject obj) => LightUtils.GetLightsUnderParent(obj.transform)).ToList(); AllPoweredLights = LightUtils.GetLightsInScene(StartOfRound.Instance.currentLevel.sceneName); Logger.LogInfo($"Found {AllPoweredLights.Count} lights in scene {StartOfRound.Instance.currentLevel.sceneName}"); HDAdditionalLightData val3 = default(HDAdditionalLightData); foreach (Light allPoweredLight in AllPoweredLights) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)allPoweredLight).transform.parent == (Object)(object)((Component)val).gameObject.transform) { Logger.LogDebug("Skipping light " + ((Object)allPoweredLight).name + " (parent " + ((Object)((Component)allPoweredLight).transform.parent).name + ")"); ((Component)allPoweredLight).gameObject.TryGetComponent<HDAdditionalLightData>(ref val3); if ((Object)(object)val3 != (Object)null) { val3.SetIntensity(900f); val3.SetRange(80f); } } else if (lightsUnderParent.Contains(allPoweredLight)) { Logger.LogDebug("Skipping light " + ((Object)allPoweredLight).name + " (parent " + ((Object)((Component)allPoweredLight).transform.parent).name + ")"); } else if (list.Contains(allPoweredLight)) { Logger.LogDebug("Skipping turret light " + ((Object)allPoweredLight).name + " (parent " + ((Object)((Component)allPoweredLight).transform.parent).name + ")"); } else if (list2.Contains(allPoweredLight)) { Logger.LogDebug("Skipping light added to ignore-list " + ((Object)allPoweredLight).name + " (parent " + ((Object)((Component)allPoweredLight).transform.parent).name + ")"); } else { Logger.LogDebug("Disabling light " + ((Object)allPoweredLight).name + " (parent " + ((Object)((Component)allPoweredLight).transform.parent).name + ")"); ((Component)allPoweredLight).gameObject.SetActive(false); } } RoundManager.Instance.SwitchPower(true); RoundManager.Instance.TurnOnAllLights(false); BreakerBox val4 = Object.FindObjectOfType<BreakerBox>(); if ((Object)(object)val4 != (Object)null) { ((Component)val4).gameObject.SetActive(false); } GameObject val5 = GameObject.Find("Sun"); if ((Object)(object)val5 != (Object)null) { val5.SetActive(false); } try { Transform component = GameObject.Find("ShipLightsPost").GetComponent<Transform>(); List<Light> lightsUnderParent2 = LightUtils.GetLightsUnderParent(component); Logger.LogInfo($"Found {lightsUnderParent2.Count} floodlights in scene SampleSceneRelay"); HDAdditionalLightData val6 = default(HDAdditionalLightData); foreach (Light item in lightsUnderParent2) { ((Component)item).gameObject.TryGetComponent<HDAdditionalLightData>(ref val6); if ((Object)(object)val6 != (Object)null) { val6.SetIntensity(30000f); val6.SetSpotAngle(120f, 0f); val6.SetRange(600f); Floodlights.Add(val6); } } } catch (Exception arg) { Logger.LogWarning($"Error while trying to modify floodlights: {arg}"); } } private void OnDisable() { if (!WeatherManager.IsSetupFinished) { return; } foreach (HDAdditionalLightData floodlight in Floodlights) { floodlight.SetIntensity(FloodlightIntensity); floodlight.SetSpotAngle(FloodlightAngle, 0f); floodlight.SetRange(FloodlightRange); } AllPoweredLights.Clear(); Floodlights.Clear(); } } public static class PluginInfo { public const string PLUGIN_GUID = "MrovWeathers"; public const string PLUGIN_NAME = "MrovWeathers"; public const string PLUGIN_VERSION = "0.0.7"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }