Decompiled source of Calico v0.7.1
GDWeave/mods/Teemaw.Calico/Teemaw.Calico.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
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; using Teemaw.Calico.GracefulDegradation; using Teemaw.Calico.LexicalTransformer; using Teemaw.Calico.ScriptMod; using Teemaw.Calico.ScriptMod.GracefulDegradation; using Teemaw.Calico.ScriptMod.LobbyQol; using Teemaw.Calico.Util; [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("0.7.1.0")] [assembly: AssemblyInformationalVersion("0.7.1+0f111f4")] [assembly: AssemblyProduct("Teemaw.Calico")] [assembly: AssemblyTitle("Teemaw.Calico")] [assembly: AssemblyVersion("0.7.1.0")] [module: RefSafetyRules(11)] namespace Teemaw.Calico { public class CalicoMod : IMod, global::System.IDisposable { public CalicoMod(IModInterface mi) { mi.Logger.Information("[calico.Mod] Version is " + GetAssemblyVersion()); ConfigFileSchema configFileSchema = mi.ReadConfig<ConfigFileSchema>(); Config config = new Config(mi, configFileSchema); mi.Logger.Information($"[calico.Mod] Loaded config was {configFileSchema}"); mi.Logger.Information($"[calico.Mod] Running with config {config}"); if (config.ZzCompatOverrideMayCauseCrash) { mi.Logger.Warning("[calico.Mod] WARNING! WARNING! WARNING!"); mi.Logger.Warning("[calico.Mod] ZzCompatOverrideMayCauseCrash=True, MAY CAUSE CRASH!"); } mi.RegisterScriptMod(GracefulDegradationSplashScriptModFactory.Create(mi, config, configFileSchema)); mi.RegisterScriptMod((IScriptMod)(object)new SteamNetworkScriptMod(mi, config)); mi.RegisterScriptMod(PlayerHeadHudScriptModFactory.Create(mi, config)); mi.RegisterScriptMod(TailRootScriptModFactory.Create(mi, config)); if (config.PlayerOptimizationsEnabled || config.ReducePhysicsUpdatesEnabled || config.SmoothCameraEnabled) { mi.RegisterScriptMod(PlayerScriptModFactory.Create(mi, config)); } if (config.PlayerOptimizationsEnabled) { mi.RegisterScriptMod(GuitarStringSoundScriptModFactory.Create(mi)); mi.RegisterScriptMod(HeldItemScriptModFactory.Create(mi)); mi.RegisterScriptMod(SoundManagerScriptModFactory.Create(mi)); mi.RegisterScriptMod(ActorScriptModFactory.Create(mi)); } if (config.ReducePhysicsUpdatesEnabled) { mi.RegisterScriptMod(Fishing3ScriptModFactory.Create(mi)); } if (config.MeshGpuInstancingEnabled || config.DynamicZonesEnabled) { mi.RegisterScriptMod(MainMapScriptModFactory.Create(mi, config)); } if (config.ReducePhysicsUpdatesEnabled) { mi.RegisterScriptMod(GlobalsScriptModFactory.Create(mi)); mi.RegisterScriptMod(PlayerFaceScriptModFactory.Create(mi)); mi.RegisterScriptMod(PlayerHudScriptModFactory.Create(mi)); } if (config.DynamicZonesEnabled) { mi.RegisterScriptMod(TransitionZoneScriptModFactory.Create(mi)); } if (config.MapSoundOptimizationsEnabled) { mi.RegisterScriptMod(BushParticleDetectScriptModFactory.Create(mi)); } if (config.LobbyQolEnabled) { mi.RegisterScriptMod(LobbyQolSteamNetworkScriptModFactory.Create(mi, config)); mi.RegisterScriptMod(LobbyQolMainMenuScriptModFactory.Create(mi)); mi.RegisterScriptMod(LobbyQolEscMenuScriptModFactory.Create(mi)); mi.RegisterScriptMod(LobbyQolPlayerScriptModFactory.Create(mi)); mi.RegisterScriptMod(LobbyQolPlayerlistScriptModFactory.Create(mi)); mi.RegisterScriptMod(LobbyQolPlayerEntryScriptModFactory.Create(mi)); } } public void Dispose() { } public static string GetAssemblyVersion() { AssemblyInformationalVersionAttribute customAttribute = CustomAttributeExtensions.GetCustomAttribute<AssemblyInformationalVersionAttribute>(Assembly.GetExecutingAssembly()); if (customAttribute == null || customAttribute.InformationalVersion == null) { return "unknown"; } return customAttribute.InformationalVersion; } } public class Config { [CompilerGenerated] private IModInterface <mi>P; [CompilerGenerated] private ConfigFileSchema <configFile>P; public bool DynamicZonesEnabled => <configFile>P.DynamicZonesEnabled; public bool LobbyQolEnabled => <configFile>P.LobbyQolEnabled; public bool MapSoundOptimizationsEnabled => <configFile>P.MapSoundOptimizationsEnabled; public bool MeshGpuInstancingEnabled => <configFile>P.MeshGpuInstancingEnabled; public bool MultiThreadNetworkingEnabled { get { if (<configFile>P.MultiThreadNetworkingEnabled) { if (!ModConflictCatalog.NoConflicts(<mi>P, CompatScope.MULTITHREAD_NETWORKING)) { return <configFile>P.ZzCompatOverrideMayCauseCrash; } return true; } return false; } } public bool PlayerOptimizationsEnabled => <configFile>P.PlayerOptimizationsEnabled; public bool ReducePhysicsUpdatesEnabled => <configFile>P.ReducePhysicsUpdatesEnabled; public bool SmoothCameraEnabled { get { if (<configFile>P.SmoothCameraEnabled) { if (!ModConflictCatalog.NoConflicts(<mi>P, CompatScope.CAMERA_PHYSICS)) { return <configFile>P.ZzCompatOverrideMayCauseCrash; } return true; } return false; } } public bool ZzCompatOverrideMayCauseCrash => <configFile>P.ZzCompatOverrideMayCauseCrash; public Config(IModInterface mi, ConfigFileSchema configFile) { <mi>P = mi; <configFile>P = configFile; base..ctor(); } public virtual string ToString() { return $"DynamicZonesEnabled={DynamicZonesEnabled}, LobbyQolEnabled={LobbyQolEnabled}, MapSoundOptimizationsEnabled={MapSoundOptimizationsEnabled}, MeshGpuInstancingEnabled={MeshGpuInstancingEnabled}, MultiThreadNetworkingEnabled={MultiThreadNetworkingEnabled}, PlayerOptimizationsEnabled={PlayerOptimizationsEnabled}, ReducePhysicsUpdatesEnabled={ReducePhysicsUpdatesEnabled}, SmoothCameraEnabled={SmoothCameraEnabled}, ZzCompatOverrideMayCauseCrash={ZzCompatOverrideMayCauseCrash}"; } } public class ConfigFileSchema { [JsonInclude] public bool DynamicZonesEnabled = true; [JsonInclude] public bool LobbyQolEnabled = true; [JsonInclude] public bool MapSoundOptimizationsEnabled = true; [JsonInclude] public bool MeshGpuInstancingEnabled = true; [JsonInclude] public bool MultiThreadNetworkingEnabled = true; [JsonInclude] public bool PlayerOptimizationsEnabled = true; [JsonInclude] public bool ReducePhysicsUpdatesEnabled; [JsonInclude] public bool SmoothCameraEnabled = true; [JsonInclude] public bool ZzCompatOverrideMayCauseCrash; public virtual string ToString() { return $"DynamicZonesEnabled={DynamicZonesEnabled}, LobbyQolEnabled={LobbyQolEnabled}, MapSoundOptimizationsEnabled={MapSoundOptimizationsEnabled}, MeshGpuInstancingEnabled={MeshGpuInstancingEnabled}, MultiThreadNetworkingEnabled={MultiThreadNetworkingEnabled}, PlayerOptimizationsEnabled={PlayerOptimizationsEnabled}, ReducePhysicsUpdatesEnabled={ReducePhysicsUpdatesEnabled}, SmoothCameraEnabled={SmoothCameraEnabled}, ZzCompatOverrideMayCauseCrash={ZzCompatOverrideMayCauseCrash}"; } public bool AnyEnabled() { if (!DynamicZonesEnabled && !LobbyQolEnabled && !MapSoundOptimizationsEnabled && !MeshGpuInstancingEnabled && !MultiThreadNetworkingEnabled && !PlayerOptimizationsEnabled && !ReducePhysicsUpdatesEnabled) { return SmoothCameraEnabled; } return true; } } } namespace Teemaw.Calico.Util { public static class ScriptTokenizer { [StructLayout(3)] [CompilerGenerated] private struct <>c__DisplayClass6_0 { public string previous; public global::System.Collections.Generic.IEnumerator<string> enumerator; public List<Token> finalTokens; public List<Token> toFlush; public string idName; } [StructLayout(3)] [CompilerGenerated] private struct <>c__DisplayClass8_0 { public StringBuilder builder; } [CompilerGenerated] private sealed class <SanitizeInput>d__7 : global::System.Collections.Generic.IEnumerable<string>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<string>, global::System.Collections.IEnumerator, global::System.IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private global::System.Collections.Generic.IEnumerable<string> tokens; public global::System.Collections.Generic.IEnumerable<string> <>3__tokens; private global::System.Collections.Generic.IEnumerator<string> <>7__wrap1; string global::System.Collections.Generic.IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object global::System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SanitizeInput>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 (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = tokens.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; } while (((global::System.Collections.IEnumerator)<>7__wrap1).MoveNext()) { string current = <>7__wrap1.Current; if (!(current != "\n") || !string.IsNullOrWhiteSpace(current)) { <>2__current = current; <>1__state = 1; return true; } } <>m__Finally1(); <>7__wrap1 = null; 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__wrap1 != null) { ((global::System.IDisposable)<>7__wrap1).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<string> global::System.Collections.Generic.IEnumerable<string>.GetEnumerator() { <SanitizeInput>d__7 <SanitizeInput>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <SanitizeInput>d__ = this; } else { <SanitizeInput>d__ = new <SanitizeInput>d__7(0); } <SanitizeInput>d__.tokens = <>3__tokens; return <SanitizeInput>d__; } [DebuggerHidden] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <Tokenize>d__6 : 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 string gdScript; public string <>3__gdScript; private uint baseIndent; public uint <>3__baseIndent; private Enumerator<Token> <>7__wrap1; 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 <Tokenize>d__6(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 || num == 1) { try { } finally { <>m__Finally1(); } } } private bool MoveNext() { //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <>c__DisplayClass6_0 <>c__DisplayClass6_ = default(<>c__DisplayClass6_0); <>c__DisplayClass6_.finalTokens = new List<Token>(); global::System.Collections.Generic.IEnumerable<string> enumerable = SanitizeInput(TokenizeString(gdScript + " ")); <>c__DisplayClass6_.previous = string.Empty; <>c__DisplayClass6_.idName = string.Empty; <>c__DisplayClass6_.toFlush = new List<Token>(2); <>c__DisplayClass6_.enumerator = enumerable.GetEnumerator(); bool flag = false; TokenType val = default(TokenType); bool flag2 = default(bool); while (flag || ((global::System.Collections.IEnumerator)<>c__DisplayClass6_.enumerator).MoveNext()) { flag = false; if (<>c__DisplayClass6_.enumerator.Current == "\n") { InsertNewLine(<>c__DisplayClass6_.enumerator, baseIndent, <>c__DisplayClass6_.toFlush); <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else if (<>c__DisplayClass6_.enumerator.Current == "_") { BuildIdentifierName(<>c__DisplayClass6_.enumerator, <>c__DisplayClass6_.toFlush, out string found); if (found == string.Empty) { <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); continue; } <>c__DisplayClass6_.idName += found; <Tokenize>g__end|6_0(ref <>c__DisplayClass6_); } else if (char.IsDigit(<>c__DisplayClass6_.enumerator.Current[0])) { BuildNumber(<>c__DisplayClass6_.enumerator, <>c__DisplayClass6_.toFlush, out var foundFull); flag = !foundFull; <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else if (BuiltinFunctions.Contains(<>c__DisplayClass6_.enumerator.Current)) { <>c__DisplayClass6_.toFlush.Add(new Token((TokenType)5, (uint?)(uint)BuiltinFunctions.IndexOf(<>c__DisplayClass6_.enumerator.Current))); <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else if (Tokens.TryGetValue(<>c__DisplayClass6_.enumerator.Current, ref val)) { <>c__DisplayClass6_.toFlush.Add(new Token(val, (uint?)null)); <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else if (<>c__DisplayClass6_.enumerator.Current.StartsWith('"')) { string current = <>c__DisplayClass6_.enumerator.Current; <>c__DisplayClass6_.toFlush.Add((Token)new ConstantToken((Variant)new StringVariant(current.Substring(1, current.Length - 2)))); <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else if (bool.TryParse(<>c__DisplayClass6_.enumerator.Current, ref flag2)) { <>c__DisplayClass6_.toFlush.Add((Token)new ConstantToken((Variant)new BoolVariant(flag2))); <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_); } else { <>c__DisplayClass6_.idName += <>c__DisplayClass6_.enumerator.Current; <Tokenize>g__end|6_0(ref <>c__DisplayClass6_); } } <>7__wrap1 = <>c__DisplayClass6_.finalTokens.GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { Token current2 = <>7__wrap1.Current; <>2__current = current2; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = default(Enumerator<Token>); 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; ((global::System.IDisposable)<>7__wrap1).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() { <Tokenize>d__6 <Tokenize>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <Tokenize>d__ = this; } else { <Tokenize>d__ = new <Tokenize>d__6(0); } <Tokenize>d__.gdScript = <>3__gdScript; <Tokenize>d__.baseIndent = <>3__baseIndent; return <Tokenize>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 <TokenizeString>d__8 : global::System.Collections.Generic.IEnumerable<string>, global::System.Collections.IEnumerable, global::System.Collections.Generic.IEnumerator<string>, global::System.Collections.IEnumerator, global::System.IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private string text; public string <>3__text; private <>c__DisplayClass8_0 <>8__1; private int <i>5__2; private int <start>5__3; private Enumerator<string> <>7__wrap3; private string <delimiter>5__5; string global::System.Collections.Generic.IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object global::System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TokenizeString>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 (num == -3 || (uint)(num - 6) <= 1u) { try { } finally { <>m__Finally1(); } } } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0320: 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) //IL_025a: Unknown result type (might be due to invalid IL or missing references) try { bool flag; switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1.builder = new StringBuilder(20); <i>5__2 = 0; goto IL_0397; case 1: <>1__state = -1; <>8__1.builder.Append('"'); <i>5__2++; while (<i>5__2 < text.Length) { <>8__1.builder.Append(text[<i>5__2]); if (text[<i>5__2] == '"') { break; } <i>5__2++; } <>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1); <>1__state = 2; return true; case 2: <>1__state = -1; goto IL_0385; case 3: <>1__state = -1; <start>5__3 = <i>5__2; <i>5__2++; while (<i>5__2 < text.Length && text[<i>5__2] == '\t') { <i>5__2++; } <i>5__2--; <>2__current = "\n"; <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = $"{<i>5__2 - <start>5__3}"; <>1__state = 5; return true; case 5: <>1__state = -1; goto IL_0385; case 6: <>1__state = -3; <>2__current = <delimiter>5__5; <>1__state = 7; return true; case 7: <>1__state = -3; <i>5__2 += <delimiter>5__5.Length - 1; flag = true; goto IL_0314; case 8: <>1__state = -1; goto IL_0385; case 9: { <>1__state = -1; return false; } IL_0397: if (<i>5__2 < text.Length) { switch (text[<i>5__2]) { case '"': <>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1); <>1__state = 1; return true; case '\n': <>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1); <>1__state = 3; return true; } flag = false; <>7__wrap3 = Symbols.GetEnumerator(); <>1__state = -3; while (<>7__wrap3.MoveNext()) { <delimiter>5__5 = <>7__wrap3.Current; if (Match(text, <i>5__2, <delimiter>5__5)) { <>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1); <>1__state = 6; return true; } <delimiter>5__5 = null; } goto IL_0314; } <>2__current = "\n"; <>1__state = 9; return true; IL_0385: <i>5__2++; goto IL_0397; IL_0314: <>m__Finally1(); <>7__wrap3 = default(Enumerator<string>); if (!flag) { if (text[<i>5__2] == ' ') { <>2__current = <TokenizeString>g__ClearBuilder|8_0(ref <>8__1); <>1__state = 8; return true; } <>8__1.builder.Append(text[<i>5__2]); } goto IL_0385; } } 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; ((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<string> global::System.Collections.Generic.IEnumerable<string>.GetEnumerator() { <TokenizeString>d__8 <TokenizeString>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <TokenizeString>d__ = this; } else { <TokenizeString>d__ = new <TokenizeString>d__8(0); } <TokenizeString>d__.text = <>3__text; return <TokenizeString>d__; } [DebuggerHidden] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<string>)this).GetEnumerator(); } } private static readonly Dictionary<string, TokenType> Tokens; private static readonly HashSet<string> Symbols; private static readonly List<string> BuiltinFunctions; private static void InsertNewLine(global::System.Collections.Generic.IEnumerator<string> enumerator, uint baseIndent, List<Token> toFlush) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { uint num = uint.Parse(enumerator.Current); toFlush.Add(new Token((TokenType)89, (uint?)(num + baseIndent))); } } private static void BuildIdentifierName(global::System.Collections.Generic.IEnumerator<string> enumerator, List<Token> toFlush, out string? found) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown found = string.Empty; if (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { if (enumerator.Current == ":") { toFlush.Add(new Token((TokenType)92, (uint?)null)); toFlush.Add(new Token((TokenType)83, (uint?)null)); } else { found = "_" + enumerator.Current; } } } private static void BuildNumber(global::System.Collections.Generic.IEnumerator<string> enumerator, List<Token> toFlush, out bool foundFull) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown foundFull = true; int num = 1; if (enumerator.Current == "-") { num = -1; if (!((global::System.Collections.IEnumerator)enumerator).MoveNext()) { return; } } long num2 = default(long); if (!long.TryParse(enumerator.Current, ref num2)) { toFlush.Add(new Token((TokenType)17, (uint?)null)); foundFull = false; } else if (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { long num3 = default(long); if (enumerator.Current != ".") { toFlush.Add((Token)new ConstantToken((Variant)new IntVariant(num2 * num, false))); foundFull = false; } else if (((global::System.Collections.IEnumerator)enumerator).MoveNext() && long.TryParse(enumerator.Current, ref num3)) { double num4 = (double)num2 + (double)num3 / Math.Pow(10.0, (double)num3.ToString().Length); toFlush.Add((Token)new ConstantToken((Variant)new RealVariant(num4 * (double)num, false))); } } } [IteratorStateMachine(typeof(<Tokenize>d__6))] public static global::System.Collections.Generic.IEnumerable<Token> Tokenize(string gdScript, uint baseIndent = 0u) { List<Token> finalTokens = new List<Token>(); global::System.Collections.Generic.IEnumerable<string> enumerable = SanitizeInput(TokenizeString(gdScript + " ")); string previous = string.Empty; string idName = string.Empty; List<Token> toFlush = new List<Token>(2); global::System.Collections.Generic.IEnumerator<string> enumerator = enumerable.GetEnumerator(); bool flag = false; TokenType val = default(TokenType); bool flag2 = default(bool); while (flag || ((global::System.Collections.IEnumerator)enumerator).MoveNext()) { flag = false; if (enumerator.Current == "\n") { InsertNewLine(enumerator, baseIndent, toFlush); endAndFlushId(); } else if (enumerator.Current == "_") { BuildIdentifierName(enumerator, toFlush, out string found); if (found == string.Empty) { endAndFlushId(); continue; } idName += found; end(); } else if (char.IsDigit(enumerator.Current[0])) { BuildNumber(enumerator, toFlush, out var foundFull); flag = !foundFull; endAndFlushId(); } else if (BuiltinFunctions.Contains(enumerator.Current)) { toFlush.Add(new Token((TokenType)5, (uint?)(uint)BuiltinFunctions.IndexOf(enumerator.Current))); endAndFlushId(); } else if (Tokens.TryGetValue(enumerator.Current, ref val)) { toFlush.Add(new Token(val, (uint?)null)); endAndFlushId(); } else if (enumerator.Current.StartsWith('"')) { string current = enumerator.Current; toFlush.Add((Token)new ConstantToken((Variant)new StringVariant(current.Substring(1, current.Length - 2)))); endAndFlushId(); } else if (bool.TryParse(enumerator.Current, ref flag2)) { toFlush.Add((Token)new ConstantToken((Variant)new BoolVariant(flag2))); endAndFlushId(); } else { idName += enumerator.Current; end(); } } Enumerator<Token> enumerator2 = finalTokens.GetEnumerator(); try { while (enumerator2.MoveNext()) { yield return enumerator2.Current; } } finally { ((global::System.IDisposable)enumerator2).Dispose(); } [CompilerGenerated] void end() { previous = enumerator.Current; finalTokens.AddRange((global::System.Collections.Generic.IEnumerable<Token>)toFlush); toFlush.Clear(); } [CompilerGenerated] void endAndFlushId() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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 //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown string text; char c; if (idName != string.Empty) { if (idName.Trim() == "return") { finalTokens.Add(new Token((TokenType)46, (uint?)null)); } else if (idName.Trim() == "self") { finalTokens.Add(new Token((TokenType)3, (uint?)null)); } else { text = idName.Trim(); if (text == null) { goto IL_0301; } switch (text.Length) { case 5: break; case 3: goto IL_00f3; case 4: goto IL_016c; case 7: goto IL_0181; case 10: goto IL_0196; default: goto IL_0301; } c = text[0]; if ((uint)c <= 98u) { if (c != 'C') { if (c != 'b' || !(text == "break")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)43, (uint?)null)); } else { if (!(text == "Color")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)4, (uint?)14u)); } } else if (c != 'm') { if (c != 'p' || !(text == "print")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)5, (uint?)63u)); } else { if (!(text == "match")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)47, (uint?)null)); } } goto IL_031c; } goto IL_0327; IL_0301: finalTokens.Add((Token)new IdentifierToken(idName.Trim())); goto IL_031c; IL_0181: if (!(text == "Vector3")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)4, (uint?)7u)); goto IL_031c; IL_031c: idName = string.Empty; goto IL_0327; IL_00f3: c = text[0]; if (c != 'a') { if (c != 'i') { if (c != 'p' || !(text == "pow")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)5, (uint?)19u)); } else { if (!(text == "int")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)4, (uint?)2u)); } } else { if (!(text == "abs")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)5, (uint?)17u)); } goto IL_031c; IL_016c: if (!(text == "null")) { goto IL_0301; } finalTokens.Add((Token)new ConstantToken((Variant)new NilVariant())); goto IL_031c; IL_0327: end(); return; IL_0196: if (!(text == "lerp_angle")) { goto IL_0301; } finalTokens.Add(new Token((TokenType)5, (uint?)31u)); goto IL_031c; } } [IteratorStateMachine(typeof(<SanitizeInput>d__7))] private static global::System.Collections.Generic.IEnumerable<string> SanitizeInput(global::System.Collections.Generic.IEnumerable<string> tokens) { global::System.Collections.Generic.IEnumerator<string> enumerator = tokens.GetEnumerator(); try { while (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { string current = enumerator.Current; if (!(current != "\n") || !string.IsNullOrWhiteSpace(current)) { yield return current; } } } finally { ((global::System.IDisposable)enumerator)?.Dispose(); } } [IteratorStateMachine(typeof(<TokenizeString>d__8))] private static global::System.Collections.Generic.IEnumerable<string> TokenizeString(string text) { StringBuilder builder = new StringBuilder(20); for (int j = 0; j < text.Length; j++) { switch (text[j]) { case '"': yield return ClearBuilder(); builder.Append('"'); for (j++; j < text.Length; j++) { builder.Append(text[j]); if (text[j] == '"') { break; } } yield return ClearBuilder(); continue; case '\n': { yield return ClearBuilder(); int start = j; for (j++; j < text.Length && text[j] == '\t'; j++) { } j--; yield return "\n"; yield return $"{j - start}"; continue; } } bool flag = false; Enumerator<string> enumerator = Symbols.GetEnumerator(); try { while (enumerator.MoveNext()) { string delimiter = enumerator.Current; if (Match(text, j, delimiter)) { yield return ClearBuilder(); yield return delimiter; j += delimiter.Length - 1; flag = true; break; } } } finally { ((global::System.IDisposable)enumerator).Dispose(); } if (!flag) { if (text[j] == ' ') { yield return ClearBuilder(); } else { builder.Append(text[j]); } } } yield return "\n"; [CompilerGenerated] string ClearBuilder() { string result = ((object)builder).ToString(); builder.Clear(); return result; } } private static bool Match(string text, int index, string match) { if (index + match.Length > text.Length) { return false; } for (int i = 0; i < match.Length; i++) { if (text[index + i] != match[i]) { return false; } } return true; } static ScriptTokenizer() { Dictionary<string, TokenType> obj = new Dictionary<string, TokenType>(); obj.Add("continue", (TokenType)44); obj.Add("return", (TokenType)46); obj.Add("break", (TokenType)43); obj.Add("match", (TokenType)47); obj.Add("while", (TokenType)42); obj.Add("elif", (TokenType)39); obj.Add("else", (TokenType)40); obj.Add("pass", (TokenType)45); obj.Add("for", (TokenType)41); obj.Add("if", (TokenType)38); obj.Add("const", (TokenType)58); obj.Add("var", (TokenType)59); obj.Add("func", (TokenType)48); obj.Add("class", (TokenType)49); obj.Add("extends", (TokenType)51); obj.Add("is", (TokenType)52); obj.Add("as", (TokenType)60); obj.Add("@onready", (TokenType)53); obj.Add("@tool", (TokenType)54); obj.Add("@export", (TokenType)56); obj.Add("yield", (TokenType)65); obj.Add("setget", (TokenType)57); obj.Add("static", (TokenType)55); obj.Add("void", (TokenType)61); obj.Add("enum", (TokenType)62); obj.Add("preload", (TokenType)63); obj.Add("assert", (TokenType)64); obj.Add("signal", (TokenType)66); obj.Add("breakpoint", (TokenType)67); obj.Add("sync", (TokenType)69); obj.Add("remote", (TokenType)68); obj.Add("master", (TokenType)70); obj.Add("slave", (TokenType)71); obj.Add("puppet", (TokenType)72); obj.Add("remotesync", (TokenType)73); obj.Add("mastersync", (TokenType)74); obj.Add("puppetsync", (TokenType)75); obj.Add("\n", (TokenType)89); obj.Add("PI", (TokenType)90); obj.Add("TAU", (TokenType)91); obj.Add("INF", (TokenType)93); obj.Add("NAN", (TokenType)94); obj.Add("error", (TokenType)95); obj.Add("cursor", (TokenType)97); obj.Add("self", (TokenType)3); obj.Add("in", (TokenType)6); obj.Add("_", (TokenType)92); obj.Add("[", (TokenType)76); obj.Add("]", (TokenType)77); obj.Add("{", (TokenType)78); obj.Add("}", (TokenType)79); obj.Add("(", (TokenType)80); obj.Add(")", (TokenType)81); obj.Add(",", (TokenType)82); obj.Add(";", (TokenType)83); obj.Add(".", (TokenType)84); obj.Add("?", (TokenType)85); obj.Add(":", (TokenType)86); obj.Add("$", (TokenType)87); obj.Add("->", (TokenType)88); obj.Add(">>=", (TokenType)30); obj.Add("<<=", (TokenType)29); obj.Add(">>", (TokenType)22); obj.Add("<<", (TokenType)21); obj.Add("==", (TokenType)7); obj.Add("!=", (TokenType)8); obj.Add("&&", (TokenType)13); obj.Add("||", (TokenType)14); obj.Add("!", (TokenType)15); obj.Add("+=", (TokenType)24); obj.Add("-=", (TokenType)25); obj.Add("*=", (TokenType)26); obj.Add("/=", (TokenType)27); obj.Add("%=", (TokenType)28); obj.Add("&=", (TokenType)31); obj.Add("|=", (TokenType)32); obj.Add("^=", (TokenType)33); obj.Add("+", (TokenType)16); obj.Add("-", (TokenType)17); obj.Add("*", (TokenType)18); obj.Add("/", (TokenType)19); obj.Add("%", (TokenType)20); obj.Add("~", (TokenType)37); obj.Add("&", (TokenType)34); obj.Add("|", (TokenType)35); obj.Add("^", (TokenType)36); obj.Add("<=", (TokenType)10); obj.Add(">=", (TokenType)12); obj.Add("<", (TokenType)9); obj.Add(">", (TokenType)11); obj.Add("=", (TokenType)23); Tokens = obj; HashSet<string> obj2 = new HashSet<string>(); obj2.Add("->"); obj2.Add(">>="); obj2.Add("<<="); obj2.Add(">>"); obj2.Add("<<"); obj2.Add("=="); obj2.Add("!="); obj2.Add("&&"); obj2.Add("||"); obj2.Add("!"); obj2.Add("+="); obj2.Add("-="); obj2.Add("*="); obj2.Add("/="); obj2.Add("%="); obj2.Add("&="); obj2.Add("|="); obj2.Add("^="); obj2.Add("_"); obj2.Add("["); obj2.Add("]"); obj2.Add("{"); obj2.Add("}"); obj2.Add("("); obj2.Add(")"); obj2.Add(","); obj2.Add(";"); obj2.Add("."); obj2.Add("?"); obj2.Add(":"); obj2.Add("$"); obj2.Add("+"); obj2.Add("-"); obj2.Add("*"); obj2.Add("/"); obj2.Add("%"); obj2.Add("~"); obj2.Add("&"); obj2.Add("|"); obj2.Add("^"); obj2.Add("<="); obj2.Add(">="); obj2.Add("<"); obj2.Add(">"); obj2.Add("="); Symbols = obj2; BuiltinFunctions = Enumerable.ToList<string>((global::System.Collections.Generic.IEnumerable<string>)global::System.Enum.GetNames<BuiltinFunction>()); } [CompilerGenerated] internal static void <Tokenize>g__end|6_0(ref <>c__DisplayClass6_0 P_0) { P_0.previous = P_0.enumerator.Current; P_0.finalTokens.AddRange((global::System.Collections.Generic.IEnumerable<Token>)P_0.toFlush); P_0.toFlush.Clear(); } [CompilerGenerated] internal static void <Tokenize>g__endAndFlushId|6_1(ref <>c__DisplayClass6_0 P_0) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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 //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown string text; char c; if (P_0.idName != string.Empty) { if (P_0.idName.Trim() == "return") { P_0.finalTokens.Add(new Token((TokenType)46, (uint?)null)); } else if (P_0.idName.Trim() == "self") { P_0.finalTokens.Add(new Token((TokenType)3, (uint?)null)); } else { text = P_0.idName.Trim(); if (text == null) { goto IL_0301; } switch (text.Length) { case 5: break; case 3: goto IL_00f3; case 4: goto IL_016c; case 7: goto IL_0181; case 10: goto IL_0196; default: goto IL_0301; } c = text[0]; if ((uint)c <= 98u) { if (c != 'C') { if (c != 'b' || !(text == "break")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)43, (uint?)null)); } else { if (!(text == "Color")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)4, (uint?)14u)); } } else if (c != 'm') { if (c != 'p' || !(text == "print")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)5, (uint?)63u)); } else { if (!(text == "match")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)47, (uint?)null)); } } goto IL_031c; } goto IL_0327; IL_0301: P_0.finalTokens.Add((Token)new IdentifierToken(P_0.idName.Trim())); goto IL_031c; IL_0181: if (!(text == "Vector3")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)4, (uint?)7u)); goto IL_031c; IL_031c: P_0.idName = string.Empty; goto IL_0327; IL_00f3: c = text[0]; if (c != 'a') { if (c != 'i') { if (c != 'p' || !(text == "pow")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)5, (uint?)19u)); } else { if (!(text == "int")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)4, (uint?)2u)); } } else { if (!(text == "abs")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)5, (uint?)17u)); } goto IL_031c; IL_016c: if (!(text == "null")) { goto IL_0301; } P_0.finalTokens.Add((Token)new ConstantToken((Variant)new NilVariant())); goto IL_031c; IL_0327: <Tokenize>g__end|6_0(ref P_0); return; IL_0196: if (!(text == "lerp_angle")) { goto IL_0301; } P_0.finalTokens.Add(new Token((TokenType)5, (uint?)31u)); goto IL_031c; } [CompilerGenerated] internal static string <TokenizeString>g__ClearBuilder|8_0(ref <>c__DisplayClass8_0 P_0) { string result = ((object)P_0.builder).ToString(); P_0.builder.Clear(); return result; } } public static class TokenUtil { [CompilerGenerated] private sealed class <ReplaceAssignmentsAsDeferred>d__0 : 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 global::System.Collections.Generic.IEnumerable<Token> tokens; public global::System.Collections.Generic.IEnumerable<Token> <>3__tokens; private HashSet<string> ignoredIdentifiers; public HashSet<string> <>3__ignoredIdentifiers; private bool <inAssignmentStatement>5__2; private bool <skipLine>5__3; private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap3; private Token <t>5__5; private IdentifierToken <identifier>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 <ReplaceAssignmentsAsDeferred>d__0(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) <= 7u) { try { } finally { <>m__Finally1(); } } } private bool MoveNext() { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Invalid comparison between Unknown and I4 //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Invalid comparison between Unknown and I4 //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown try { Token val; switch (<>1__state) { default: return false; case 0: <>1__state = -1; val = null; <inAssignmentStatement>5__2 = false; <skipLine>5__3 = false; <>7__wrap3 = tokens.GetEnumerator(); <>1__state = -3; goto IL_02c2; case 1: <>1__state = -3; <>2__current = new Token((TokenType)80, (uint?)null); <>1__state = 2; return true; case 2: <>1__state = -3; <>2__current = (Token)new ConstantToken((Variant)new StringVariant(<identifier>5__6.Name)); <>1__state = 3; return true; case 3: <>1__state = -3; <>2__current = new Token((TokenType)82, (uint?)null); <>1__state = 4; return true; case 4: <>1__state = -3; val = null; goto IL_02c2; case 5: <>1__state = -3; goto IL_0218; case 6: <>1__state = -3; <>2__current = <t>5__5; <>1__state = 7; return true; case 7: <>1__state = -3; goto IL_0289; case 8: <>1__state = -3; goto IL_0289; case 9: { <>1__state = -1; break; } IL_02c2: if (((global::System.Collections.IEnumerator)<>7__wrap3).MoveNext()) { <t>5__5 = <>7__wrap3.Current; if (<t>5__5 == null) { goto IL_00b8; } TokenType type = <t>5__5.Type; if ((int)type != 59) { if ((int)type != 89) { goto IL_00b8; } <skipLine>5__3 = false; } else { <skipLine>5__3 = true; } goto IL_01d9; } <>m__Finally1(); <>7__wrap3 = null; if (val != null) { <>2__current = val; <>1__state = 9; return true; } break; IL_00b8: <identifier>5__6 = (IdentifierToken)(object)((val is IdentifierToken) ? val : null); if (<identifier>5__6 != null && (ignoredIdentifiers == null || !ignoredIdentifiers.Contains(<identifier>5__6.Name)) && <t>5__5 != null && (int)<t>5__5.Type == 23 && !<skipLine>5__3) { <inAssignmentStatement>5__2 = true; <>2__current = (Token)new IdentifierToken("set_deferred"); <>1__state = 1; return true; } goto IL_01d9; IL_0218: <>2__current = new Token((TokenType)81, (uint?)null); <>1__state = 6; return true; IL_0289: val = (Token)((<inAssignmentStatement>5__2 && <t>5__5 != null && (int)<t>5__5.Type == 1) ? ((object)StripAssociatedData(<t>5__5)) : ((object)<t>5__5)); <t>5__5 = null; goto IL_02c2; IL_01d9: if (((int)<t>5__5.Type == 89) & <inAssignmentStatement>5__2) { <inAssignmentStatement>5__2 = false; if (val != null) { <>2__current = val; <>1__state = 5; return true; } goto IL_0218; } if (val != null) { <>2__current = val; <>1__state = 8; return true; } goto IL_0289; } 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() { <ReplaceAssignmentsAsDeferred>d__0 <ReplaceAssignmentsAsDeferred>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <ReplaceAssignmentsAsDeferred>d__ = this; } else { <ReplaceAssignmentsAsDeferred>d__ = new <ReplaceAssignmentsAsDeferred>d__0(0); } <ReplaceAssignmentsAsDeferred>d__.tokens = <>3__tokens; <ReplaceAssignmentsAsDeferred>d__.ignoredIdentifiers = <>3__ignoredIdentifiers; return <ReplaceAssignmentsAsDeferred>d__; } [DebuggerHidden] global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() { return (global::System.Collections.IEnumerator)((global::System.Collections.Generic.IEnumerable<Token>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<ReplaceAssignmentsAsDeferred>d__0))] public static global::System.Collections.Generic.IEnumerable<Token> ReplaceAssignmentsAsDeferred(global::System.Collections.Generic.IEnumerable<Token> tokens, HashSet<string>? ignoredIdentifiers = null) { Token val = null; bool inAssignmentStatement = false; bool skipLine = false; global::System.Collections.Generic.IEnumerator<Token> enumerator = tokens.GetEnumerator(); try { while (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { Token t = enumerator.Current; if (t == null) { goto IL_00b8; } TokenType type = t.Type; if ((int)type != 59) { if ((int)type != 89) { goto IL_00b8; } skipLine = false; } else { skipLine = true; } goto IL_01d9; IL_00b8: IdentifierToken identifier = (IdentifierToken)(object)((val is IdentifierToken) ? val : null); if (identifier != null && (ignoredIdentifiers == null || !ignoredIdentifiers.Contains(identifier.Name)) && t != null && (int)t.Type == 23 && !skipLine) { inAssignmentStatement = true; yield return (Token)new IdentifierToken("set_deferred"); yield return new Token((TokenType)80, (uint?)null); yield return (Token)new ConstantToken((Variant)new StringVariant(identifier.Name)); yield return new Token((TokenType)82, (uint?)null); val = null; continue; } goto IL_01d9; IL_01d9: if ((int)t.Type == 89 && inAssignmentStatement) { inAssignmentStatement = false; if (val != null) { yield return val; } yield return new Token((TokenType)81, (uint?)null); yield return t; } else if (val != null) { yield return val; } val = (Token)((inAssignmentStatement && t != null && (int)t.Type == 1) ? ((object)StripAssociatedData(t)) : ((object)t)); } } finally { ((global::System.IDisposable)enumerator)?.Dispose(); } if (val != null) { yield return val; } } public static Token ReplaceToken(Token cursor, Token target, Token replacement) { if (!TokenEquals(cursor, target)) { return cursor; } return replacement; } public static global::System.Collections.Generic.IEnumerable<Token> ReplaceTokens(global::System.Collections.Generic.IEnumerable<Token> haystack, global::System.Collections.Generic.IEnumerable<Token> needle, global::System.Collections.Generic.IEnumerable<Token> replacements) { List<Token> val = Enumerable.ToList<Token>(haystack); List<Token> val2 = Enumerable.ToList<Token>(needle); List<Token> val3 = Enumerable.ToList<Token>(replacements); if (val2.Count == 0) { return (global::System.Collections.Generic.IEnumerable<Token>)val; } List<Token> val4 = new List<Token>(); int num = 0; while (num < val.Count) { if (IsMatch(val, val2, num)) { val4.AddRange((global::System.Collections.Generic.IEnumerable<Token>)val3); num += val2.Count; } else { val4.Add(val[num]); num++; } } return (global::System.Collections.Generic.IEnumerable<Token>)val4; } private static bool IsMatch(List<Token> haystack, List<Token> needle, int startIndex) { if (startIndex + needle.Count > haystack.Count) { return false; } for (int i = 0; i < needle.Count; i++) { if (!TokenEquals(haystack[startIndex + i], needle[i])) { return false; } } return true; } private static bool TokenEquals(Token token, Token token1) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) IdentifierToken val = (IdentifierToken)(object)((token is IdentifierToken) ? token : null); if (val != null) { IdentifierToken val2 = (IdentifierToken)(object)((token1 is IdentifierToken) ? token1 : null); if (val2 != null) { return val.Name == val2.Name; } } ConstantToken val3 = (ConstantToken)(object)((token is ConstantToken) ? token : null); if (val3 != null) { ConstantToken val4 = (ConstantToken)(object)((token1 is ConstantToken) ? token1 : null); if (val4 != null) { return val3.Value.Equals(val4.Value); } } if (token.Type == token1.Type) { return token.AssociatedData == token1.AssociatedData; } return false; } private static Token StripAssociatedData(Token token) { token.AssociatedData = null; return token; } } public static class WeaveUtil { public static bool IsModLoaded(IModInterface modInterface, string modName) { return Enumerable.Contains<string>((global::System.Collections.Generic.IEnumerable<string>)modInterface.LoadedMods, modName); } } } namespace Teemaw.Calico.ScriptMod { public static class ActorScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("ActorScriptMod").Patching("res://Scenes/Entities/actor.gdc") .AddRule(new TransformationRuleBuilder().Named("network_share_signal_gate").Matching(TransformationPatternFactory.CreateGdSnippetPattern("Network.connect(\"_network_tick\", self, \"_network_share\")")).Do(Operation.ReplaceAll) .With("\r\nif controlled:\r\n\tNetwork.connect(\"_network_tick\", self, \"_network_share\")\r\n", 1u)) .Build(); } } public static class BushParticleDetectScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("BushParticleDetectScriptMod").Patching("res://Scenes/Map/Props/bush_particle_detect.gdc") .AddRule(new TransformationRuleBuilder().Named("globals").Matching(TransformationPatternFactory.CreateGlobalsPattern()).Do(Operation.Append) .With("\r\nvar calico_player\r\n\r\nfunc _ready():\r\n\tcalico_player = $AudioStreamPlayer3D\r\n\tcalico_player.connect(\"finished\", self, \"remove_child\", [calico_player])\r\n\tremove_child(calico_player)\r\n")) .AddRule(new TransformationRuleBuilder().Named("play").Matching(TransformationPatternFactory.CreateGdSnippetPattern("$AudioStreamPlayer3D.play()")).Do(Operation.ReplaceAll) .With("add_child(calico_player)\r\ncalico_player.play()", 2u)) .Build(); } } public static class Fishing3ScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("Fishing3ScriptMod").Patching("res://Scenes/Minigames/Fishing3/fishing3.gdc") .AddRule(new TransformationRuleBuilder().Named("main_progress").Matching(TransformationPatternFactory.CreateGdSnippetPattern("main_progress += reel_speed")).Do(Operation.ReplaceAll) .With("main_progress += 2 * reel_speed")) .AddRule(new TransformationRuleBuilder().Named("bad_progress").Matching(TransformationPatternFactory.CreateGdSnippetPattern("bad_progress += bad_speed")).Do(Operation.ReplaceAll) .With("bad_progress += 2 * bad_speed")) .Build(); } } public static class GlobalsScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("GlobalsScriptMod").Patching("res://Scenes/Singletons/globals.gdc") .AddRule(new TransformationRuleBuilder().Named("ready").Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_ready")).Do(Operation.Append) .With("\r\nprint(\"[calico] Setting physics FPS...\")\r\nEngine.set_iterations_per_second(30)\r\n", 1u)) .Build(); } } public static class GuitarStringSoundScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("GuitarStringSoundScriptMod").Patching("res://Scenes/Entities/Player/guitar_string_sound.gdc") .AddRule(new TransformationRuleBuilder().Named("globals").Matching(TransformationPatternFactory.CreateGlobalsPattern()).Do(Operation.Append) .With("\r\nvar calico_playing_count = 0\r\n")) .AddRule(new TransformationRuleBuilder().Named("add_child_in_ready").Matching(TransformationPatternFactory.CreateGdSnippetPattern("add_child(new)")).Do(Operation.ReplaceAll) .With((global::System.Collections.Generic.IEnumerable<Token>)global::System.Array.Empty<Token>())) .AddRule(new TransformationRuleBuilder().Named("call_guard").Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_call")).Do(Operation.Append) .With("\r\nif calico_playing_count == 0: return\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("node_play").Matching(TransformationPatternFactory.CreateGdSnippetPattern("node.play(point)")).Do(Operation.Prepend) .With("\r\nadd_child(node)\r\ncalico_playing_count += 1\r\n", 3u)) .AddRule(new TransformationRuleBuilder().Named("node_stopped").Matching(TransformationPatternFactory.CreateGdSnippetPattern("sound.playing = false")).Do(Operation.Append) .With("\r\nremove_child(sound)\r\ncalico_playing_count -= 1\r\n", 3u)) .Build(); } } public static class HeldItemScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("HeldItemScriptMod").Patching("res://Scenes/Entities/Player/held_item.gdc") .AddRule(new TransformationRuleBuilder().Named("physics_process").Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_physics_process", new string[1] { "delta" })).Do(Operation.Append) .With("\r\nreturn", 1u)) .Build(); } } public static class MainMapScriptModFactory { public static IScriptMod Create(IModInterface mod, Config config) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("MainMapScriptMod").Patching("res://Scenes/Map/main_map.gdc") .AddRule(new TransformationRuleBuilder().Named("globals").When(config.MeshGpuInstancingEnabled).Matching(TransformationPatternFactory.CreateGlobalsPattern()) .Do(Operation.Append) .With("\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\tif parent.get_child_count() == 0:\r\n\t\treturn mmi\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\tif children.size() == 0:\r\n\t\treturn mmi\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")) .AddRule(new TransformationRuleBuilder().Named("dynamic_zones_globals").When(config.DynamicZonesEnabled).Matching(TransformationPatternFactory.CreateGlobalsPattern()) .Do(Operation.Append) .With("\r\nvar calico_zones = {}\r\n")) .AddRule(new TransformationRuleBuilder().Named("set_zone").When(config.DynamicZonesEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_set_zone", new string[1] { "id" })) .Do(Operation.Append) .With("\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)) .AddRule(new TransformationRuleBuilder().Named("get_zone").When(config.DynamicZonesEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_get_zone", new string[1] { "id" })) .Do(Operation.Append) .With("\r\nif calico_zones.has(id): return calico_zones[id]\r\n", 1u)) .Build(); } } public static class PlayerFaceScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("PlayerFaceScriptMod").Patching("res://Scenes/Entities/Player/Face/player_face.gdc") .AddRule(new TransformationRuleBuilder().Named("reset_time").Matching(TransformationPatternFactory.CreateGdSnippetPattern("reset_time -= 1")).Do(Operation.ReplaceAll) .With("reset_time -= 60 * delta")) .AddRule(new TransformationRuleBuilder().Named("blink_time").Matching(TransformationPatternFactory.CreateGdSnippetPattern("blink_time -= 1")).Do(Operation.ReplaceAll) .With("blink_time -= 60 * delta")) .AddRule(new TransformationRuleBuilder().Named("blink_amount").Matching(TransformationPatternFactory.CreateGdSnippetPattern("blink_amount -= 1")).Do(Operation.ReplaceAll) .With("blink_amount -= 60 * delta")) .AddRule(new TransformationRuleBuilder().Named("emote_time").Matching(TransformationPatternFactory.CreateGdSnippetPattern("emote_time -= 1")).Do(Operation.ReplaceAll) .With("emote_time -= 60 * delta")) .Build(); } } public static class PlayerHeadHudScriptModFactory { public static IScriptMod Create(IModInterface mod, Config config) { Config config2 = config; return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("PlayerHeadHudScriptMod").Patching("res://Scenes/Entities/Player/player_headhud.gdc") .When(() => config2.SmoothCameraEnabled) .AddRule(new TransformationRuleBuilder().Named("globals").Matching(TransformationPatternFactory.CreateGlobalsPattern()).Do(Operation.Append) .With("\r\nfunc calico_setup(new_parent, new_offset):\r\n\tparent = new_parent\r\n\toffset = new_offset\r\n")) .AddRule(new TransformationRuleBuilder().Named("ready").Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_ready")).Do(Operation.Append) .With("\r\nprocess_priority = -1 + get_parent().process_priority\r\n", 1u)) .Build(); } } public static class PlayerHudScriptModFactory { public static IScriptMod Create(IModInterface mod) { return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("PlayerHudScriptMod").Patching("res://Scenes/HUD/playerhud.gdc") .AddRule(new TransformationRuleBuilder().Named("interact_timer").Matching(TransformationPatternFactory.CreateGdSnippetPattern("if interact:\r\n\tinteract_timer += 2\r\nelif interact_timer > 0:\r\n\tif interact_timer > 28: interact_timer = 28\r\n\tinteract_timer -= 2", 1u)).Do(Operation.ReplaceAll) .With("if interact:\r\n\tinteract_timer += 60 * delta\r\nelif interact_timer > 0:\r\n\tif interact_timer > 28: interact_timer = 28\r\n\tinteract_timer -= 60 * delta\r\n\tif interact_timer < 0: interact_timer = (0)", 1u)) .AddRule(new TransformationRuleBuilder().Named("dialog_decrement").Matching(TransformationPatternFactory.CreateGdSnippetPattern("dialogue_cooldown -= 1")).Do(Operation.ReplaceAll) .With("dialogue_cooldown -= 60 * delta")) .Build(); } } public static class PlayerScriptModFactory { public static IScriptMod Create(IModInterface mod, Config config) { //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Expected O, but got Unknown //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod).Named("PlayerScriptMod").Patching("res://Scenes/Entities/Player/player.gdc") .AddRule(new TransformationRuleBuilder().Named("player_opt_globals").When(config.PlayerOptimizationsEnabled).Matching(TransformationPatternFactory.CreateGlobalsPattern()) .Do(Operation.Append) .With("\r\nvar calico_emote_anim = false\r\nvar calico_emote_anim_b = false\r\nvar calico_old_accessory = []\r\n\r\nfunc calico_cosmetic_data_needs_update(new_cosmetic_data):\r\n\tfor key in PlayerData.FALLBACK_COSM.keys():\r\n\t\tif key == \"accessory\":\r\n\t\t\tif calico_old_accessory.size() != new_cosmetic_data[key].size(): return true\r\n\t\t\tfor item in new_cosmetic_data[key]:\r\n\t\t\t\tif !calico_old_accessory.has(item): return true\r\n\t\t\t\tif calico_old_accessory.count(item) != new_cosmetic_data[key].count(item): return true\r\n\t\telif !new_cosmetic_data.has(key) || !cosmetic_data.has(key):\r\n\t\t\treturn true\r\n\t\telif cosmetic_data[key] != new_cosmetic_data[key]:\r\n\t\t\treturn true\r\n\treturn false\r\n\r\nfunc calico_caught_item_needs_update(new_caught):\r\n\tif new_caught.empty() != caught_item.empty():\r\n\t\treturn true\r\n\tif !new_caught.keys().has(\"id\") || !new_caught.keys().has(\"size\") || !new_caught.keys().has(\"quality\"):\r\n\t\treturn false\r\n\treturn new_caught[\"id\"] != caught_item[\"id\"] || new_caught[\"size\"] != caught_item[\"size\"] || new_caught[\"quality\"] != caught_item[\"quality\"]\r\n")) .AddRule(new TransformationRuleBuilder().Named("player_opt_ready").When(config.PlayerOptimizationsEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_ready")) .Do(Operation.Append) .With("\r\n$Viewport.disable_3d = true\r\n$Viewport.usage = 0\r\n$body/player_body/Armature/Skeleton/head_dog.queue_free()\r\n$body/player_body/Armature/Skeleton/head_cat.queue_free()\r\n$body/player_body/Armature/Skeleton/tool_placeholder.queue_free()\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("player_opt_anim_tree_dupe").When(config.PlayerOptimizationsEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("anim_tree.tree_root.duplicate(true)")) .Do(Operation.Append) .With("\r\ncalico_emote_anim = anim_tree.tree_root.get_node(\"emote_anim\")\r\ncalico_emote_anim_b = anim_tree.tree_root.get_node(\"emote_anim_b\")\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_caught_item").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("if animation_data[\"caught_item\"] != caught_item:")) .Do(Operation.ReplaceAll) .With("if calico_caught_item_needs_update(animation_data[\"caught_item\"]):")) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_root").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var root = anim_tree.tree_root")) .Do(Operation.ReplaceAll) .With((global::System.Collections.Generic.IEnumerable<Token>)global::System.Array.Empty<Token>())) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_node").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var node = root.get_node(\"emote_anim\")")) .Do(Operation.ReplaceAll) .With((global::System.Collections.Generic.IEnumerable<Token>)global::System.Array.Empty<Token>())) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_use_cached_node").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("if node.animation != animation_data[\"emote\"]:")) .Do(Operation.ReplaceAll) .With("if calico_emote_anim.animation != animation_data[\"emote\"]:")) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_node_b").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var node_b = root.get_node(\"emote_anim_b\")")) .Do(Operation.ReplaceAll) .With((global::System.Collections.Generic.IEnumerable<Token>)global::System.Array.Empty<Token>())) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_set_node").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("node.set_animation(new_anim)")) .Do(Operation.ReplaceAll) .With("calico_emote_anim.set_animation(new_anim)")) .AddRule(new TransformationRuleBuilder().Named("player_opt_process_animation_set_node_b").When(config.PlayerOptimizationsEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process_animation")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("node_b.set_animation(new_anim)")) .Do(Operation.ReplaceAll) .With("calico_emote_anim_b.set_animation(new_anim)")) .AddRule(new TransformationRuleBuilder().Named("player_opt_setup_not_controlled").When(config.PlayerOptimizationsEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_setup_not_controlled")) .Do(Operation.Append) .With("\r\n$CollisionShape.disabled = true\r\n$cam_base.queue_free()\r\n$cam_pivot.queue_free()\r\n$SpringArm.queue_free()\r\n$fishing_update.queue_free()\r\n$prop_ray.queue_free()\r\n$bobber_preview.queue_free()\r\n$detection_zones.queue_free()\r\n$interact_range.queue_free()\r\n$catch_cam_position.queue_free()\r\n$camera_freecam_anchor.queue_free()\r\n$water_detect.queue_free()\r\n$sound_emit.queue_free()\r\n$raincloud_check.queue_free()\r\n$local_range.queue_free()\r\n$rot_help.queue_free()\r\n$lean_help.queue_free()\r\n$safe_check.queue_free()\r\n$paint_node.queue_free()\r\n$fish_catch_timer.queue_free()\r\n$step_timer.queue_free()\r\n$image_update.queue_free()\r\n$rain_timer.queue_free()\r\n$metaldetect_timer.queue_free()\r\n$cosmetic_refresh.queue_free()\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("player_opt_update_cosmetics_guard").When(config.PlayerOptimizationsEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("data = PlayerData.FALLBACK_COSM.duplicate()\r\n")) .Do(Operation.Append) .With("\r\n\r\nif !calico_cosmetic_data_needs_update(data):\r\n\tprint(\"[calico] Skipping unnecessary cosmetic update\")\r\n\treturn\r\ncalico_old_accessory = data[\"accessory\"].duplicate()\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("physics_animation_duration").When(config.ReducePhysicsUpdatesEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("anim.length * 60")) .Do(Operation.ReplaceLast) .With((Token)new ConstantToken((Variant)new IntVariant(30L, false)))) .AddRule(new TransformationRuleBuilder().Named("physics_primary_action_hold").When(config.ReducePhysicsUpdatesEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("primary_hold_timer += 1")) .Do(Operation.ReplaceLast) .With((Token)new ConstantToken((Variant)new IntVariant(2L, false)))) .AddRule(new TransformationRuleBuilder().Named("physics_rotation_lerp").When(config.ReducePhysicsUpdatesEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("rotation.y = lerp_angle(rotation.y, rot_help.rotation.y, 0.2")) .Do(Operation.ReplaceLast) .With("12 * delta") .ExpectTimes(3u)) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_globals").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateGlobalsPattern()) .Do(Operation.Append) .With("\r\nvar calico_title_mesh\r\nvar calico_last_physics_origin\r\n\r\nfunc calico_body_interpolate(delta):\r\n\tvar body_origin = $body.global_transform.origin\r\n\tif body_origin.distance_squared_to(global_transform.origin) > 16:\r\n\t\t$body.global_transform = global_transform.translated(Vector3.DOWN)\r\n\t\treturn\r\n\tvar weight = Engine.get_physics_interpolation_fraction()\r\n\tvar virtual_origin = global_transform.translated(Vector3.DOWN).origin\r\n\t$body.global_transform.origin = calico_last_physics_origin.linear_interpolate(virtual_origin, weight)\r\n\t$body.scale = scale\r\n\tvar body_rotation = $body.rotation\r\n\t$body.rotation.x = lerp_angle(body_rotation.x, -rotation.x, weight)\r\n\t$body.rotation.y = lerp_angle(body_rotation.y, rotation.y - PI, weight)\r\n\t$body.rotation.z = lerp_angle(body_rotation.z, -rotation.z, weight)\r\n")) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_ready").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_ready")) .Do(Operation.Append) .With("\r\n$body.set_as_toplevel(true)\r\n$body.global_transform = self.global_transform\r\ncalico_last_physics_origin = global_transform.translated(Vector3.DOWN).origin\r\ncalico_title_mesh = $title\r\ncalico_title_mesh.calico_setup($body, Vector3(0, 3, 0))\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_physics_process").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_physics_process", new string[1] { "delta" })) .Do(Operation.Append) .With("\r\ncalico_last_physics_origin = global_transform.translated(Vector3.DOWN).origin\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_process").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_process", new string[1] { "delta" })) .Do(Operation.Append) .With("\r\ncalico_body_interpolate(delta)\r\nif controlled:\r\n\tcalico_camera_update(delta)\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_rotation_transform").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateGdSnippetPattern("rot_help.global_transform.origin = global_transform")) .Do(Operation.ReplaceLast) .With("$body.global_transform")) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_push_pos").When(config.SmoothCameraEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var push = global_transform.basis.z * cam_push_cur")) .Do(Operation.ReplaceAll) .With("var push = $body.global_transform.basis.z * cam_push_cur")) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_zoom_lerp").When(config.SmoothCameraEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var cam_zoom_lerp = 0.4")) .Do(Operation.ReplaceAll) .With("var cam_zoom_lerp = 24 * delta")) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_base_pos").When(config.SmoothCameraEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("var cam_base_pos = global_transform.origin + push + sit_add")) .Do(Operation.ReplaceAll) .With("var cam_base_pos = $body.global_transform.origin - push + sit_add + Vector3.UP")) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_base_pos_remove").When(config.SmoothCameraEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Matching(TransformationPatternFactory.CreateGdSnippetPattern("cam_base.global_transform.origin = cam_base_pos")) .Do(Operation.ReplaceAll) .With((global::System.Collections.Generic.IEnumerable<Token>)global::System.Array.Empty<Token>())) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_new_base_pos").When(config.SmoothCameraEnabled).ScopedTo(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Matching(new Func<Token, bool>[4] { (Token t) => (int)t.Type == 59, delegate(Token t) { IdentifierToken val2 = (IdentifierToken)(object)((t is IdentifierToken) ? t : null); return val2 != null && val2.Name == "cam_speed"; }, (Token t) => (int)t.Type == 23, delegate(Token t) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ConstantToken val = (ConstantToken)(object)((t is ConstantToken) ? t : null); return val != null && val.Value.Equals((Variant)new RealVariant(0.08, false)); } }) .Do(Operation.ReplaceAll) .With("\r\ncam_base.global_transform.origin = cam_base_pos\r\nvar cam_speed = 4.8 * delta\r\n", 1u)) .AddRule(new TransformationRuleBuilder().Named("smooth_camera_camera_update").When(config.SmoothCameraEnabled).Matching(TransformationPatternFactory.CreateFunctionDefinitionPattern("_camera_update")) .Do(Operation.Append) .With("\r\n\treturn\r\n\r\nfunc calico_camera_update(delta):\r\n\t")) .Build(); } } public static class SoundManagerScriptModFactory { public static IScriptMod Create(IModInterface mod) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown IModInterface mod2 = mod; return (IScriptMod)(object)new TransformationRuleScriptModBuilder().ForMod(mod2).Named("SoundManagerScriptMod").Patching("res://Scenes/Entities/Player/sound_manager.gdc") .AddRule(new TransformationRuleBuilder().Named("globals").Matching(TransformationPatternFactory.CreateGlobalsPattern()).Do(Operation.Append) .With($"\r\nconst CALICO_PERSIST = [{((Func<string>)delegate { int num = 3; List<string> obj = new List<string>(num); CollectionsMarshal.SetCount<string>(obj, num); global::System.Span<string> span = CollectionsMarshal.AsSpan<string>(obj); int num2 = 0; span[num2] = "dive_scrape"; num2++; span[num2] = "reel_slow"; num2++; span[num2] = "reel_fast"; num2++; List<string> val = obj; if (WeaveUtil.IsModLoaded(mod2, "Sulayre.Lure")) { val.Add("bark_cat"); } string[] array = Enumerable.ToArray<string>(Enumerable.Select<string, string>(Enumerable.Append<string>((global::System.Collections.Generic.IEnumerable<string>)val, "bark_cat"), (Func<string, string>)((string node) => "\"" + node + "\""))); return string.Join(", ", array); }).Invoke()}]\r\nvar calico_players = {"{}"}\r\n\r\nfunc _ready():\r\n\tprint(\"[calico] caching player sfx\")\r\n\tfor child in get_children():\r\n\t\tif (child is AudioStreamPlayer3D || child is AudioStreamPlayer) && !CALICO_PERSIST.has(child.name):\r\n\t\t\tcalico_players[child.name] = child\r\n\t\t\tcalico_players[child.name].connect(\"finished\", self, \"calico_remove_child\", [child.name])\r\n\t\t\tremove_child(child)\r\n\r\nfunc calico_remove_child(id):\r\n\tprint(\"[calico] Cleaning up sfx \", id)\r\n\tremove_child(calico_players[id])\r\n\r\nfunc calico_get_player_or_null(id):\r\n\tif !calico_players.has(id):\r\n\t\treturn get_node_or_null(id)\r\n\tif calico_players[id].get_parent() == null:\r\n\t\tadd_child(calico_players[id])\r\n\treturn calico_players[id]\r\n")) .AddRule(new TransformationRuleBuilder().Named("get_node_or_null").Matching(TransformationPatternFactory.CreateGdSnippetPattern("var node = get_node_or_null")).Do(Operation.ReplaceLast) .With((Token)new IdentifierToken("calico_get_player_or_null"))) .Build(); } } public class SteamNetworkScriptMod : IScriptMod { [CompilerGenerated] private sealed class <Modify>d__22 : 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 SteamNetworkScriptMod <>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 Dictionary<string, bool> <patchFlags>5__2; private global::System.Collections.Generic.IEnumerator<Token> <>7__wrap2; private Token <t>5__4; 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__22(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 - -13) > 10u && (uint)(num - 1) > 20u) { 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(); } case -8: case 10: try { break; } finally { <>m__Finally6(); } case -9: case 12: try { break; } finally { <>m__Finally7(); } case -10: case 14: try { break; } finally { <>m__Finally8(); } case -11: case 16: try { break; } finally { <>m__Finally9(); } case -12: case 18: try { break; } finally { <>m__Finally10(); } case -13: case 19: try { break; } finally { <>m__Finally11(); } case -3: case -2: case -1: case 0: case 1: case 3: case 5: case 7: case 9: case 11: case 13: case 15: case 17: break; } } finally { <>m__Finally1(); } } private bool MoveNext() { //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Expected O, but got Unknown //IL_08bb: Unknown result type (might be due to invalid IL or missing references) //IL_08c0: Unknown result type (might be due to invalid IL or missing references) try { int num = <>1__state; SteamNetworkScriptMod steamNetworkScriptMod = <>4__this; Enumerator<string, bool> enumerator; switch (num) { default: return false; case 0: <>1__state = -1; steamNetworkScriptMod.<mod>P.Logger.Information("[calico.SteamNetworkScript] Patching " + path); <patchFlags>5__2 = new Dictionary<string, bool> { ["globals"] = false, ["ready"] = false, ["process"] = false, ["handle_packet"] = false, ["after_steam_read"] = false, ["send_packet"] = false, ["packet_flush_lock"] = false, ["packet_flush_unlock"] = false }; <>7__wrap2 = tokens.GetEnumerator(); <>1__state = -3; goto IL_088d; case 1: <>1__state = -3; <>7__wrap4 = Globals.GetEnumerator(); <>1__state = -4; goto IL_01af; case 2: <>1__state = -4; goto IL_01af; case 3: <>1__state = -3; <>7__wrap4 = OnReady.GetEnumerator(); <>1__state = -5; goto IL_0271; case 4: <>1__state = -5; goto IL_0271; case 5: <>1__state = -3; <>7__wrap4 = OnProcess.GetEnumerator(); <>1__state = -6; goto IL_0333; case 6: <>1__state = -6; goto IL_0333; case 7: <>1__state = -3; <>7__wrap4 = NetworkThreadFunctionSignatureTokens.GetEnumerator(); <>1__state = -7; goto IL_03bf; case 8: <>1__state = -7; goto IL_03bf; case 9: <>1__state = -3; <>7__wrap4 = OnHandlePacket.GetEnumerator(); <>1__state = -8; goto IL_0483; case 10: <>1__state = -8; goto IL_0483; case 11: <>1__state = -3; <>7__wrap4 = PacketHandlerFunction.GetEnumerator(); <>1__state = -9; goto IL_0511; case 12: <>1__state = -9; goto IL_0511; case 13: <>1__state = -3; <>7__wrap4 = AfterStea