Decompiled source of GrassEnabler v3.0.0

Mods/GrassEnabler.dll

Decompiled 21 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using GrassEnabler;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.MoveSystem;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI.RMAPI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "GrassEnabler", "3.0.0", "UlvakSkillz", "https://thunderstore.io/c/rumble/p/UlvakSkillz/GrassEnabler/")]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 7, 2, true)]
[assembly: AssemblyTitle("GrassEnabler")]
[assembly: AssemblyDescription("Shows the Grass in the Gym")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GrassEnabler")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f59cac8-7c2e-4613-b6c2-24e7da20d0ce")]
[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 GrassEnabler;

[RegisterTypeInIl2Cpp]
public class ColliderCheck : MonoBehaviour
{
	private void OnTriggerEnter(Collider other)
	{
		Structure val = ((Component)other).GetComponent<Structure>();
		if ((Object)(object)val == (Object)null)
		{
			val = ((Component)other).GetComponentInParent<Structure>();
		}
		if (!((Object)(object)val == (Object)null) && main.grassRemoval && (val.IsGrounded || val.IsSpawning))
		{
			((Component)((Component)this).transform).gameObject.active = false;
			if (main.grassGrowth)
			{
				MelonCoroutines.Start(main.RegrowGrass(((Component)((Component)this).transform).gameObject));
			}
		}
	}
}
public static class ModBuildInfo
{
	public const string Version = "3.0.0";
}
public class main : MelonMod
{
	[CompilerGenerated]
	private sealed class <InitFlatLandFound>d__27 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

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

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

		[DebuggerHidden]
		public <InitFlatLandFound>d__27(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(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				GameObject.Find("FlatLand/FlatLandButton/Button").GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					<>4__this.flatLandActive = true;
					MelonCoroutines.Start(<>4__this.SetupFlatLand());
				}));
				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();
		}
	}

	[CompilerGenerated]
	private sealed class <MapStartGrassGrow>d__32 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.25f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (<>4__this.currentScene == "Gym")
				{
					<>4__this.storedGrass.transform.position = new Vector3(0f, -0.01f - 0.039f * grassHeight, 0f);
				}
				else if (<>4__this.currentScene == "Park")
				{
					<>4__this.storedGrass.transform.position = new Vector3(-3.1f, -5.88f - 0.039f * grassHeight, 0.4f);
				}
				else if (<>4__this.currentScene == "Map0")
				{
					<>4__this.storedGrass.transform.position = new Vector3(0f, -0.25f - 0.039f * grassHeight, 0f);
				}
				else
				{
					<>4__this.storedGrass.transform.position = new Vector3(0f, 0f - 0.039f * grassHeight, 0f);
				}
				if (grassGrowth)
				{
					<>4__this.storedGrass.transform.localScale = new Vector3(1f, 0f, 1f);
					<>4__this.storedGrass.active = true;
					goto IL_0253;
				}
				<>4__this.storedGrass.active = true;
				break;
			case 2:
				{
					<>1__state = -1;
					goto IL_0253;
				}
				IL_0253:
				if (<>4__this.storedGrass.transform.localScale.y < 1f && growthTime != 0)
				{
					<>4__this.storedGrass.transform.localScale = new Vector3(1f, <>4__this.storedGrass.transform.localScale.y + 1f / ((float)growthTime * 50f), 1f);
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 2;
					return true;
				}
				break;
			}
			<>4__this.storedGrass.transform.localScale = new Vector3(1f, 1f, 1f);
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <RegrowGrass>d__28 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public GameObject grass;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(preGrowthTime);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				grass.transform.localScale = new Vector3(1f, 0f, 1f);
				grass.active = true;
				break;
			case 2:
				<>1__state = -1;
				break;
			}
			if (grass.transform.localScale.y <= grassHeight && growthTime != 0)
			{
				grass.transform.localScale = new Vector3(1f, grass.transform.localScale.y + grassHeight / ((float)growthTime * 50f), 1f);
				<>2__current = (object)new WaitForFixedUpdate();
				<>1__state = 2;
				return true;
			}
			grass.transform.localScale = new Vector3(1f, grassHeight, 1f);
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <SetupFlatLand>d__33 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private GameObject <floor>5__1;

		private int <i>5__2;

		private float <x>5__3;

		private float <z>5__4;

		private Vector3 <grassSpot>5__5;

		private Quaternion <grassRotation>5__6;

		private GameObject <grass>5__7;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<floor>5__1 = null;
			<grass>5__7 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<floor>5__1 = GameObject.Find("Floor");
				<>4__this.flatLandSize = (int)<floor>5__1.transform.localScale.x / 2;
				<i>5__2 = 0;
				goto IL_0403;
			case 2:
				{
					<>1__state = -1;
					goto IL_03e9;
				}
				IL_0403:
				if (<i>5__2 < <>4__this.grassCount)
				{
					<x>5__3 = <floor>5__1.transform.position.x + (float)<>4__this.random.Next(-<>4__this.flatLandSize, <>4__this.flatLandSize + 1);
					if (<x>5__3 < <floor>5__1.transform.position.x)
					{
						<x>5__3 += (float)<>4__this.random.NextDouble();
					}
					else if (<x>5__3 > <floor>5__1.transform.position.x)
					{
						<x>5__3 -= (float)<>4__this.random.NextDouble();
					}
					else if (<>4__this.random.Next(0, 2) == 0)
					{
						<x>5__3 += (float)<>4__this.random.NextDouble();
					}
					else
					{
						<x>5__3 -= (float)<>4__this.random.NextDouble();
					}
					<z>5__4 = <floor>5__1.transform.position.z + (float)<>4__this.random.Next(-<>4__this.flatLandSize, <>4__this.flatLandSize + 1);
					if (<z>5__4 < <floor>5__1.transform.position.z)
					{
						<z>5__4 += (float)<>4__this.random.NextDouble();
					}
					else if (<z>5__4 > <floor>5__1.transform.position.z)
					{
						<z>5__4 -= (float)<>4__this.random.NextDouble();
					}
					else if (<>4__this.random.Next(0, 2) == 0)
					{
						<z>5__4 += (float)<>4__this.random.NextDouble();
					}
					else
					{
						<z>5__4 -= (float)<>4__this.random.NextDouble();
					}
					<grassSpot>5__5 = new Vector3(<x>5__3, 0f, <z>5__4);
					<grassRotation>5__6 = Quaternion.EulerAngles(0f, (float)<>4__this.random.Next(0, 361), 0f);
					<grass>5__7 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__2)).gameObject;
					<grass>5__7.transform.localPosition = <grassSpot>5__5;
					<grass>5__7.transform.rotation = <grassRotation>5__6;
					<grass>5__7.transform.localScale = new Vector3(1f, grassHeight, 1f);
					<grass>5__7.active = true;
					if (<i>5__2 % 100 == 0)
					{
						<>2__current = (object)new WaitForFixedUpdate();
						<>1__state = 2;
						return true;
					}
					goto IL_03e9;
				}
				if (<>4__this.currentScene == "Gym")
				{
					MelonCoroutines.Start(<>4__this.MapStartGrassGrow());
				}
				MelonCoroutines.Start(<>4__this.WatchFloorSize(<floor>5__1));
				return false;
				IL_03e9:
				<grass>5__7 = null;
				<i>5__2++;
				goto IL_0403;
			}
		}

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

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

	[CompilerGenerated]
	private sealed class <SetupMap0>d__35 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private int <i>5__1;

		private Vector3 <pickedSpot>5__2;

		private Vector3 <grassSpot>5__3;

		private Quaternion <grassRotation>5__4;

		private GameObject <grass>5__5;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			int num = <>1__state;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				goto IL_0150;
			}
			<>1__state = -1;
			<i>5__1 = 0;
			goto IL_0168;
			IL_0150:
			<grass>5__5 = null;
			<i>5__1++;
			goto IL_0168;
			IL_0168:
			if (<i>5__1 < <>4__this.grassCount)
			{
				<pickedSpot>5__2 = <>4__this.CalculatePoint(11f, -0.31f);
				<grassSpot>5__3 = new Vector3(<pickedSpot>5__2.x, 0f, <pickedSpot>5__2.z);
				<grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)<>4__this.random.Next(0, 361), 0f);
				<grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject;
				<grass>5__5.transform.localPosition = <grassSpot>5__3;
				<grass>5__5.transform.rotation = <grassRotation>5__4;
				<grass>5__5.transform.localScale = new Vector3(grassWidth, grassHeight, grassWidth);
				<grass>5__5.active = true;
				if (<i>5__1 % 100 == 0)
				{
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				goto IL_0150;
			}
			if (<>4__this.currentScene == "Map0")
			{
				MelonCoroutines.Start(<>4__this.MapStartGrassGrow());
			}
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <SetupMap1>d__36 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private int <i>5__1;

		private Vector3 <pickedSpot>5__2;

		private Vector3 <grassSpot>5__3;

		private Quaternion <grassRotation>5__4;

		private GameObject <grass>5__5;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			int num = <>1__state;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				goto IL_015c;
			}
			<>1__state = -1;
			<i>5__1 = 0;
			goto IL_0174;
			IL_015c:
			<grass>5__5 = null;
			<i>5__1++;
			goto IL_0174;
			IL_0174:
			if (<i>5__1 < <>4__this.grassCount)
			{
				<pickedSpot>5__2 = <>4__this.CalculatePoint(10f, -0.03f);
				<grassSpot>5__3 = new Vector3(<pickedSpot>5__2.x * 1.5f, 0f, <pickedSpot>5__2.z * 1.1f);
				<grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)<>4__this.random.Next(0, 361), 0f);
				<grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject;
				<grass>5__5.transform.localPosition = <grassSpot>5__3;
				<grass>5__5.transform.rotation = <grassRotation>5__4;
				<grass>5__5.transform.localScale = new Vector3(1f, grassHeight, 1f);
				<grass>5__5.active = true;
				if (<i>5__1 % 100 == 0)
				{
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				goto IL_015c;
			}
			if (<>4__this.currentScene == "Map1")
			{
				MelonCoroutines.Start(<>4__this.MapStartGrassGrow());
			}
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <SetupPark>d__37 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private int <i>5__1;

		private Vector3 <ringSpot>5__2;

		private Vector3 <grassSpot>5__3;

		private Quaternion <grassRotation>5__4;

		private GameObject <grass>5__5;

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

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

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

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

		private bool MoveNext()
		{
			//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)
			//IL_005b: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			int num = <>1__state;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				goto IL_0176;
			}
			<>1__state = -1;
			<i>5__1 = 0;
			goto IL_018e;
			IL_0176:
			<grass>5__5 = null;
			<i>5__1++;
			goto IL_018e;
			IL_018e:
			if (<i>5__1 < <>4__this.grassCount)
			{
				<ringSpot>5__2 = new Vector3(0f, -5.88f, 0f);
				<grassSpot>5__3 = <>4__this.CalculatePoint(11f, -0.31f);
				<grassRotation>5__4 = Quaternion.EulerAngles(0f, (float)<>4__this.random.Next(0, 361), 0f);
				<grass>5__5 = ((Component)<>4__this.storedGrass.transform.GetChild(<i>5__1)).gameObject;
				<grass>5__5.transform.localPosition = new Vector3(<ringSpot>5__2.x + <grassSpot>5__3.x, 0f, <ringSpot>5__2.z + <grassSpot>5__3.z);
				<grass>5__5.transform.rotation = <grassRotation>5__4;
				<grass>5__5.transform.localScale = new Vector3(1f, grassHeight, 1f);
				<grass>5__5.active = true;
				if (<i>5__1 % 100 == 0)
				{
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				goto IL_0176;
			}
			if (<>4__this.currentScene == "Park")
			{
				MelonCoroutines.Start(<>4__this.MapStartGrassGrow());
			}
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <SetupStoredGrass>d__30 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public main <>4__this;

		private int <i>5__1;

		private int <pickedGrass>5__2;

		private GameObject <whichGrass>5__3;

		private GameObject <grass>5__4;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<whichGrass>5__3 = null;
			<grass>5__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			int num = <>1__state;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
				goto IL_01bb;
			}
			<>1__state = -1;
			<>4__this.storedGrass = new GameObject();
			((Object)<>4__this.storedGrass).name = "Grass";
			<>4__this.storedGrass.SetActive(false);
			<i>5__1 = 0;
			goto IL_01dc;
			IL_01bb:
			<whichGrass>5__3 = null;
			<grass>5__4 = null;
			<i>5__1++;
			goto IL_01dc;
			IL_01dc:
			if (<i>5__1 < <>4__this.grassCount)
			{
				<pickedGrass>5__2 = <>4__this.random.Next(0, 2);
				if (grassRemoval)
				{
					if (<pickedGrass>5__2 == 0)
					{
						<whichGrass>5__3 = <>4__this.grassShort;
					}
					else
					{
						<whichGrass>5__3 = <>4__this.grassLong;
					}
				}
				else if (<pickedGrass>5__2 == 0)
				{
					<whichGrass>5__3 = <>4__this.grassShortNoCollider;
				}
				else
				{
					<whichGrass>5__3 = <>4__this.grassLongNoCollider;
				}
				<grass>5__4 = Object.Instantiate<GameObject>(<whichGrass>5__3, <>4__this.storedGrass.transform);
				<grass>5__4.transform.position = new Vector3(0f, 0f, 0f);
				<grass>5__4.transform.rotation = Quaternion.EulerAngles(0f, 0f, 0f);
				<grass>5__4.transform.localScale = new Vector3(1f, 1f, 1f);
				if (<i>5__1 % 1000 == 0)
				{
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				goto IL_01bb;
			}
			Object.DontDestroyOnLoad((Object)(object)<>4__this.storedGrass);
			if (<>4__this.currentScene == "Gym")
			{
				<>4__this.storedGrass.SetActive(false);
			}
			else if (<>4__this.currentScene == "Map0")
			{
				MelonCoroutines.Start(<>4__this.SetupMap0());
			}
			else if (<>4__this.currentScene == "Map1")
			{
				MelonCoroutines.Start(<>4__this.SetupMap1());
			}
			else if (<>4__this.currentScene == "Park")
			{
				MelonCoroutines.Start(<>4__this.SetupPark());
			}
			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();
		}
	}

	[CompilerGenerated]
	private sealed class <WatchFloorSize>d__34 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public GameObject floor;

		public main <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)floor != (Object)null)
			{
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}
			<>4__this.storedGrass.active = false;
			if (<>4__this.flatLandActive)
			{
				MelonCoroutines.Start(<>4__this.SetupFlatLand());
			}
			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 string currentScene = "Loader";

	private bool init = false;

	private GameObject grassParent;

	private GameObject grassShort;

	private GameObject grassLong;

	private GameObject grassShortNoCollider;

	private GameObject grassLongNoCollider;

	private GameObject storedGrass;

	private Random random = new Random();

	private int grassCount;

	private static float grassHeight;

	private static float grassWidth;

	public static bool grassRemoval;

	public static bool grassGrowth;

	public static float preGrowthTime;

	public static int growthTime;

	public static string grassColorInput;

	public static Color grassColor = hexToColor("c0b154");

	private Mod GrassEnabler = new Mod();

	private bool flatLandModFound = false;

	private bool flatLandActive = false;

	private int flatLandSize = 125;

	public override void OnLateInitializeMelon()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Expected O, but got Unknown
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Expected O, but got Unknown
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Expected O, but got Unknown
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		GrassEnabler.ModName = "GrassEnabler";
		GrassEnabler.ModVersion = "3.0.0";
		GrassEnabler.SetFolder("GrassEnabler");
		GrassEnabler.AddToList("Grass Count", 5000, "Adds Grass to Maps. Can change Grass Count. Default: 5000", new Tags());
		GrassEnabler.AddToList("Grass Height", 0.5f, "Changes Grass Height. Default: 0.5", new Tags());
		GrassEnabler.AddToList("Grass Width", 0.5f, "Changes Grass Width. Default: 0.5", new Tags());
		GrassEnabler.AddToList("Grass Color", "c0b154", "Sets the Color of the Grass. Supports 0x(HexCode), #(HexCode), FFF, and FFFFFF style inputs. Alpha included. Default: c0b154", new Tags());
		GrassEnabler.AddToList("Grass Removal", true, 0, "Removes the Grass with Spawned and Grounded Structures", new Tags());
		GrassEnabler.AddToList("Regrow Grass", true, 0, "Regrows the Grass after it is Destroyed. Default: On", new Tags());
		GrassEnabler.AddToList("Time Before Regrowth", 5f, "Controls how many Seconds till Grass starts Regrowing. Default: 5", new Tags());
		GrassEnabler.AddToList("Growth Speed", 10, "Controls how many Seconds till Grass is Fully Grown. Default: 10", new Tags());
		GrassEnabler.GetFromFile();
		GrassEnabler.ModSaved += Save;
		UI.instance.UI_Initialized += delegate
		{
			UI.instance.AddMod(GrassEnabler);
		};
		Actions.onMapInitialized += Init;
		grassCount = (int)GrassEnabler.Settings[0].SavedValue;
		grassHeight = (float)GrassEnabler.Settings[1].SavedValue;
		grassWidth = (float)GrassEnabler.Settings[2].SavedValue;
		grassColorInput = (string)GrassEnabler.Settings[3].SavedValue;
		grassColor = hexToColor(grassColorInput);
		grassRemoval = (bool)GrassEnabler.Settings[4].SavedValue;
		grassGrowth = (bool)GrassEnabler.Settings[5].SavedValue;
		preGrowthTime = (float)GrassEnabler.Settings[6].SavedValue;
		growthTime = (int)GrassEnabler.Settings[7].SavedValue;
	}

	public static Color hexToColor(string hex)
	{
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			hex = hex.Replace("0x", "").Replace("#", "");
			if (hex.Length == 3)
			{
				hex = (hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]).ToString();
			}
			else if (hex.Length == 4)
			{
				hex = (hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3]).ToString();
			}
			byte b = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
			byte b2 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
			byte b3 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
			byte b4 = ((hex.Length >= 8) ? byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber) : byte.MaxValue);
			return Color32.op_Implicit(new Color32(b, b2, b3, b4));
		}
		catch
		{
			return hexToColor("c0b154");
		}
	}

	public void Save()
	{
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		int num = grassCount;
		grassCount = (int)GrassEnabler.Settings[0].SavedValue;
		float num2 = grassHeight;
		grassHeight = (float)GrassEnabler.Settings[1].SavedValue;
		float num3 = grassWidth;
		grassWidth = (float)GrassEnabler.Settings[2].SavedValue;
		string text = grassColorInput;
		grassColorInput = (string)GrassEnabler.Settings[3].SavedValue;
		bool flag = grassRemoval;
		grassRemoval = (bool)GrassEnabler.Settings[4].SavedValue;
		grassGrowth = (bool)GrassEnabler.Settings[5].SavedValue;
		preGrowthTime = (float)GrassEnabler.Settings[6].SavedValue;
		growthTime = (int)GrassEnabler.Settings[7].SavedValue;
		if (text != grassColorInput)
		{
			grassColor = hexToColor(grassColorInput);
			List<MeshRenderer> list = new List<MeshRenderer>();
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLong.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShort.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLongNoCollider.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShortNoCollider.transform).GetComponentsInChildren<MeshRenderer>());
			foreach (MeshRenderer item in list)
			{
				((Renderer)item).material.color = grassColor;
			}
		}
		if ((Object)(object)storedGrass != (Object)null && (num != grassCount || flag != grassRemoval || text != grassColorInput || num2 != grassHeight || num3 != grassWidth))
		{
			Object.DestroyImmediate((Object)(object)storedGrass);
			MelonCoroutines.Start(SetupStoredGrass());
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		if (init)
		{
			storedGrass.SetActive(false);
		}
		flatLandActive = false;
	}

	private void Init(string map)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		if (!init && map == "Gym")
		{
			GameObject val = AssetBundles.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "GrassEnabler.grass", "Grass");
			grassParent = new GameObject();
			grassLong = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(0)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f));
			grassShort = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(1)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f));
			grassLongNoCollider = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(2)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f));
			grassShortNoCollider = Object.Instantiate<GameObject>(((Component)val.transform.GetChild(3)).gameObject, new Vector3(0f, 0f, 0f), Quaternion.EulerAngles(0f, 0f, 0f));
			((Object)grassParent).name = "GrassParent";
			((Object)grassLong).name = "GrassLong";
			((Object)grassLongNoCollider).name = "GrassLong";
			((Object)grassShort).name = "GrassShort";
			((Object)grassShortNoCollider).name = "GrassShort";
			grassLong.transform.parent = grassParent.transform;
			grassLongNoCollider.transform.parent = grassParent.transform;
			grassShort.transform.parent = grassParent.transform;
			grassShortNoCollider.transform.parent = grassParent.transform;
			SetupColliders(grassLong);
			SetupColliders(grassShort);
			List<MeshRenderer> list = new List<MeshRenderer>();
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLong.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShort.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassLongNoCollider.transform).GetComponentsInChildren<MeshRenderer>());
			list.AddRange((IEnumerable<MeshRenderer>)((Component)grassShortNoCollider.transform).GetComponentsInChildren<MeshRenderer>());
			foreach (MeshRenderer item in list)
			{
				((Renderer)item).material.color = grassColor;
			}
			Object.DontDestroyOnLoad((Object)(object)grassParent);
			grassParent.SetActive(false);
			MelonCoroutines.Start(SetupStoredGrass());
			flatLandModFound = Mods.findOwnMod("FlatLand", "1.0.0", false);
			init = true;
		}
		switch (map)
		{
		case "Gym":
			storedGrass.SetActive(false);
			if (flatLandModFound)
			{
				MelonCoroutines.Start(InitFlatLandFound());
			}
			break;
		case "Map0":
			MelonCoroutines.Start(SetupMap0());
			break;
		case "Map1":
			MelonCoroutines.Start(SetupMap1());
			break;
		case "Park":
			MelonCoroutines.Start(SetupPark());
			break;
		}
	}

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

	[IteratorStateMachine(typeof(<RegrowGrass>d__28))]
	public static IEnumerator RegrowGrass(GameObject grass)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <RegrowGrass>d__28(0)
		{
			grass = grass
		};
	}

	private Vector3 CalculatePoint(float radius, float height)
	{
		//IL_004c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
		double num = random.NextDouble() * Math.PI * 2.0;
		double num2 = Math.Sqrt(random.NextDouble()) * (double)radius;
		double num3 = num2 * Math.Cos(num);
		double num4 = num2 * Math.Sin(num);
		return new Vector3((float)num3, height, (float)num4);
	}

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

	private void SetupColliders(GameObject grass)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		grass.layer = 15;
		BoxCollider val = grass.AddComponent<BoxCollider>();
		((Collider)val).isTrigger = true;
		val.size = new Vector3(0.1f, 0.5f, 0.1f);
		grass.AddComponent<ColliderCheck>();
	}

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

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

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

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

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

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