Decompiled source of Invisible Mountain v1.0.1

ClassLibrary7.dll

Decompiled 6 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyTitle("ClassLibrary7")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary7")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4ee0ce42-511a-4b37-8cec-421415119138")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Gemini.Foddy.InvisibleMountain;

[BepInPlugin("com.user.goi.invisiblemountain", "Getting Over It Invisible Mountain", "1.2.0")]
[BepInProcess("GettingOverIt.exe")]
public class InvisibleMountainMod : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <InitializeInvisibleMountain>d__5 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public InvisibleMountainMod <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <InitializeInvisibleMountain>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.HideSpecificMountainMeshes();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private bool mountainHidden = false;

	private void Awake()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		ResetAndApply();
	}

	private void Update()
	{
		if (!mountainHidden)
		{
			HideSpecificMountainMeshes();
		}
	}

	private void ResetAndApply()
	{
		mountainHidden = false;
		((MonoBehaviour)this).StartCoroutine(InitializeInvisibleMountain());
	}

	[IteratorStateMachine(typeof(<InitializeInvisibleMountain>d__5))]
	private IEnumerator InitializeInvisibleMountain()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <InitializeInvisibleMountain>d__5(0)
		{
			<>4__this = this
		};
	}

	private void HideSpecificMountainMeshes()
	{
		GameObject[] array = Object.FindObjectsOfType<GameObject>();
		bool flag = false;
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			string text = ((Object)val).name.ToLower();
			if (!(text == "mountain") && !(text == "mountain_nocollide") && !(text == "props"))
			{
				continue;
			}
			MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val2 in componentsInChildren)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					((Renderer)val2).enabled = false;
				}
			}
			SkinnedMeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val3 in componentsInChildren2)
			{
				if ((Object)(object)val3 != (Object)null)
				{
					((Renderer)val3).enabled = false;
				}
			}
			flag = true;
		}
		if (flag)
		{
			mountainHidden = true;
		}
	}
}