Decompiled source of Lights Out v1.1.2

lights_out.dll

Decompiled 2 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("crazystupidshit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("crazystupidshit")]
[assembly: AssemblyTitle("crazystupidshit")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 Lights_Out
{
	[BepInPlugin("lotus.ultrakill.Lights_Out", "Lights_Out", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		private PluginConfigurator config;

		private BoolField enabler;

		private BoolField flashlightenabler;

		public ManualLogSource log => ((BaseUnityPlugin)this).Logger;

		public void Awake()
		{
			Instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)4;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Lights Out Loaded");
			SceneManager.sceneLoaded += delegate
			{
				OnSceneLoaded();
			};
			createConfig();
		}

		public void createConfig()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			log.LogInfo((object)"Creating config");
			config = PluginConfigurator.Create("Lights Out", "Lights_Out_GUID");
			enabler = new BoolField(config.rootPanel, "Enabled", "enabler", true);
			flashlightenabler = new BoolField(config.rootPanel, "Nightmare mode", "flashlightenabler", true);
			log.LogInfo((object)"Config created");
		}

		public void OnSceneLoaded()
		{
			if (!enabler.value)
			{
				return;
			}
			Light[] array = Object.FindObjectsOfType<Light>(true);
			Light[] array2 = array;
			foreach (Light val in array2)
			{
				if (!Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Enemy>(true)) && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<EnemyIdentifierIdentifier>(true)) && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<HookPoint>(true)) && !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Skull>(true)))
				{
					Object.Destroy((Object)(object)val);
				}
			}
			if (flashlightenabler.value)
			{
				Light val2 = ((Component)MonoSingleton<CameraController>.Instance).gameObject.AddComponent<Light>();
				((Component)val2).gameObject.AddComponent<PortalAwareLight>();
				val2.type = (LightType)0;
				val2.spotAngle = 120f;
				val2.intensity = 2.5f;
				val2.range = 120f;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}