Decompiled source of Calico v0.3.4

GDWeave/mods/Teemaw.Calico/Teemaw.Calico.dll

Decompiled 13 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.Json.Serialization;
using GDWeave;
using GDWeave.Godot;
using GDWeave.Godot.Variants;
using GDWeave.Modding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Teemaw.Calico")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0+a791556b51e28560456c27d8f5d56deccef194b7")]
[assembly: AssemblyProduct("Teemaw.Calico")]
[assembly: AssemblyTitle("Teemaw.Calico")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Teemaw.Calico;

public class Config
{
	[JsonInclude]
	public bool DynamicZonesEnabled;

	[JsonInclude]
	public bool MeshGpuInstancingEnabled = true;

	[JsonInclude]
	public bool MultiThreadNetworkingEnabled = true;

	[JsonInclude]
	public bool PlayerOptimizationsEnabled = true;

	[JsonInclude]
	public bool ReducePhysicsUpdatesEnabled = true;

	[JsonInclude]
	public bool SmoothCameraEnabled = true;

	public virtual string ToString()
	{
		return $"DynamicZonesEnabled={DynamicZonesEnabled}, MeshGpuInstancingEnabled={MeshGpuInstancingEnabled}, MultiThreadNetworkingEnabled={MultiThreadNetworkingEnabled}, PlayerOptimizationsEnabled={PlayerOptimizationsEnabled}, ReducePhysicsUpdatesEnabled={ReducePhysicsUpdatesEnabled}, SmoothCameraEnabled={SmoothCameraEnabled}";
	}
}
public class Fishing3ScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public Fishing3ScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <mainProgressWaiter>5__2;

		private MultiTokenWaiter <badProgressWaiter>5__3;

		private Dictionary<string, bool> <patchFlags>5__4;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap4;

		private Token <t>5__6;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 4u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
		}

		private bool MoveNext()
		{
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Expected O, but got Unknown
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Expected O, but got Unknown
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: 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_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int num = <>1__state;
				Fishing3ScriptMod fishing3ScriptMod = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<mainProgressWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "main_progress";
						},
						(Token t) => (int)t.Type == 24,
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "reel_speed";
						}
					}, false, false);
					<badProgressWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "bad_progress";
						},
						(Token t) => (int)t.Type == 24,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "bad_speed";
						}
					}, false, false);
					fishing3ScriptMod.<mod>P.Logger.Information("[calico.Fishing3ScriptMod] Patching " + path);
					<patchFlags>5__4 = new Dictionary<string, bool>
					{
						["main_progress"] = false,
						["bad_progress"] = false
					};
					<>7__wrap4 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					if (<mainProgressWaiter>5__2.Check(<t>5__6))
					{
						<>2__current = new Token((TokenType)18, (uint?)null);
						<>1__state = 2;
						return true;
					}
					if (<badProgressWaiter>5__3.Check(<t>5__6))
					{
						<>2__current = new Token((TokenType)18, (uint?)null);
						<>1__state = 4;
						return true;
					}
					goto IL_02e4;
				case 2:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new IntVariant(2L, false));
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -3;
					<patchFlags>5__4["main_progress"] = true;
					fishing3ScriptMod.<mod>P.Logger.Information("[calico.HeldItemScriptMod] main_progress patch OK");
					goto IL_02e4;
				case 4:
					<>1__state = -3;
					<>2__current = (Token)new ConstantToken((Variant)new IntVariant(2L, false));
					<>1__state = 5;
					return true;
				case 5:
					{
						<>1__state = -3;
						<patchFlags>5__4["bad_progress"] = true;
						fishing3ScriptMod.<mod>P.Logger.Information("[calico.HeldItemScriptMod] bad_progress patch OK");
						goto IL_02e4;
					}
					IL_02e4:
					<t>5__6 = null;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap4).MoveNext())
				{
					<t>5__6 = <>7__wrap4.Current;
					<>2__current = <t>5__6;
					<>1__state = 1;
					return true;
				}
				<>m__Finally1();
				<>7__wrap4 = null;
				Enumerator<string, bool> enumerator = <patchFlags>5__4.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, bool> current = enumerator.Current;
						if (!current.Value)
						{
							fishing3ScriptMod.<mod>P.Logger.Error("[calico.Fishing3ScriptMod] FAIL: " + current.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap4 != null)
			{
				((global::System.IDisposable)<>7__wrap4).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	public Fishing3ScriptMod(IModInterface mod)
	{
		<mod>P = mod;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Minigames/Fishing3/fishing3.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter mainProgressWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "main_progress";
			},
			(Token t) => (int)t.Type == 24,
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "reel_speed";
			}
		}, false, false);
		MultiTokenWaiter badProgressWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "bad_progress";
			},
			(Token t) => (int)t.Type == 24,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "bad_speed";
			}
		}, false, false);
		<mod>P.Logger.Information("[calico.Fishing3ScriptMod] Patching " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool>
		{
			["main_progress"] = false,
			["bad_progress"] = false
		};
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token t2 = enumerator.Current;
				yield return t2;
				if (mainProgressWaiter.Check(t2))
				{
					yield return new Token((TokenType)18, (uint?)null);
					yield return (Token)new ConstantToken((Variant)new IntVariant(2L, false));
					patchFlags["main_progress"] = true;
					<mod>P.Logger.Information("[calico.HeldItemScriptMod] main_progress patch OK");
				}
				else if (badProgressWaiter.Check(t2))
				{
					yield return new Token((TokenType)18, (uint?)null);
					yield return (Token)new ConstantToken((Variant)new IntVariant(2L, false));
					patchFlags["bad_progress"] = true;
					<mod>P.Logger.Information("[calico.HeldItemScriptMod] bad_progress patch OK");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator2 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				KeyValuePair<string, bool> current = enumerator2.Current;
				if (!current.Value)
				{
					<mod>P.Logger.Error("[calico.Fishing3ScriptMod] FAIL: " + current.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator2).Dispose();
		}
	}
}
public class GlobalsScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__4 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public GlobalsScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <readyWaiter>5__2;

		private Dictionary<string, bool> <patchFlags>5__3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap4;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__4(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -4) > 1u && (uint)(num - 1) > 2u)
			{
				return;
			}
			try
			{
				if (num != -4 && num != 2)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: 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_00ef: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int num = <>1__state;
				GlobalsScriptMod globalsScriptMod = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<readyWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[5]
					{
						(Token t) => (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "_ready";
						},
						(Token t) => (int)t.Type == 80,
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86
					}, false, false);
					globalsScriptMod.<mod>P.Logger.Information("[calico.GlobalsScriptMod] Patching " + path);
					<patchFlags>5__3 = new Dictionary<string, bool> { ["ready"] = false };
					<>7__wrap3 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>7__wrap4 = OnReadyPhysicsFps.GetEnumerator();
					<>1__state = -4;
					goto IL_01c3;
				case 2:
					<>1__state = -4;
					goto IL_01c3;
				case 3:
					{
						<>1__state = -3;
						break;
					}
					IL_01c3:
					if (((global::System.Collections.IEnumerator)<>7__wrap4).MoveNext())
					{
						Token current = <>7__wrap4.Current;
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap4 = null;
					<patchFlags>5__3["ready"] = true;
					globalsScriptMod.<mod>P.Logger.Information("[calico.GlobalsScriptMod] _ready patch OK");
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext())
				{
					Token current2 = <>7__wrap3.Current;
					if (<readyWaiter>5__2.Check(current2))
					{
						<>2__current = current2;
						<>1__state = 1;
						return true;
					}
					<>2__current = current2;
					<>1__state = 3;
					return true;
				}
				<>m__Finally1();
				<>7__wrap3 = null;
				Enumerator<string, bool> enumerator = <patchFlags>5__3.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, bool> current3 = enumerator.Current;
						if (!current3.Value)
						{
							globalsScriptMod.<mod>P.Logger.Error("[calico.GlobalsScriptMod] FAIL: " + current3.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap3 != null)
			{
				((global::System.IDisposable)<>7__wrap3).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap4 != null)
			{
				((global::System.IDisposable)<>7__wrap4).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__4 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__4(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	private static readonly global::System.Collections.Generic.IEnumerable<Token> OnReadyPhysicsFps = ScriptTokenizer.Tokenize("\r\nprint(\"[calico] Setting physics FPS...\")\r\nEngine.set_iterations_per_second(30)\r\n", 1u);

	public GlobalsScriptMod(IModInterface mod)
	{
		<mod>P = mod;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Singletons/globals.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__4))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter readyWaiter = new MultiTokenWaiter(new Func<Token, bool>[5]
		{
			(Token t) => (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "_ready";
			},
			(Token t) => (int)t.Type == 80,
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86
		}, false, false);
		<mod>P.Logger.Information("[calico.GlobalsScriptMod] Patching " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool> { ["ready"] = false };
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (readyWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = OnReadyPhysicsFps.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["ready"] = true;
					<mod>P.Logger.Information("[calico.GlobalsScriptMod] _ready patch OK");
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator3 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator3.MoveNext())
			{
				KeyValuePair<string, bool> current2 = enumerator3.Current;
				if (!current2.Value)
				{
					<mod>P.Logger.Error("[calico.GlobalsScriptMod] FAIL: " + current2.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator3).Dispose();
		}
	}
}
public class GuitarStringSoundScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__7 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public GuitarStringSoundScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <extendsWaiter>5__2;

		private MultiTokenWaiter <nodePlayWaiter>5__3;

		private MultiTokenWaiter <callWaiter>5__4;

		private MultiTokenWaiter <nodeStopWaiter>5__5;

		private Dictionary<string, bool> <patchFlags>5__6;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap6;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap7;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__7(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -7) > 4u && (uint)(num - 1) > 8u)
			{
				return;
			}
			try
			{
				switch (num)
				{
				case -4:
				case 2:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally2();
					}
				case -5:
				case 4:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally3();
					}
				case -6:
				case 6:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally4();
					}
				case -7:
				case 8:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally5();
					}
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Expected O, but got Unknown
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			try
			{
				int num = <>1__state;
				GuitarStringSoundScriptMod guitarStringSoundScriptMod = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 1,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<nodePlayWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[6]
					{
						delegate(Token t)
						{
							IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val7 != null && val7.Name == "node";
						},
						(Token t) => (int)t.Type == 84,
						delegate(Token t)
						{
							IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val6 != null && val6.Name == "play";
						},
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val5 != null && val5.Name == "point";
						},
						(Token t) => (int)t.Type == 81
					}, false, false);
					<callWaiter>5__4 = new MultiTokenWaiter(new Func<Token, bool>[5]
					{
						(Token t) => (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "_call";
						},
						(Token t) => (int)t.Type == 80,
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86
					}, false, false);
					<nodeStopWaiter>5__5 = new MultiTokenWaiter(new Func<Token, bool>[5]
					{
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "sound";
						},
						(Token t) => (int)t.Type == 84,
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "playing";
						},
						(Token t) => (int)t.Type == 23,
						delegate(Token t)
						{
							//IL_0011: Unknown result type (might be due to invalid IL or missing references)
							//IL_001b: Expected O, but got Unknown
							ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							return val != null && val.Value.Equals((Variant)new BoolVariant(false));
						}
					}, false, false);
					guitarStringSoundScriptMod.<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] Patching " + path);
					<patchFlags>5__6 = new Dictionary<string, bool>
					{
						["globals"] = false,
						["player"] = false,
						["call_guard"] = false,
						["node_stop"] = false
					};
					<>7__wrap6 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>7__wrap7 = Globals.GetEnumerator();
					<>1__state = -4;
					goto IL_0414;
				case 2:
					<>1__state = -4;
					goto IL_0414;
				case 3:
					<>1__state = -3;
					<>7__wrap7 = IncrementPlayingCount.GetEnumerator();
					<>1__state = -5;
					goto IL_04cc;
				case 4:
					<>1__state = -5;
					goto IL_04cc;
				case 5:
					<>1__state = -3;
					<>7__wrap7 = CallGuard.GetEnumerator();
					<>1__state = -6;
					goto IL_0584;
				case 6:
					<>1__state = -6;
					goto IL_0584;
				case 7:
					<>1__state = -3;
					<>7__wrap7 = DecrementPlayingCount.GetEnumerator();
					<>1__state = -7;
					goto IL_063c;
				case 8:
					<>1__state = -7;
					goto IL_063c;
				case 9:
					{
						<>1__state = -3;
						break;
					}
					IL_063c:
					if (((global::System.Collections.IEnumerator)<>7__wrap7).MoveNext())
					{
						Token current = <>7__wrap7.Current;
						<>2__current = current;
						<>1__state = 8;
						return true;
					}
					<>m__Finally5();
					<>7__wrap7 = null;
					<patchFlags>5__6["node_stop"] = true;
					guitarStringSoundScriptMod.<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] node stop patch OK");
					break;
					IL_0584:
					if (((global::System.Collections.IEnumerator)<>7__wrap7).MoveNext())
					{
						Token current2 = <>7__wrap7.Current;
						<>2__current = current2;
						<>1__state = 6;
						return true;
					}
					<>m__Finally4();
					<>7__wrap7 = null;
					<patchFlags>5__6["call_guard"] = true;
					guitarStringSoundScriptMod.<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] call guard patch OK");
					break;
					IL_0414:
					if (((global::System.Collections.IEnumerator)<>7__wrap7).MoveNext())
					{
						Token current3 = <>7__wrap7.Current;
						<>2__current = current3;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap7 = null;
					<patchFlags>5__6["globals"] = true;
					guitarStringSoundScriptMod.<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] globals patch OK");
					break;
					IL_04cc:
					if (((global::System.Collections.IEnumerator)<>7__wrap7).MoveNext())
					{
						Token current4 = <>7__wrap7.Current;
						<>2__current = current4;
						<>1__state = 4;
						return true;
					}
					<>m__Finally3();
					<>7__wrap7 = null;
					<patchFlags>5__6["player"] = true;
					guitarStringSoundScriptMod.<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] player patch OK");
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
				{
					Token current5 = <>7__wrap6.Current;
					if (<extendsWaiter>5__2.Check(current5))
					{
						<>2__current = current5;
						<>1__state = 1;
						return true;
					}
					if (<nodePlayWaiter>5__3.Check(current5))
					{
						<>2__current = current5;
						<>1__state = 3;
						return true;
					}
					if (<callWaiter>5__4.Check(current5))
					{
						<>2__current = current5;
						<>1__state = 5;
						return true;
					}
					if (<nodeStopWaiter>5__5.Check(current5))
					{
						<>2__current = current5;
						<>1__state = 7;
						return true;
					}
					<>2__current = current5;
					<>1__state = 9;
					return true;
				}
				<>m__Finally1();
				<>7__wrap6 = null;
				Enumerator<string, bool> enumerator = <patchFlags>5__6.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, bool> current6 = enumerator.Current;
						if (!current6.Value)
						{
							guitarStringSoundScriptMod.<mod>P.Logger.Error("[calico.GuitarStringSoundScriptMod] FAIL: " + current6.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap7 != null)
			{
				((global::System.IDisposable)<>7__wrap7).Dispose();
			}
		}

		private void <>m__Finally3()
		{
			<>1__state = -3;
			if (<>7__wrap7 != null)
			{
				((global::System.IDisposable)<>7__wrap7).Dispose();
			}
		}

		private void <>m__Finally4()
		{
			<>1__state = -3;
			if (<>7__wrap7 != null)
			{
				((global::System.IDisposable)<>7__wrap7).Dispose();
			}
		}

		private void <>m__Finally5()
		{
			<>1__state = -3;
			if (<>7__wrap7 != null)
			{
				((global::System.IDisposable)<>7__wrap7).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__7 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__7(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	private static readonly global::System.Collections.Generic.IEnumerable<Token> Globals = ScriptTokenizer.Tokenize("\r\nvar calico_playing_count = 0\r\n");

	private static readonly global::System.Collections.Generic.IEnumerable<Token> CallGuard = ScriptTokenizer.Tokenize("\r\nif calico_playing_count == 0: return\r\n", 1u);

	private static readonly global::System.Collections.Generic.IEnumerable<Token> IncrementPlayingCount = ScriptTokenizer.Tokenize("\r\ncalico_playing_count += 1\r\n", 3u);

	private static readonly global::System.Collections.Generic.IEnumerable<Token> DecrementPlayingCount = ScriptTokenizer.Tokenize("\r\ncalico_playing_count -= 1\r\n", 3u);

	public GuitarStringSoundScriptMod(IModInterface mod)
	{
		<mod>P = mod;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Entities/Player/guitar_string_sound.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__7))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			(Token t) => (int)t.Type == 51,
			(Token t) => (int)t.Type == 1,
			(Token t) => (int)t.Type == 89
		}, false, false);
		MultiTokenWaiter nodePlayWaiter = new MultiTokenWaiter(new Func<Token, bool>[6]
		{
			delegate(Token t)
			{
				IdentifierToken val7 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val7 != null && val7.Name == "node";
			},
			(Token t) => (int)t.Type == 84,
			delegate(Token t)
			{
				IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val6 != null && val6.Name == "play";
			},
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val5 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val5 != null && val5.Name == "point";
			},
			(Token t) => (int)t.Type == 81
		}, false, false);
		MultiTokenWaiter callWaiter = new MultiTokenWaiter(new Func<Token, bool>[5]
		{
			(Token t) => (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "_call";
			},
			(Token t) => (int)t.Type == 80,
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86
		}, false, false);
		MultiTokenWaiter nodeStopWaiter = new MultiTokenWaiter(new Func<Token, bool>[5]
		{
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "sound";
			},
			(Token t) => (int)t.Type == 84,
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "playing";
			},
			(Token t) => (int)t.Type == 23,
			delegate(Token t)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Expected O, but got Unknown
				ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				return val != null && val.Value.Equals((Variant)new BoolVariant(false));
			}
		}, false, false);
		<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] Patching " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool>
		{
			["globals"] = false,
			["player"] = false,
			["call_guard"] = false,
			["node_stop"] = false
		};
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (extendsWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = Globals.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["globals"] = true;
					<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] globals patch OK");
				}
				else if (nodePlayWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = IncrementPlayingCount.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["player"] = true;
					<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] player patch OK");
				}
				else if (callWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = CallGuard.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["call_guard"] = true;
					<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] call guard patch OK");
				}
				else if (nodeStopWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = DecrementPlayingCount.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["node_stop"] = true;
					<mod>P.Logger.Information("[calico.GuitarStringSoundScriptMod] node stop patch OK");
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator3 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator3.MoveNext())
			{
				KeyValuePair<string, bool> current2 = enumerator3.Current;
				if (!current2.Value)
				{
					<mod>P.Logger.Error("[calico.GuitarStringSoundScriptMod] FAIL: " + current2.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator3).Dispose();
		}
	}
}
public class HeldItemScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public HeldItemScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <physicsProcessWaiter>5__2;

		private Dictionary<string, bool> <patchFlags>5__3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap3;

		private Token <t>5__5;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 2u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
		}

		private bool MoveNext()
		{
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			try
			{
				int num = <>1__state;
				HeldItemScriptMod heldItemScriptMod = <>4__this;
				Enumerator<string, bool> enumerator;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<physicsProcessWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[7]
					{
						(Token t) => t != null && (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "_physics_process";
						},
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "delta";
						},
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86,
						(Token t) => (int)t.Type == 89
					}, false, false);
					heldItemScriptMod.<mod>P.Logger.Information("[calico.HeldItemScriptMod] Patching " + path);
					<patchFlags>5__3 = new Dictionary<string, bool> { ["physics_process"] = false };
					<>7__wrap3 = tokens.GetEnumerator();
					<>1__state = -3;
					goto IL_0249;
				case 1:
					<>1__state = -3;
					<>2__current = new Token((TokenType)46, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -3;
					<patchFlags>5__3["physics_process"] = true;
					heldItemScriptMod.<mod>P.Logger.Information("[calico.HeldItemScriptMod] _physics_process patch OK");
					goto IL_0220;
				case 3:
					{
						<>1__state = -3;
						<t>5__5 = null;
						goto IL_0249;
					}
					IL_0220:
					<>2__current = <t>5__5;
					<>1__state = 3;
					return true;
					IL_0249:
					if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext())
					{
						<t>5__5 = <>7__wrap3.Current;
						if (<physicsProcessWaiter>5__2.Check(<t>5__5))
						{
							<>2__current = <t>5__5;
							<>1__state = 1;
							return true;
						}
						goto IL_0220;
					}
					<>m__Finally1();
					<>7__wrap3 = null;
					enumerator = <patchFlags>5__3.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							KeyValuePair<string, bool> current = enumerator.Current;
							if (!current.Value)
							{
								heldItemScriptMod.<mod>P.Logger.Error("[calico.HeldItemScriptMod] FAIL: " + current.Key + " patch not applied");
							}
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator).Dispose();
					}
					return false;
				}
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap3 != null)
			{
				((global::System.IDisposable)<>7__wrap3).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	public HeldItemScriptMod(IModInterface mod)
	{
		<mod>P = mod;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Entities/Player/held_item.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter physicsProcessWaiter = new MultiTokenWaiter(new Func<Token, bool>[7]
		{
			(Token t) => t != null && (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "_physics_process";
			},
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "delta";
			},
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86,
			(Token t) => (int)t.Type == 89
		}, false, false);
		<mod>P.Logger.Information("[calico.HeldItemScriptMod] Patching " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool> { ["physics_process"] = false };
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token t2 = enumerator.Current;
				if (physicsProcessWaiter.Check(t2))
				{
					yield return t2;
					yield return new Token((TokenType)46, (uint?)null);
					patchFlags["physics_process"] = true;
					<mod>P.Logger.Information("[calico.HeldItemScriptMod] _physics_process patch OK");
				}
				yield return t2;
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator2 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				KeyValuePair<string, bool> current = enumerator2.Current;
				if (!current.Value)
				{
					<mod>P.Logger.Error("[calico.HeldItemScriptMod] FAIL: " + current.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator2).Dispose();
		}
	}
}
public class MainMapScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <ModifyForDynamicZones>d__8 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		private IModInterface mod;

		public IModInterface <>3__mod;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <extendsWaiter>5__2;

		private MultiTokenWaiter <setZoneWaiter>5__3;

		private MultiTokenWaiter <getZoneWaiter>5__4;

		private Dictionary<string, bool> <patchFlags>5__5;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap5;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap6;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <ModifyForDynamicZones>d__8(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -6) > 3u && (uint)(num - 1) > 6u)
			{
				return;
			}
			try
			{
				switch (num)
				{
				case -4:
				case 2:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally2();
					}
				case -5:
				case 4:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally3();
					}
				case -6:
				case 6:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally4();
					}
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 1,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<setZoneWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[6]
					{
						(Token t) => (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "_set_zone";
						},
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val3 != null && val3.Name == "id";
						},
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86
					}, false, false);
					<getZoneWaiter>5__4 = new MultiTokenWaiter(new Func<Token, bool>[6]
					{
						(Token t) => (int)t.Type == 48,
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "_get_zone";
						},
						(Token t) => (int)t.Type == 80,
						delegate(Token t)
						{
							IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val != null && val.Name == "id";
						},
						(Token t) => (int)t.Type == 81,
						(Token t) => (int)t.Type == 86
					}, false, false);
					mod.Logger.Information("[calico.MainMapScriptMod] Patching for dynamic zones " + path);
					<patchFlags>5__5 = new Dictionary<string, bool>
					{
						["dynamic_zones_globals"] = false,
						["set_zone"] = false,
						["get_zone"] = false
					};
					<>7__wrap5 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>7__wrap6 = DynamicZonesGlobals.GetEnumerator();
					<>1__state = -4;
					goto IL_035c;
				case 2:
					<>1__state = -4;
					goto IL_035c;
				case 3:
					<>1__state = -3;
					<>7__wrap6 = SetZone.GetEnumerator();
					<>1__state = -5;
					goto IL_0414;
				case 4:
					<>1__state = -5;
					goto IL_0414;
				case 5:
					<>1__state = -3;
					<>7__wrap6 = GetZone.GetEnumerator();
					<>1__state = -6;
					goto IL_04cc;
				case 6:
					<>1__state = -6;
					goto IL_04cc;
				case 7:
					{
						<>1__state = -3;
						break;
					}
					IL_04cc:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current = <>7__wrap6.Current;
						<>2__current = current;
						<>1__state = 6;
						return true;
					}
					<>m__Finally4();
					<>7__wrap6 = null;
					<patchFlags>5__5["get_zone"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] get_zone patch OK");
					break;
					IL_035c:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current2 = <>7__wrap6.Current;
						<>2__current = current2;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap6 = null;
					<patchFlags>5__5["dynamic_zones_globals"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] dynamic_zones_globals patch OK");
					break;
					IL_0414:
					if (((global::System.Collections.IEnumerator)<>7__wrap6).MoveNext())
					{
						Token current3 = <>7__wrap6.Current;
						<>2__current = current3;
						<>1__state = 4;
						return true;
					}
					<>m__Finally3();
					<>7__wrap6 = null;
					<patchFlags>5__5["set_zone"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] set_zone patch OK");
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap5).MoveNext())
				{
					Token current4 = <>7__wrap5.Current;
					if (<extendsWaiter>5__2.Check(current4))
					{
						<>2__current = current4;
						<>1__state = 1;
						return true;
					}
					if (<setZoneWaiter>5__3.Check(current4))
					{
						<>2__current = current4;
						<>1__state = 3;
						return true;
					}
					if (<getZoneWaiter>5__4.Check(current4))
					{
						<>2__current = current4;
						<>1__state = 5;
						return true;
					}
					<>2__current = current4;
					<>1__state = 7;
					return true;
				}
				<>m__Finally1();
				<>7__wrap5 = null;
				Enumerator<string, bool> enumerator = <patchFlags>5__5.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, bool> current5 = enumerator.Current;
						if (!current5.Value)
						{
							mod.Logger.Error("[calico.MainMapScriptMod] FAIL: " + current5.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap5 != null)
			{
				((global::System.IDisposable)<>7__wrap5).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		private void <>m__Finally3()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		private void <>m__Finally4()
		{
			<>1__state = -3;
			if (<>7__wrap6 != null)
			{
				((global::System.IDisposable)<>7__wrap6).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<ModifyForDynamicZones>d__8 <ModifyForDynamicZones>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<ModifyForDynamicZones>d__ = this;
			}
			else
			{
				<ModifyForDynamicZones>d__ = new <ModifyForDynamicZones>d__8(0);
			}
			<ModifyForDynamicZones>d__.mod = <>3__mod;
			<ModifyForDynamicZones>d__.path = <>3__path;
			<ModifyForDynamicZones>d__.tokens = <>3__tokens;
			return <ModifyForDynamicZones>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private sealed class <ModifyForMeshGpuInstancing>d__9 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		private IModInterface mod;

		public IModInterface <>3__mod;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <extendsWaiter>5__2;

		private Dictionary<string, bool> <patchFlags>5__3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap3;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap4;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <ModifyForMeshGpuInstancing>d__9(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -4) > 1u && (uint)(num - 1) > 2u)
			{
				return;
			}
			try
			{
				if (num != -4 && num != 2)
				{
					return;
				}
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_00a4: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 1,
						(Token t) => (int)t.Type == 89
					}, false, false);
					mod.Logger.Information("[calico.MainMapScriptMod] Patching " + path);
					<patchFlags>5__3 = new Dictionary<string, bool> { ["globals"] = false };
					<>7__wrap3 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>7__wrap4 = Globals.GetEnumerator();
					<>1__state = -4;
					goto IL_0176;
				case 2:
					<>1__state = -4;
					goto IL_0176;
				case 3:
					{
						<>1__state = -3;
						break;
					}
					IL_0176:
					if (((global::System.Collections.IEnumerator)<>7__wrap4).MoveNext())
					{
						Token current = <>7__wrap4.Current;
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally2();
					<>7__wrap4 = null;
					<patchFlags>5__3["globals"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] globals patch OK");
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext())
				{
					Token current2 = <>7__wrap3.Current;
					if (<extendsWaiter>5__2.Check(current2))
					{
						<>2__current = current2;
						<>1__state = 1;
						return true;
					}
					<>2__current = current2;
					<>1__state = 3;
					return true;
				}
				<>m__Finally1();
				<>7__wrap3 = null;
				Enumerator<string, bool> enumerator = <patchFlags>5__3.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, bool> current3 = enumerator.Current;
						if (!current3.Value)
						{
							mod.Logger.Error("[calico.MainMapScriptMod] FAIL: " + current3.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap3 != null)
			{
				((global::System.IDisposable)<>7__wrap3).Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<>7__wrap4 != null)
			{
				((global::System.IDisposable)<>7__wrap4).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<ModifyForMeshGpuInstancing>d__9 <ModifyForMeshGpuInstancing>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<ModifyForMeshGpuInstancing>d__ = this;
			}
			else
			{
				<ModifyForMeshGpuInstancing>d__ = new <ModifyForMeshGpuInstancing>d__9(0);
			}
			<ModifyForMeshGpuInstancing>d__.mod = <>3__mod;
			<ModifyForMeshGpuInstancing>d__.path = <>3__path;
			<ModifyForMeshGpuInstancing>d__.tokens = <>3__tokens;
			return <ModifyForMeshGpuInstancing>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	[CompilerGenerated]
	private Config <config>P;

	private static readonly global::System.Collections.Generic.IEnumerable<Token> Globals = ScriptTokenizer.Tokenize("\r\nvar calico_water_ld_mat: Material\r\nvar calico_water_hd_mat: Material\r\nvar calico_water_mmis = []\r\n\r\nfunc _ready():\r\n\tprint(\"[calico] Building mesh instances...\")\r\n\tvar tree_a_mmi = calico_build_mesh_parented_static_body_mmi($zones/main_zone/trees/tree_a)\r\n\t$zones/main_zone/trees.add_child(tree_a_mmi)\r\n\tvar tree_b_mmi = calico_build_mesh_parented_static_body_mmi($zones/main_zone/trees/tree_b)\r\n\t$zones/main_zone/trees.add_child(tree_b_mmi)\r\n\tvar tree_c_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/trees/tree_c, \"tree_3.tscn\", \"MeshInstance\")\r\n\tvar logs_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/trees/tree_c, \"log.tscn\", \"Leaf\")\r\n\t$zones/main_zone/trees.add_child(tree_c_mmi)\r\n\t$zones/main_zone/trees.add_child(logs_mmi)\r\n\tvar bush_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"bush.tscn\", \"Leaf\")\r\n\t$zones/main_zone/props.add_child(bush_mmi)\r\n\tvar reeds_meshinstance_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"reeds.tscn\", \"MeshInstance\")\r\n\t$zones/main_zone/props.add_child(reeds_meshinstance_mmi)\r\n\tvar reeds_meshinstance2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"reeds.tscn\", \"MeshInstance2\")\r\n\t$zones/main_zone/props.add_child(reeds_meshinstance2_mmi)\r\n\tvar reeds_meshinstance3_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"reeds.tscn\", \"MeshInstance3\")\r\n\t$zones/main_zone/props.add_child(reeds_meshinstance3_mmi)\r\n\tvar reeds_meshinstance4_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"reeds.tscn\", \"MeshInstance4\")\r\n\t$zones/main_zone/props.add_child(reeds_meshinstance4_mmi)\r\n\tvar mushroom_1_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"mushroom_1.tscn\", \"mushroom_1\")\r\n\t$zones/main_zone/props.add_child(mushroom_1_mmi)\r\n\tvar mushroom_2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"mushroom_2.tscn\", \"mushroom_1001\")\r\n\t$zones/main_zone/props.add_child(mushroom_2_mmi)\r\n\tvar bench_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"bench.tscn\", \"Cube\")\r\n\t$zones/main_zone/props.add_child(bench_mmi)\r\n\tvar rock_1_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"rock_1.tscn\", \"Icosphere\")\r\n\t$zones/main_zone/props.add_child(rock_1_mmi)\r\n\tvar rock_2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"rock_2.tscn\", \"Icosphere001\")\r\n\t$zones/main_zone/props.add_child(rock_2_mmi)\r\n\tvar rock_3_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"rock_3.tscn\", \"Icosphere002\")\r\n\t$zones/main_zone/props.add_child(rock_3_mmi)\r\n\tvar trashcan_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"trashcan.tscn\", \"trashcan\")\r\n\t$zones/main_zone/props.add_child(trashcan_mmi)\r\n\tvar fence_icosphere_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"fence.tscn\", \"Icosphere\")\r\n\t$zones/main_zone/props.add_child(fence_icosphere_mmi)\r\n\tvar fence_icosphere2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/props, \"fence.tscn\", \"Icosphere2\")\r\n\t$zones/main_zone/props.add_child(fence_icosphere2_mmi)\r\n\t\r\n\tcalico_water_ld_mat = preload(\"res://Assets/Materials/blue.tres\")\r\n\tcalico_water_hd_mat = preload(\"res://Assets/Shaders/extreme_water_main.tres\")\r\n\tcalico_water_mmis = []\r\n\tvar extreme_water_small_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"main\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_mmi)\r\n\tcalico_water_mmis.append(extreme_water_small_mmi)\r\n\tvar extreme_water_small_sand_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"sand\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_sand_mmi)\r\n\tvar extreme_water_small_fade_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"sand/fade\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_fade_mmi)\r\n\tvar extreme_water_small_fade2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"sand/fade2\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_fade2_mmi)\r\n\tvar extreme_water_small_fade3_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"sand/fade3\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_fade3_mmi)\r\n\tvar extreme_water_small_fade4_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/lake_water, \"extreme_water_small.tscn\", \"sand/fade4\")\r\n\t$zones/main_zone/props.add_child(extreme_water_small_fade4_mmi)\r\n\tvar extreme_water_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"main\")\r\n\t$zones/main_zone/props.add_child(extreme_water_mmi)\r\n\tcalico_water_mmis.append(extreme_water_mmi)\r\n\tvar extreme_water_sand_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"sand\")\r\n\t$zones/main_zone/props.add_child(extreme_water_sand_mmi)\r\n\tvar extreme_water_fade_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"fade\")\r\n\t$zones/main_zone/props.add_child(extreme_water_fade_mmi)\r\n\tvar extreme_water_fade2_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"fade2\")\r\n\t$zones/main_zone/props.add_child(extreme_water_fade2_mmi)\r\n\tvar extreme_water_fade3_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"fade3\")\r\n\t$zones/main_zone/props.add_child(extreme_water_fade3_mmi)\r\n\tvar extreme_water_fade4_mmi = calico_build_node_parented_static_body_mmi($zones/main_zone/ocean_water, \"extreme_water.tscn\", \"fade4\")\r\n\t$zones/main_zone/props.add_child(extreme_water_fade4_mmi)\r\n\t\r\n\tOptionsMenu.connect(\"_options_update\", self, \"calico_water_mat_check\")\r\n\tprint(\"[calico] Mesh instances complete!\")\r\n\r\nfunc calico_build_mesh_parented_static_body_mmi(parent):\r\n\tvar mmi = MultiMeshInstance.new()\r\n\tvar mm = MultiMesh.new()\r\n\tmmi.multimesh = mm\r\n\tmm.mesh = parent.get_child(0).mesh.duplicate()\r\n\tfor surface_idx in range(parent.get_child(0).get_surface_material_count()):\r\n\t\tvar material = parent.get_child(0).get_surface_material(surface_idx)\r\n\t\tmm.mesh.surface_set_material(surface_idx, material)\r\n\tmm.transform_format = 1\r\n\tmm.instance_count = parent.get_child_count()\r\n\tvar i = 0\r\n\tfor tree in parent.get_children():\r\n\t\tmm.set_instance_transform(i, tree.global_transform)\r\n\t\ti += 1\r\n\t\tfor child in tree.get_children():\r\n\t\t\tif child is StaticBody:\r\n\t\t\t\tvar old_global_transform = child.global_transform.scaled(Vector3.ONE)\r\n\t\t\t\ttree.remove_child(child)\r\n\t\t\t\tparent.add_child(child)\r\n\t\t\t\tchild.global_transform = old_global_transform\r\n\t\tparent.remove_child(tree)\r\n\treturn mmi\r\n\r\nfunc calico_get_all_children_with_filename(parent, filename):\r\n\tvar matching_children = []\r\n\tfor child in calico_get_all_children(parent):\r\n\t\tif child.filename.ends_with(filename):\r\n\t\t\tmatching_children.append(child)\r\n\treturn matching_children\r\n\r\nfunc calico_get_children_with_prefix(parent, prefix):\r\n\tvar matching_children = []\r\n\tfor child in parent.get_children():\r\n\t\tif child.name.begins_with(prefix):\r\n\t\t\tmatching_children.append(child)\r\n\treturn matching_children\r\n\t\r\nfunc calico_get_all_children(node: Node):\r\n\tvar children = []\r\n\tfor child in node.get_children():\r\n\t\tchildren.append(child)\r\n\t\tchildren.append_array(calico_get_all_children(child))\r\n\treturn children\r\n\r\nfunc calico_build_node_parented_static_body_mmi(parent, filename, mesh_node_name):\r\n\tvar mmi = MultiMeshInstance.new()\r\n\tvar mm = MultiMesh.new()\r\n\tmmi.multimesh = mm\r\n\tvar children = calico_get_all_children_with_filename(parent, filename)\r\n\tvar mesh_instance = children[0].get_node(mesh_node_name)\r\n\tmm.mesh = mesh_instance.mesh.duplicate()\r\n\tfor surface_idx in range(mesh_instance.mesh.get_surface_count()):\r\n\t\tvar material = mesh_instance.get_active_material(surface_idx)\r\n\t\tmm.mesh.surface_set_material(surface_idx, material)\r\n\tmm.transform_format = MultiMesh.TRANSFORM_3D\r\n\tmm.instance_count = children.size()\r\n\tvar i = 0\r\n\tfor mesh_parent in children:\r\n\t\tvar mesh = mesh_parent.get_node(mesh_node_name)\r\n\t\tvar new_transform = mesh.global_transform\r\n\t\tmm.set_instance_transform(i, new_transform)\r\n\t\tfor mesh_child in mesh.get_children():\r\n\t\t\tif mesh_child is StaticBody:\r\n\t\t\t\tvar old_hitbox_transform = mesh_child.global_transform\r\n\t\t\t\tmesh.remove_child(mesh_child)\r\n\t\t\t\tmesh_parent.add_child(mesh_child)\r\n\t\t\t\tmesh_child.global_transform = old_hitbox_transform\r\n\t\tmesh.queue_free()\r\n\t\tfor child in mesh_parent.get_children():\r\n\t\t\tif child.name == \"shadow\": child.queue_free()\r\n\t\ti += 1\r\n\treturn mmi\r\n\r\nfunc calico_water_mat_check():\r\n\tvar use_ld_mat = PlayerData.player_options.water == 0\r\n\tfor mmi in calico_water_mmis:\r\n\t\tcalico_update_mmi_surface_material(mmi, calico_water_ld_mat if use_ld_mat else calico_water_hd_mat)\r\n\r\nfunc calico_update_mmi_surface_material(mmi: MultiMeshInstance, material: Material):\r\n\tvar mm = mmi.multimesh\r\n\tfor i in mm.instance_count:\r\n\t\tmm.mesh.surface_set_material(i, material)\r\n");

	private static readonly global::System.Collections.Generic.IEnumerable<Token> SetZone = ScriptTokenizer.Tokenize("\r\nif calico_zones.empty():\r\n\tcalico_zones[\"main_zone\"] = $zones/main_zone\r\n\tcalico_zones[\"tent_zone\"] = $zones/tent_zone\r\n\tcalico_zones[\"hub_building_zone\"] = $zones/hub_building_zone\r\n\tcalico_zones[\"aquarium_zone\"] = $zones/aquarium_zone\r\n\tcalico_zones[\"tutorial_zone\"] = $zones/tutorial_zone\r\n\tcalico_zones[\"island_tiny_zone\"] = $zones/island_tiny_zone\r\n\tcalico_zones[\"island_med_zone\"] = $zones/island_med_zone\r\n\tcalico_zones[\"island_big_zone\"] = $zones/island_big_zone\r\n\tcalico_zones[\"void_zone\"] = $zones.get_node(\"void_zone\")\r\nfor child in $zones.get_children():\r\n\tif child.name != \"main_zone\":\r\n\t\t$zones.remove_child(child)\r\nif id != \"main_zone\":\r\n\t$zones.add_child(calico_zones[id])\r\n", 1u);

	private static readonly global::System.Collections.Generic.IEnumerable<Token> GetZone = ScriptTokenizer.Tokenize("\r\nif calico_zones.has(id): return calico_zones[id]\r\n", 1u);

	private static readonly global::System.Collections.Generic.IEnumerable<Token> DynamicZonesGlobals = ScriptTokenizer.Tokenize("\r\nvar calico_zones = {}\r\n");

	public MainMapScriptMod(IModInterface mod, Config config)
	{
		<mod>P = mod;
		<config>P = config;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Map/main_map.gdc";
	}

	[IteratorStateMachine(typeof(<ModifyForDynamicZones>d__8))]
	private static global::System.Collections.Generic.IEnumerable<Token> ModifyForDynamicZones(IModInterface mod, string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			(Token t) => (int)t.Type == 51,
			(Token t) => (int)t.Type == 1,
			(Token t) => (int)t.Type == 89
		}, false, false);
		MultiTokenWaiter setZoneWaiter = new MultiTokenWaiter(new Func<Token, bool>[6]
		{
			(Token t) => (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "_set_zone";
			},
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val3 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val3 != null && val3.Name == "id";
			},
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86
		}, false, false);
		MultiTokenWaiter getZoneWaiter = new MultiTokenWaiter(new Func<Token, bool>[6]
		{
			(Token t) => (int)t.Type == 48,
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "_get_zone";
			},
			(Token t) => (int)t.Type == 80,
			delegate(Token t)
			{
				IdentifierToken val = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val != null && val.Name == "id";
			},
			(Token t) => (int)t.Type == 81,
			(Token t) => (int)t.Type == 86
		}, false, false);
		mod.Logger.Information("[calico.MainMapScriptMod] Patching for dynamic zones " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool>
		{
			["dynamic_zones_globals"] = false,
			["set_zone"] = false,
			["get_zone"] = false
		};
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (extendsWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = DynamicZonesGlobals.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["dynamic_zones_globals"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] dynamic_zones_globals patch OK");
				}
				else if (setZoneWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = SetZone.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["set_zone"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] set_zone patch OK");
				}
				else if (getZoneWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = GetZone.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["get_zone"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] get_zone patch OK");
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator3 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator3.MoveNext())
			{
				KeyValuePair<string, bool> current2 = enumerator3.Current;
				if (!current2.Value)
				{
					mod.Logger.Error("[calico.MainMapScriptMod] FAIL: " + current2.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator3).Dispose();
		}
	}

	[IteratorStateMachine(typeof(<ModifyForMeshGpuInstancing>d__9))]
	private static global::System.Collections.Generic.IEnumerable<Token> ModifyForMeshGpuInstancing(IModInterface mod, string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter extendsWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			(Token t) => (int)t.Type == 51,
			(Token t) => (int)t.Type == 1,
			(Token t) => (int)t.Type == 89
		}, false, false);
		mod.Logger.Information("[calico.MainMapScriptMod] Patching " + path);
		Dictionary<string, bool> patchFlags = new Dictionary<string, bool> { ["globals"] = false };
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (extendsWaiter.Check(current))
				{
					yield return current;
					global::System.Collections.Generic.IEnumerator<Token> enumerator2 = Globals.GetEnumerator();
					try
					{
						while (((global::System.Collections.IEnumerator)enumerator2).MoveNext())
						{
							yield return enumerator2.Current;
						}
					}
					finally
					{
						((global::System.IDisposable)enumerator2)?.Dispose();
					}
					patchFlags["globals"] = true;
					mod.Logger.Information("[calico.MainMapScriptMod] globals patch OK");
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, bool> enumerator3 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator3.MoveNext())
			{
				KeyValuePair<string, bool> current2 = enumerator3.Current;
				if (!current2.Value)
				{
					mod.Logger.Error("[calico.MainMapScriptMod] FAIL: " + current2.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator3).Dispose();
		}
	}

	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		List<Token> val = Enumerable.ToList<Token>(tokens);
		<mod>P.Logger.Information($"[calico.MainMapScriptMod] MeshGpuInstancingEnabled={<config>P.MeshGpuInstancingEnabled}");
		if (<config>P.MeshGpuInstancingEnabled)
		{
			val = Enumerable.ToList<Token>(ModifyForMeshGpuInstancing(<mod>P, path, (global::System.Collections.Generic.IEnumerable<Token>)val));
		}
		<mod>P.Logger.Information($"[calico.MainMapScriptMod] DynamicZoneLoadingEnabled={<config>P.DynamicZonesEnabled}");
		if (<config>P.DynamicZonesEnabled)
		{
			val = Enumerable.ToList<Token>(ModifyForDynamicZones(<mod>P, path, (global::System.Collections.Generic.IEnumerable<Token>)val));
		}
		return (global::System.Collections.Generic.IEnumerable<Token>)val;
	}
}
public class Mod : IMod, global::System.IDisposable
{
	public Mod(IModInterface modInterface)
	{
		Config config = modInterface.ReadConfig<Config>();
		modInterface.Logger.Information($"[calico.Mod] Running with config {config}");
		if (config.MultiThreadNetworkingEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new SteamNetworkScriptMod(modInterface));
		}
		if (config.PlayerOptimizationsEnabled || config.ReducePhysicsUpdatesEnabled || config.SmoothCameraEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerScriptMod(modInterface, config));
		}
		if (config.PlayerOptimizationsEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new GuitarStringSoundScriptMod(modInterface));
			modInterface.RegisterScriptMod((IScriptMod)(object)new HeldItemScriptMod(modInterface));
		}
		if (config.ReducePhysicsUpdatesEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new Fishing3ScriptMod(modInterface));
		}
		if (config.MeshGpuInstancingEnabled || config.DynamicZonesEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new MainMapScriptMod(modInterface, config));
		}
		if (config.ReducePhysicsUpdatesEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new GlobalsScriptMod(modInterface));
			modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerFaceScriptMod(modInterface));
			modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerHudScriptMod(modInterface));
		}
		if (config.SmoothCameraEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new PlayerHeadHudScriptMod(modInterface));
			modInterface.RegisterScriptMod((IScriptMod)(object)new TailRootScriptMod(modInterface));
		}
		if (config.DynamicZonesEnabled)
		{
			modInterface.RegisterScriptMod((IScriptMod)(object)new TransitionZoneScriptMod(modInterface));
		}
	}

	public void Dispose()
	{
	}
}
public class PlayerFaceScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__3 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public PlayerFaceScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <resetTimeWaiter>5__2;

		private MultiTokenWaiter <blinkTimeWaiter>5__3;

		private MultiTokenWaiter <emoteTimeWaiter>5__4;

		private Dictionary<string, int> <patchFlags>5__5;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap5;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__3(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || (uint)(num - 1) <= 9u)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
		}

		private bool MoveNext()
		{
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Expected O, but got Unknown
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Expected O, but got Unknown
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Expected O, but got Unknown
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Expected O, but got Unknown
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected O, but got Unknown
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Expected O, but got Unknown
			try
			{
				int num = <>1__state;
				PlayerFaceScriptMod playerFaceScriptMod = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<resetTimeWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						delegate(Token t)
						{
							IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val6 != null && val6.Name == "reset_time";
						},
						(Token t) => (int)t.Type == 25,
						delegate(Token t)
						{
							//IL_0013: Unknown result type (might be due to invalid IL or missing references)
							//IL_001d: Expected O, but got Unknown
							ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							return val5 != null && val5.Value.Equals((Variant)new IntVariant(1L, false));
						}
					}, false, false);
					<blinkTimeWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						delegate(Token t)
						{
							IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val4 != null && val4.Name == "blink_time";
						},
						(Token t) => (int)t.Type == 25,
						delegate(Token t)
						{
							//IL_0013: Unknown result type (might be due to invalid IL or missing references)
							//IL_001d: Expected O, but got Unknown
							ConstantToken val3 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							return val3 != null && val3.Value.Equals((Variant)new IntVariant(1L, false));
						}
					}, false, false);
					<emoteTimeWaiter>5__4 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						delegate(Token t)
						{
							IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
							return val2 != null && val2.Name == "emote_time";
						},
						(Token t) => (int)t.Type == 25,
						delegate(Token t)
						{
							//IL_0013: Unknown result type (might be due to invalid IL or missing references)
							//IL_001d: Expected O, but got Unknown
							ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
							return val != null && val.Value.Equals((Variant)new IntVariant(1L, false));
						}
					}, false, false);
					playerFaceScriptMod.<mod>P.Logger.Information("[calico.PlayerFaceScript] Patching " + path);
					<patchFlags>5__5 = new Dictionary<string, int>
					{
						["reset_time"] = 0,
						["blink_time"] = 0,
						["emote_time"] = 0
					};
					<>7__wrap5 = tokens.GetEnumerator();
					<>1__state = -3;
					break;
				case 1:
					<>1__state = -3;
					<>2__current = new Token((TokenType)18, (uint?)null);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("delta");
					<>1__state = 3;
					return true;
				case 3:
				{
					<>1__state = -3;
					Dictionary<string, int> obj3 = <patchFlags>5__5;
					int num2 = obj3["reset_time"];
					obj3["reset_time"] = num2 + 1;
					playerFaceScriptMod.<mod>P.Logger.Information("[calico.PlayerFaceScript] reset_time patch");
					break;
				}
				case 4:
					<>1__state = -3;
					<>2__current = new Token((TokenType)18, (uint?)null);
					<>1__state = 5;
					return true;
				case 5:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("delta");
					<>1__state = 6;
					return true;
				case 6:
				{
					<>1__state = -3;
					Dictionary<string, int> obj2 = <patchFlags>5__5;
					int num2 = obj2["blink_time"];
					obj2["blink_time"] = num2 + 1;
					playerFaceScriptMod.<mod>P.Logger.Information("[calico.PlayerFaceScript] blink_time patch");
					break;
				}
				case 7:
					<>1__state = -3;
					<>2__current = new Token((TokenType)18, (uint?)null);
					<>1__state = 8;
					return true;
				case 8:
					<>1__state = -3;
					<>2__current = (Token)new IdentifierToken("delta");
					<>1__state = 9;
					return true;
				case 9:
				{
					<>1__state = -3;
					Dictionary<string, int> obj = <patchFlags>5__5;
					int num2 = obj["emote_time"];
					obj["emote_time"] = num2 + 1;
					playerFaceScriptMod.<mod>P.Logger.Information("[calico.PlayerFaceScript] emote_time patch");
					break;
				}
				case 10:
					<>1__state = -3;
					break;
				}
				if (((global::System.Collections.IEnumerator)<>7__wrap5).MoveNext())
				{
					Token current = <>7__wrap5.Current;
					if (<resetTimeWaiter>5__2.Check(current))
					{
						<>2__current = (Token)new ConstantToken((Variant)new IntVariant(60L, false));
						<>1__state = 1;
						return true;
					}
					if (<blinkTimeWaiter>5__3.Check(current))
					{
						<blinkTimeWaiter>5__3.Reset();
						<>2__current = (Token)new ConstantToken((Variant)new IntVariant(60L, false));
						<>1__state = 4;
						return true;
					}
					if (<emoteTimeWaiter>5__4.Check(current))
					{
						<>2__current = (Token)new ConstantToken((Variant)new IntVariant(60L, false));
						<>1__state = 7;
						return true;
					}
					<>2__current = current;
					<>1__state = 10;
					return true;
				}
				<>m__Finally1();
				<>7__wrap5 = null;
				Enumerator<string, int> enumerator = <patchFlags>5__5.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, int> current2 = enumerator.Current;
						if (current2.Value == 0)
						{
							playerFaceScriptMod.<mod>P.Logger.Error("[calico.PlayerFaceScript] FAIL: " + current2.Key + " patch not applied");
						}
					}
				}
				finally
				{
					((global::System.IDisposable)enumerator).Dispose();
				}
				return false;
			}
			catch
			{
				//try-fault
				((global::System.IDisposable)this).Dispose();
				throw;
			}
		}

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

		private void <>m__Finally1()
		{
			<>1__state = -1;
			if (<>7__wrap5 != null)
			{
				((global::System.IDisposable)<>7__wrap5).Dispose();
			}
		}

		[DebuggerHidden]
		void global::System.Collections.IEnumerator.Reset()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		[DebuggerHidden]
		global::System.Collections.Generic.IEnumerator<Token> global::System.Collections.Generic.IEnumerable<Token>.GetEnumerator()
		{
			<Modify>d__3 <Modify>d__;
			if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
			{
				<>1__state = 0;
				<Modify>d__ = this;
			}
			else
			{
				<Modify>d__ = new <Modify>d__3(0)
				{
					<>4__this = <>4__this
				};
			}
			<Modify>d__.path = <>3__path;
			<Modify>d__.tokens = <>3__tokens;
			return <Modify>d__;
		}

		[DebuggerHidden]
		global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator()
		{
			return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator();
		}
	}

	[CompilerGenerated]
	private IModInterface <mod>P;

	public PlayerFaceScriptMod(IModInterface mod)
	{
		<mod>P = mod;
		base..ctor();
	}

	public bool ShouldRun(string path)
	{
		return path == "res://Scenes/Entities/Player/Face/player_face.gdc";
	}

	[IteratorStateMachine(typeof(<Modify>d__3))]
	public global::System.Collections.Generic.IEnumerable<Token> Modify(string path, global::System.Collections.Generic.IEnumerable<Token> tokens)
	{
		MultiTokenWaiter resetTimeWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			delegate(Token t)
			{
				IdentifierToken val6 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val6 != null && val6.Name == "reset_time";
			},
			(Token t) => (int)t.Type == 25,
			delegate(Token t)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				ConstantToken val5 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				return val5 != null && val5.Value.Equals((Variant)new IntVariant(1L, false));
			}
		}, false, false);
		MultiTokenWaiter blinkTimeWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			delegate(Token t)
			{
				IdentifierToken val4 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val4 != null && val4.Name == "blink_time";
			},
			(Token t) => (int)t.Type == 25,
			delegate(Token t)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				ConstantToken val3 = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				return val3 != null && val3.Value.Equals((Variant)new IntVariant(1L, false));
			}
		}, false, false);
		MultiTokenWaiter emoteTimeWaiter = new MultiTokenWaiter(new Func<Token, bool>[3]
		{
			delegate(Token t)
			{
				IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null);
				return val2 != null && val2.Name == "emote_time";
			},
			(Token t) => (int)t.Type == 25,
			delegate(Token t)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null);
				return val != null && val.Value.Equals((Variant)new IntVariant(1L, false));
			}
		}, false, false);
		<mod>P.Logger.Information("[calico.PlayerFaceScript] Patching " + path);
		Dictionary<string, int> patchFlags = new Dictionary<string, int>
		{
			["reset_time"] = 0,
			["blink_time"] = 0,
			["emote_time"] = 0
		};
		global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator();
		try
		{
			while (((global::System.Collections.IEnumerator)enumerator).MoveNext())
			{
				Token current = enumerator.Current;
				if (resetTimeWaiter.Check(current))
				{
					yield return (Token)new ConstantToken((Variant)new IntVariant(60L, false));
					yield return new Token((TokenType)18, (uint?)null);
					yield return (Token)new IdentifierToken("delta");
					int num = patchFlags["reset_time"];
					patchFlags["reset_time"] = num + 1;
					<mod>P.Logger.Information("[calico.PlayerFaceScript] reset_time patch");
				}
				else if (blinkTimeWaiter.Check(current))
				{
					blinkTimeWaiter.Reset();
					yield return (Token)new ConstantToken((Variant)new IntVariant(60L, false));
					yield return new Token((TokenType)18, (uint?)null);
					yield return (Token)new IdentifierToken("delta");
					int num = patchFlags["blink_time"];
					patchFlags["blink_time"] = num + 1;
					<mod>P.Logger.Information("[calico.PlayerFaceScript] blink_time patch");
				}
				else if (emoteTimeWaiter.Check(current))
				{
					yield return (Token)new ConstantToken((Variant)new IntVariant(60L, false));
					yield return new Token((TokenType)18, (uint?)null);
					yield return (Token)new IdentifierToken("delta");
					int num = patchFlags["emote_time"];
					patchFlags["emote_time"] = num + 1;
					<mod>P.Logger.Information("[calico.PlayerFaceScript] emote_time patch");
				}
				else
				{
					yield return current;
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator)?.Dispose();
		}
		Enumerator<string, int> enumerator2 = patchFlags.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				KeyValuePair<string, int> current2 = enumerator2.Current;
				if (current2.Value == 0)
				{
					<mod>P.Logger.Error("[calico.PlayerFaceScript] FAIL: " + current2.Key + " patch not applied");
				}
			}
		}
		finally
		{
			((global::System.IDisposable)enumerator2).Dispose();
		}
	}
}
public class PlayerHeadHudScriptMod : IScriptMod
{
	[CompilerGenerated]
	private sealed class <Modify>d__5 : global::System.Collections.Generic.IEnumerable<Token>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<Token>, global::System.Collections.IEnumerator, global::System.IDisposable
	{
		private int <>1__state;

