Decompiled source of Visorless v1.0.0

CustomPassLess.dll

Decompiled 10 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CustomPassLess;

[BepInPlugin("ChubbzCrew.CustomPassLess", "No Custom Pass", "1.0.0")]
[BepInProcess("Lethal Company.exe")]
public class Remover : BaseUnityPlugin
{
	private bool wantedToDestroy = false;

	private bool jobDone = false;

	private bool alreadyWarnned = false;

	private void Awake()
	{
		Object.DontDestroyOnLoad((Object)(object)this);
		((MonoBehaviour)this).StartCoroutine(DelayedInitialization());
	}

	private void OnDestroy()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		if (!wantedToDestroy)
		{
			new GameObject("ThisIsForCustomPassLessGoAheadAndDelete(OrRatherTry)").AddComponent<Remover>();
			((Component)IngamePlayerSettings.Instance).gameObject.AddComponent<Remover>();
			Debug.Log((object)"I'm a persistant bastard");
		}
	}

	private void Update()
	{
		if ((Object)(object)((Component)this).gameObject == (Object)(object)((Component)IngamePlayerSettings.Instance).gameObject)
		{
			DisablePostProcesses();
		}
		else if (Object.op_Implicit((Object)(object)((Component)IngamePlayerSettings.Instance).gameObject.AddComponent<Remover>()))
		{
			wantedToDestroy = true;
			Object.Destroy((Object)(object)this);
		}
	}

	private IEnumerator DelayedInitialization()
	{
		if ((Object)(object)((Component)this).gameObject != (Object)(object)((Component)IngamePlayerSettings.Instance).gameObject)
		{
			((Component)IngamePlayerSettings.Instance).gameObject.AddComponent<Remover>();
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			DisablePostProcesses();
		}
		yield return null;
	}

	public void DisablePostProcesses()
	{
		Debug.Log((object)"aeaa");
		if (jobDone)
		{
			return;
		}
		CustomPassVolume val = Object.FindObjectOfType<CustomPassVolume>();
		if ((Object)(object)val != (Object)null)
		{
			Debug.Log((object)"outline volume located");
			((Behaviour)val).enabled = false;
			Debug.Log((object)"outline volume removed");
			Object.Destroy((Object)(object)((Component)((Component)val).transform.parent.GetChild(2)).GetComponentInChildren<MeshRenderer>());
			Debug.Log((object)"visor renderer destroyed");
			Object.Destroy((Object)(object)((Component)((Component)val).transform.parent.GetChild(2)).GetComponentInChildren<MeshFilter>());
			Debug.Log((object)"visor filter destroyed");
			jobDone = true;
		}
		else
		{
			if (!alreadyWarnned)
			{
				Debug.Log((object)"unable to find outline volume");
			}
			alreadyWarnned = true;
		}
	}
}