		private Token <>2__current;

		private int <>l__initialThreadId;

		public PlayerHeadHudScriptMod <>4__this;

		private string path;

		public string <>3__path;

		private global::System.Collections.Generic.IEnumerable<Token> tokens;

		public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens;

		private MultiTokenWaiter <extendsWaiter>5__2;

		private MultiTokenWaiter <readyWaiter>5__3;

		private Dictionary<string, bool> <patchFlags>5__4;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap4;

		private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap5;

		Token global::System.Collections.Generic.IEnumerator<Token>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

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

		[DebuggerHidden]
		public <Modify>d__5(int <>1__state)
		{
			this.<>1__state = <>1__state;
			<>l__initialThreadId = Environment.CurrentManagedThreadId;
		}

		[DebuggerHidden]
		void global::System.IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -5) > 2u && (uint)(num - 1) > 4u)
			{
				return;
			}
			try
			{
				switch (num)
				{
				case -4:
				case 2:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally2();
					}
				case -5:
				case 4:
					try
					{
						break;
					}
					finally
					{
						<>m__Finally3();
					}
				}
			}
			finally
			{
				<>m__Finally1();
			}
		}

		private bool MoveNext()
		{
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			try
			{
				int num = <>1__state;
				PlayerHeadHudScriptMod playerHeadHudScriptMod = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<extendsWaiter>5__2 = new MultiTokenWaiter(new Func<Token, bool>[3]
					{
						(Token t) => (int)t.Type == 51,
						(Token t) => (int)t.Type == 1,
						(Token t) => (int)t.Type == 89
					}, false, false);
					<readyWaiter>5__3 = new MultiTokenWaiter(new Func<Token, bool>[5]
					{
						(Token