Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of SerenaFlats TheLongReturn v0.1.1
DesertExpansion.dll
Decompiled 2 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Map; using Il2CppSystem; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(MainMod), "Desert Expansion", "0.1.1", "FannsoNetti", null)] [assembly: MelonGame(null, null)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("DesertExpansion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DesertExpansion")] [assembly: AssemblyTitle("DesertExpansion")] [assembly: AssemblyVersion("1.0.0.0")] public static class DesertModule { [CompilerGenerated] private sealed class <DelayedStart>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedStart>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(7f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = LoadDesertAsync(); <>1__state = 2; return true; case 2: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DelayedUICheck>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private GameObject <hud>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedUICheck>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <hud>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; <hud>5__1 = GameObject.Find("HUD_Canvas"); if ((Object)(object)<hud>5__1 != (Object)null) { <hud>5__1.SetActive(true); } else { MelonLogger.Warning("[Desert/UI] HUD_Canvas not found."); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadDesertAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private AsyncOperation <loadOp>5__1; private Scene <active>5__2; private GameObject <dmap>5__3; private Scene <chosenDonor>5__4; private float <t>5__5; private AsyncOperation <unload>5__6; private int <i>5__7; private Scene <s>5__8; private IEnumerator<GameObject> <>s__9; private GameObject <go>5__10; private Exception <ex>5__11; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadDesertAsync>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <loadOp>5__1 = null; <dmap>5__3 = null; <unload>5__6 = null; <>s__9 = null; <go>5__10 = null; <ex>5__11 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (desertLoaded) { return false; } TryRemoveBlockingMMapComponents("[Desert]"); MelonLogger.Msg("[Desert] Loading 'Tutorial' additively…"); <loadOp>5__1 = SceneManager.LoadSceneAsync("Tutorial", (LoadSceneMode)1); if (<loadOp>5__1 == null) { MelonLogger.Error("[Desert] Failed to load Tutorial (LoadSceneAsync returned null)."); return false; } goto IL_00a6; case 1: <>1__state = -1; goto IL_00a6; case 2: <>1__state = -1; <active>5__2 = SceneManager.GetActiveScene(); <dmap>5__3 = null; <chosenDonor>5__4 = default(Scene); <t>5__5 = 0f; goto IL_0272; case 3: <>1__state = -1; goto IL_0272; case 4: { <>1__state = -1; goto IL_03ea; } IL_0272: while (<t>5__5 < 5f && (Object)(object)<dmap>5__3 == (Object)null) { <i>5__7 = 0; while (<i>5__7 < SceneManager.sceneCount) { <s>5__8 = SceneManager.GetSceneAt(<i>5__7); if (((Scene)(ref <s>5__8)).IsValid() && ((Scene)(ref <s>5__8)).isLoaded && !(<s>5__8 == <active>5__2)) { <>s__9 = ((Il2CppArrayBase<GameObject>)(object)((Scene)(ref <s>5__8)).GetRootGameObjects()).GetEnumerator(); try { while (<>s__9.MoveNext()) { <go>5__10 = <>s__9.Current; if ((Object)(object)<go>5__10 != (Object)null && NameIsMap(((Object)<go>5__10).name)) { <chosenDonor>5__4 = <s>5__8; <dmap>5__3 = <go>5__10; break; } <go>5__10 = null; } } finally { if (<>s__9 != null) { <>s__9.Dispose(); } } <>s__9 = null; if ((Object)(object)<dmap>5__3 != (Object)null) { break; } } <i>5__7++; } if ((Object)(object)<dmap>5__3 == (Object)null) { <t>5__5 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 3; return true; } } if ((Object)(object)<dmap>5__3 == (Object)null) { MelonLogger.Error("[Desert] Could not find a donor scene with a ROOT named 'Map'."); return false; } MelonLogger.Msg($"[Desert] Using donor scene '{((Scene)(ref <chosenDonor>5__4)).name}'; found root '{((Object)<dmap>5__3).name}'."); TryRemoveBlockingComponentsOnRoot(<dmap>5__3, "[Desert/donor]"); ((Object)<dmap>5__3).name = "DesertMap"; try { SceneManager.MoveGameObjectToScene(<dmap>5__3, <active>5__2); } catch (Exception ex) { <ex>5__11 = ex; MelonLogger.Error("[Desert] MoveGameObjectToScene failed: " + <ex>5__11); return false; } <dmap>5__3.SetActive(false); DesertRoot = <dmap>5__3; desertLoaded = true; MelonLogger.Msg("[Desert] DesertMap moved to active scene and disabled."); <unload>5__6 = SceneManager.UnloadSceneAsync(<chosenDonor>5__4); if (<unload>5__6 == null) { break; } goto IL_03ea; IL_00a6: if (!<loadOp>5__1.isDone) { <>2__current = null; <>1__state = 1; return true; } <>2__current = null; <>1__state = 2; return true; IL_03ea: if (!<unload>5__6.isDone) { <>2__current = null; <>1__state = 4; return true; } MelonLogger.Msg("[Desert] Donor scene unloaded."); break; } TryAddAndConfigureMapPositionUtility("[Desert]"); MelonCoroutines.Start(DelayedUICheck()); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool desertLoaded; public static GameObject DesertRoot; private const string TargetSceneName = "Main"; private const string DonorSceneName = "Tutorial"; private const float delayBeforeLoad = 7f; private const float donorFindWindow = 5f; private const float uiCheckDelay = 3f; public static void Initialize() { MelonLogger.Msg("[Desert] Module initialized."); } public static void OnSceneLoaded(string sceneName) { if (!desertLoaded && string.Equals(sceneName, "Main", StringComparison.OrdinalIgnoreCase)) { MelonLogger.Msg($"[Desert] Scene '{sceneName}' loaded — waiting {7f} seconds before load…"); MelonCoroutines.Start(DelayedStart()); } } public static void OnUpdate() { } [IteratorStateMachine(typeof(<DelayedStart>d__10))] private static IEnumerator DelayedStart() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedStart>d__10(0); } [IteratorStateMachine(typeof(<LoadDesertAsync>d__11))] private static IEnumerator LoadDesertAsync() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadDesertAsync>d__11(0); } [IteratorStateMachine(typeof(<DelayedUICheck>d__12))] private static IEnumerator DelayedUICheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedUICheck>d__12(0); } private static bool NameIsMap(string n) { return string.Equals((n ?? "").Trim(), "Map", StringComparison.OrdinalIgnoreCase); } private static void TryRemoveBlockingMMapComponents(string tag) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).IsValid()) { return; } GameObject val = null; foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref activeScene)).GetRootGameObjects()) { if ((Object)(object)item != (Object)null && NameIsMap(((Object)item).name)) { val = item; break; } } if ((Object)(object)val == (Object)null) { return; } Il2CppArrayBase<Component> components = val.GetComponents<Component>(); if (components == null || components.Length == 0) { return; } string[] array = new string[4] { "Il2CppScheduleOne.Map.Map", "Il2CppScheduleOne.Map.MapPositionUtility", "ScheduleOne.Map.Map", "ScheduleOne.Map.MapPositionUtility" }; string[] array2 = new string[4] { Norm("Il2CppScheduleOne.Map.Map"), Norm("Il2CppScheduleOne.Map.MapPositionUtility"), Norm("ScheduleOne.Map.Map"), Norm("ScheduleOne.Map.MapPositionUtility") }; List<string> list = new List<string>(components.Length); for (int i = 0; i < components.Length; i++) { Component val2 = components[i]; if (!((Object)(object)val2 == (Object)null)) { Type type = ((object)val2).GetType(); string value = type?.FullName ?? ""; string value2 = type?.Name ?? ""; string value3 = type?.Namespace ?? ""; string value4 = type?.AssemblyQualifiedName ?? ""; string value5 = ((Object)val2).ToString(); list.Add($"[{i}] Full='{value}' Name='{value2}' NS='{value3}' AQ='{value4}' ToString='{value5}'"); } } MelonLogger.Msg(tag + " MMap components detail:\n" + string.Join("\n", list.ToArray())); int num = 0; for (int j = 0; j < components.Length; j++) { Component val3 = components[j]; if ((Object)(object)val3 == (Object)null) { continue; } Type type2 = ((object)val3).GetType(); string text = type2?.FullName ?? ""; string text2 = type2?.Name ?? ""; string text3 = type2?.Namespace ?? ""; string text4 = type2?.AssemblyQualifiedName ?? ""; string text5 = ((Object)val3).ToString(); bool flag = false; for (int k = 0; k < array.Length; k++) { if ((!string.IsNullOrEmpty(text) && text.Contains(array[k])) || (!string.IsNullOrEmpty(text4) && text4.Contains(array[k]))) { flag = true; break; } } bool flag2 = !string.IsNullOrEmpty(text3) && text3.IndexOf("ScheduleOne.Map", StringComparison.OrdinalIgnoreCase) >= 0 && (string.Equals(text2, "Map", StringComparison.Ordinal) || string.Equals(text2, "MapPositionUtility", StringComparison.Ordinal)); bool flag3 = !string.IsNullOrEmpty(text5) && (text5.IndexOf("ScheduleOne.Map.MapPositionUtility", StringComparison.OrdinalIgnoreCase) >= 0 || text5.IndexOf("ScheduleOne.Map.Map", StringComparison.OrdinalIgnoreCase) >= 0); string text6 = Norm(text); string text7 = Norm(text4); string text8 = Norm(text5); bool flag4 = false; for (int l = 0; l < array2.Length; l++) { if ((!string.IsNullOrEmpty(text6) && text6.Contains(array2[l])) || (!string.IsNullOrEmpty(text7) && text7.Contains(array2[l])) || (!string.IsNullOrEmpty(text8) && text8.Contains(array2[l]))) { flag4 = true; break; } } if (flag || flag2 || flag3 || flag4) { Object.Destroy((Object)(object)val3); num++; MelonLogger.Msg(tag + " Removed blocking component: " + ((!string.IsNullOrEmpty(text)) ? text : (string.IsNullOrEmpty(text2) ? text5 : text2))); } } if (num == 0) { MelonLogger.Msg(tag + " Blocking components not removed (no match after expanded checks)."); return; } MelonLogger.Msg($"{tag} Removed {num} blocking component(s) from MMap."); static string Norm(string s) { if (string.IsNullOrEmpty(s)) { return ""; } StringBuilder stringBuilder = new StringBuilder(s.Length); foreach (char c in s) { if (char.IsLetter(c)) { stringBuilder.Append(char.ToLowerInvariant(c)); } } return stringBuilder.ToString(); } } private static void TryAddAndConfigureMapPositionUtility(string tag) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).IsValid()) { MelonLogger.Warning(tag + " Active scene invalid; skipping MapPositionUtility setup."); return; } GameObject val = null; foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref activeScene)).GetRootGameObjects()) { if ((Object)(object)item != (Object)null && NameIsMap(((Object)item).name)) { val = item; break; } } if ((Object)(object)val == (Object)null) { MelonLogger.Warning(tag + " Could not find root 'Map' in active scene; MapPositionUtility not added."); return; } Transform val2 = val.transform.Find("Container"); Transform val3 = (Object.op_Implicit((Object)(object)val2) ? val2.Find("EdgePoint") : null); Transform val4 = (Object.op_Implicit((Object)(object)val2) ? val2.Find("OriginPoint") : null); if ((Object)(object)val2 == (Object)null) { MelonLogger.Warning(tag + " 'Map/Container' not found."); } if ((Object)(object)val3 == (Object)null) { MelonLogger.Warning(tag + " 'Map/Container/EdgePoint' not found."); } if ((Object)(object)val4 == (Object)null) { MelonLogger.Warning(tag + " 'Map/Container/OriginPoint' not found."); } MapPositionUtility val5 = null; try { val5 = val.GetComponent<MapPositionUtility>() ?? val.AddComponent<MapPositionUtility>(); } catch (Exception value) { MelonLogger.Error($"{tag} Failed to get/add MapPositionUtility: {value}"); return; } if ((Object)(object)val5 == (Object)null) { MelonLogger.Error(tag + " MapPositionUtility component ended up null."); return; } bool flag = false; Type typeFromHandle = typeof(MapPositionUtility); try { PropertyInfo property = typeFromHandle.GetProperty("conversionFactor", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (setMethod != null) { bool isStatic = setMethod.IsStatic; if (property.PropertyType == typeof(float)) { if (isStatic) { property.SetValue(null, 5.0064f, null); } else { property.SetValue(val5, 5.0064f, null); flag = true; } } else if (property.PropertyType == typeof(double)) { if (isStatic) { property.SetValue(null, 5.0064, null); } else { property.SetValue(val5, 5.0064, null); flag = true; } } } } } catch { } try { FieldInfo field = typeFromHandle.GetField("_conversionFactor_k__BackingField", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { object obj2 = ((field.FieldType == typeof(float)) ? ((object)5.0064f) : ((field.FieldType == typeof(double)) ? ((object)5.0064) : null)); if (obj2 != null) { if (field.IsStatic) { field.SetValue(null, obj2); } else if (!flag) { field.SetValue(val5, obj2); } } } } catch { } try { val5.EdgePoint = val3; } catch { } try { val5.OriginPoint = val4; } catch { } MelonLogger.Msg($"{tag} MapPositionUtility set: factor={5.0064}, EdgePoint={(Object.op_Implicit((Object)(object)val3) ? ((Object)val3).name : "null")}, OriginPoint={(Object.op_Implicit((Object)(object)val4) ? ((Object)val4).name : "null")} "); } private static void TryRemoveBlockingComponentsOnRoot(GameObject root, string tag) { if ((Object)(object)root == (Object)null) { return; } Il2CppArrayBase<Component> components = root.GetComponents<Component>(); if (components == null || components.Length == 0) { return; } string[] array = new string[4] { "Il2CppScheduleOne.Map.Map", "Il2CppScheduleOne.Map.MapPositionUtility", "ScheduleOne.Map.Map", "ScheduleOne.Map.MapPositionUtility" }; string[] array2 = new string[4] { Norm("Il2CppScheduleOne.Map.Map"), Norm("Il2CppScheduleOne.Map.MapPositionUtility"), Norm("ScheduleOne.Map.Map"), Norm("ScheduleOne.Map.MapPositionUtility") }; int num = 0; foreach (Component item in components) { if ((Object)(object)item == (Object)null) { continue; } Type type = ((object)item).GetType(); string text = type?.FullName ?? string.Empty; string text2 = type?.Name ?? string.Empty; string text3 = type?.Namespace ?? string.Empty; string text4 = type?.AssemblyQualifiedName ?? string.Empty; string text5 = ((Object)item).ToString(); bool flag = false; for (int i = 0; i < array.Length; i++) { if ((!string.IsNullOrEmpty(text) && text.Contains(array[i])) || (!string.IsNullOrEmpty(text4) && text4.Contains(array[i]))) { flag = true; break; } } bool flag2 = !string.IsNullOrEmpty(text3) && text3.IndexOf("ScheduleOne.Map", StringComparison.OrdinalIgnoreCase) >= 0 && (string.Equals(text2, "Map", StringComparison.Ordinal) || string.Equals(text2, "MapPositionUtility", StringComparison.Ordinal)); string text6 = Norm(text); string text7 = Norm(text4); string text8 = Norm(text5); bool flag3 = false; for (int j = 0; j < array2.Length; j++) { if ((!string.IsNullOrEmpty(text6) && text6.Contains(array2[j])) || (!string.IsNullOrEmpty(text7) && text7.Contains(array2[j])) || (!string.IsNullOrEmpty(text8) && text8.Contains(array2[j]))) { flag3 = true; break; } } if (flag || flag2 || flag3) { Object.Destroy((Object)(object)item); num++; MelonLogger.Msg(tag + " Removed blocker from '" + ((Object)root).name + "': " + ((!string.IsNullOrEmpty(text)) ? text : (string.IsNullOrEmpty(text2) ? text5 : text2))); } } if (num == 0) { MelonLogger.Msg(tag + " No blockers removed on '" + ((Object)root).name + "'."); return; } MelonLogger.Msg($"{tag} Removed {num} blocker component(s) from '{((Object)root).name}'."); static string Norm(string s) { if (string.IsNullOrEmpty(s)) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(s.Length); foreach (char c in s) { if (char.IsLetter(c)) { stringBuilder.Append(char.ToLowerInvariant(c)); } } return stringBuilder.ToString(); } } } public class MainMod : MelonMod { public override void OnApplicationStart() { DesertModule.Initialize(); OverpassModule.Initialize(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { DesertModule.OnSceneLoaded(sceneName); OverpassModule.OnSceneLoaded(sceneName); } public override void OnUpdate() { OverpassModule.OnUpdate(); } } public static class OverpassModule { [CompilerGenerated] private sealed class <RunAfterDelay>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; private GameObject <root>5__1; private GameObject <overpassRoot>5__2; private GameObject <rampRefParent>5__3; private GameObject <topRefParent>5__4; private int <removed>5__5; private IEnumerator<Collider> <>s__6; private Collider <col>5__7; private string[] <>s__8; private int <>s__9; private string <path>5__10; private GameObject <obj>5__11; private Vector3 <wPos_Desert>5__12; private Vector3 <wEuler_Desert>5__13; private Vector3 <wScale_Desert>5__14; private GameObject <desertTrigger>5__15; private TeleportOnTrigger <tpDesert>5__16; private Vector3 <wPos_City>5__17; private Vector3 <wEuler_City>5__18; private Vector3 <wScale_City>5__19; private GameObject <cityTrigger>5__20; private TeleportOnTrigger <tpCity>5__21; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RunAfterDelay>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <root>5__1 = null; <overpassRoot>5__2 = null; <rampRefParent>5__3 = null; <topRefParent>5__4 = null; <>s__6 = null; <col>5__7 = null; <>s__8 = null; <path>5__10 = null; <obj>5__11 = null; <desertTrigger>5__15 = null; <tpDesert>5__16 = null; <cityTrigger>5__20 = null; <tpCity>5__21 = null; <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //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_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; <root>5__1 = EnsureRootIdentity(); <overpassRoot>5__2 = FindByFullPathIncludingInactive("Map/Container/Overpass"); if (Object.op_Implicit((Object)(object)<overpassRoot>5__2)) { <removed>5__5 = 0; <>s__6 = <overpassRoot>5__2.GetComponentsInChildren<Collider>(true).GetEnumerator(); try { while (<>s__6.MoveNext()) { <col>5__7 = <>s__6.Current; Object.Destroy((Object)(object)<col>5__7); <removed>5__5++; <col>5__7 = null; } } finally { if (<>s__6 != null) { <>s__6.Dispose(); } } <>s__6 = null; MelonLogger.Msg("[Overpass] Removed " + <removed>5__5 + " original colliders."); } <>s__8 = RoadblockerTargets; for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++) { <path>5__10 = <>s__8[<>s__9]; <obj>5__11 = FindByFullPathIncludingInactive(<path>5__10); if (Object.op_Implicit((Object)(object)<obj>5__11)) { <obj>5__11.SetActive(false); } <obj>5__11 = null; <path>5__10 = null; } <>s__8 = null; <rampRefParent>5__3 = FindByFullPathIncludingInactive("Map/Container/Overpass/Overpass Ramp/overpass_ramp"); <topRefParent>5__4 = FindByFullPathIncludingInactive("Map/Container/Overpass"); if (Object.op_Implicit((Object)(object)<rampRefParent>5__3)) { SpawnCubeRelative(<root>5__1, <rampRefParent>5__3, "RC1", new Vector3(-26.3323f, -6.1683f, 15.29f), new Vector3(0f, 0f, 20f), new Vector3(32f, 1.5f, 10f), NextColor(), solid: true); SpawnCubeRelative(<root>5__1, <rampRefParent>5__3, "RC2", new Vector3(-39.4656f, -10.4992f, 15.2913f), new Vector3(0f, 0f, 10f), new Vector3(5f, 1.5f, 10f), NextColor(), solid: true); } if (Object.op_Implicit((Object)(object)<topRefParent>5__4)) { <wPos_Desert>5__12 = new Vector3(-3.2099f, 10.5127f, -69.7335f); <wEuler_Desert>5__13 = new Vector3(0f, 90f, 0f); <wScale_Desert>5__14 = new Vector3(-0.1346f, 5.8455f, 10f); <desertTrigger>5__15 = SpawnUsingWorldNumbers(<root>5__1, <topRefParent>5__4, "OverpassDesertTrigger", <wPos_Desert>5__12, <wEuler_Desert>5__13, <wScale_Desert>5__14, NextColor(), solid: false); MakeSelfTeleportTrigger(<desertTrigger>5__15, new Vector3(-222.5477f, 41.9424f, -135.315f), (Vector3?)new Vector3(0f, 76.27f, 0f)); <tpDesert>5__16 = <desertTrigger>5__15.GetComponent<TeleportOnTrigger>(); <tpDesert>5__16.ActivateRootName = "DesertMap"; <tpDesert>5__16.DeactivateRootName = "Map"; <wPos_City>5__17 = new Vector3(-234.9709f, 42.1989f, -135.7764f); <wEuler_City>5__18 = new Vector3(0f, 167f, 0f); <wScale_City>5__19 = new Vector3(4.829f, 5.8455f, 10f); <cityTrigger>5__20 = SpawnUsingWorldNumbers(<root>5__1, <topRefParent>5__4, "OverpassCityTrigger", <wPos_City>5__17, <wEuler_City>5__18, <wScale_City>5__19, NextColor(), solid: false); MakeSelfTeleportTrigger(<cityTrigger>5__20, new Vector3(-3.5674f, 4.6717f, -57.3221f), (Vector3?)new Vector3(-0f, 1.5f, 0f)); <tpCity>5__21 = <cityTrigger>5__20.GetComponent<TeleportOnTrigger>(); <tpCity>5__21.ActivateRootName = "Map"; <tpCity>5__21.DeactivateRootName = "DesertMap"; <desertTrigger>5__15 = null; <tpDesert>5__16 = null; <cityTrigger>5__20 = null; <tpCity>5__21 = null; } MelonLogger.Msg($"[Overpass] Built RC1/RC2 and triggers. Debug rendering = {debugEnabled?.Value}"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string RootName = "OverpassColliders"; private static int _spawnCounter = 0; private static MelonPreferences_Category overpassCategory; private static MelonPreferences_Entry<bool> debugEnabled; private const string OverpassRootPath = "Map/Container/Overpass"; private const string OverpassRampParentForCollider = "Map/Container/Overpass/Overpass Ramp/overpass_ramp"; private static readonly string[] RoadblockerTargets = new string[4] { "Map/Container/Overpass/Overpass Ramp/RoadBlocker4_LOD (1)", "Map/Container/Overpass/Overpass Ramp/RoadBlocker4_LOD (2)", "Map/Container/Overpass/Overpass Ramp/RoadBlocker4_LOD (3)", "Map/Container/Overpass/Overpass Ramp/RoadBlocker4_LOD (4)" }; private static readonly Color[] BrightPalette = (Color[])(object)new Color[5] { new Color(0.2f, 1f, 0.3f, 1f), new Color(0.2f, 0.4f, 1f, 1f), new Color(1f, 0.2f, 0.2f, 1f), new Color(1f, 0f, 1f, 1f), new Color(0f, 1f, 1f, 1f) }; private static int _colorIndex = 0; private static bool built = false; private static Color NextColor() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Color result = BrightPalette[_colorIndex]; _colorIndex = (_colorIndex + 1) % BrightPalette.Length; return result; } public static void Initialize() { overpassCategory = MelonPreferences.CreateCategory("OverpassModule"); debugEnabled = overpassCategory.CreateEntry<bool>("Debug", false, "Enable debug rendering (show RC/trigger cubes)", (string)null, false, false, (ValueValidator)null, (string)null); ClassInjector.RegisterTypeInIl2Cpp<TeleportOnTrigger>(); MelonLogger.Msg("[Overpass] Module initialized. Debug rendering = " + debugEnabled.Value); } public static void OnSceneLoaded(string sceneName) { if (!(sceneName != "Main") && !built) { built = true; MelonCoroutines.Start(RunAfterDelay(1f)); } } public static void OnUpdate() { if (Input.GetKeyDown((KeyCode)283)) { SpawnTestCube(); } if (Input.GetKeyDown((KeyCode)284)) { TerrainCollider val = Object.FindObjectOfType<TerrainCollider>(); if (Object.op_Implicit((Object)(object)val)) { ((Collider)val).enabled = !((Collider)val).enabled; MelonLogger.Msg($"[Overpass] TerrainCollider enabled = {((Collider)val).enabled}"); } else { MelonLogger.Warning("[Overpass] No TerrainCollider found."); } } if (Input.GetKeyDown((KeyCode)285)) { TerrainCollider val2 = Object.FindObjectOfType<TerrainCollider>(); MelonLogger.Msg($"[Overpass] TerrainCollider present={(Object)(object)val2 != (Object)null}, enabled={((val2 != null) ? new bool?(((Collider)val2).enabled) : null)}"); } } [IteratorStateMachine(typeof(<RunAfterDelay>d__14))] private static IEnumerator RunAfterDelay(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RunAfterDelay>d__14(0) { delay = delay }; } private static GameObject EnsureRootIdentity() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) GameObject val = EnsureRoot(); val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.identity; val.transform.localScale = Vector3.one; return val; } private static GameObject EnsureRoot() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("OverpassColliders"); if ((Object)(object)val != (Object)null) { return val; } val = new GameObject("OverpassColliders"); SceneManager.MoveGameObjectToScene(val, SceneManager.GetActiveScene()); return val; } private static void SpawnTestCube() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) GameObject val = EnsureRootIdentity(); _spawnCounter++; GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val2).name = $"OverpassCollider_{_spawnCounter}"; val2.transform.position = Vector3.zero; val2.transform.rotation = Quaternion.identity; val2.transform.localScale = Vector3.one; val2.transform.SetParent(val.transform, true); ApplyRenderer(val2, NextColor()); BoxCollider val3 = val2.GetComponent<BoxCollider>() ?? val2.AddComponent<BoxCollider>(); ((Collider)val3).isTrigger = false; MelonLogger.Msg($"[Overpass] Spawned {((Object)val2).name} (debug render={debugEnabled != null && debugEnabled.Value})."); } private static GameObject SpawnCubeRelative(GameObject root, GameObject refParent, string name, Vector3 localPos, Vector3 localEuler, Vector3 localScale, Color color, bool solid) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = name; ApplyRelativeWorldTRS(val.transform, refParent.transform, localPos, localEuler, localScale); val.transform.SetParent(root.transform, true); ApplyRenderer(val, color); BoxCollider val2 = val.GetComponent<BoxCollider>() ?? val.AddComponent<BoxCollider>(); ((Collider)val2).isTrigger = !solid; return val; } private static GameObject SpawnUsingWorldNumbers(GameObject genRoot, GameObject referenceParent, string name, Vector3 worldPos, Vector3 worldEuler, Vector3 worldScale, Color color, bool solid) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) WorldToLocalTRS(referenceParent.transform, worldPos, worldEuler, worldScale, out var localPos, out var localEuler, out var localScale); return SpawnCubeRelative(genRoot, referenceParent, name, localPos, localEuler, localScale, color, solid); } private static void ApplyRenderer(GameObject go, Color color) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) Renderer component = go.GetComponent<Renderer>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if (debugEnabled != null && debugEnabled.Value) { Shader val = Shader.Find("Unlit/Color"); if ((Object)(object)val != (Object)null) { component.material = new Material(val); component.material.SetColor("_Color", color); } else { component.material.color = color; } component.shadowCastingMode = (ShadowCastingMode)0; component.receiveShadows = false; component.enabled = true; } else { component.enabled = false; } } private static void ApplyRelativeWorldTRS(Transform target, Transform reference, Vector3 localPos, Vector3 localEuler, Vector3 localScale) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)reference)) { target.localPosition = localPos; target.localRotation = Quaternion.Euler(localEuler); target.localScale = localScale; } else { target.position = reference.TransformPoint(localPos); target.rotation = reference.rotation * Quaternion.Euler(localEuler); Vector3 lossyScale = reference.lossyScale; target.localScale = new Vector3(lossyScale.x * localScale.x, lossyScale.y * localScale.y, lossyScale.z * localScale.z); } } private static float SafeDiv(float a, float b) { return Mathf.Approximately(b, 0f) ? 0f : (a / b); } private static void WorldToLocalTRS(Transform reference, Vector3 worldPos, Vector3 worldEuler, Vector3 worldScale, out Vector3 localPos, out Vector3 localEuler, out Vector3 localScale) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) localPos = (Object.op_Implicit((Object)(object)reference) ? reference.InverseTransformPoint(worldPos) : worldPos); Quaternion val = Quaternion.Euler(worldEuler); Quaternion val2 = (Object.op_Implicit((Object)(object)reference) ? (Quaternion.Inverse(reference.rotation) * val) : val); localEuler = ((Quaternion)(ref val2)).eulerAngles; Vector3 val3 = (Object.op_Implicit((Object)(object)reference) ? reference.lossyScale : Vector3.one); localScale = new Vector3(SafeDiv(worldScale.x, val3.x), SafeDiv(worldScale.y, val3.y), SafeDiv(worldScale.z, val3.z)); } private static void MakeSelfTeleportTrigger(GameObject go, Vector3 targetPos, Vector3? targetEuler = null) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)go)) { BoxCollider val = go.GetComponent<BoxCollider>() ?? go.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; Rigidbody val2 = go.GetComponent<Rigidbody>() ?? go.AddComponent<Rigidbody>(); val2.isKinematic = true; val2.useGravity = false; TeleportOnTrigger teleportOnTrigger = go.GetComponent<TeleportOnTrigger>() ?? go.AddComponent<TeleportOnTrigger>(); teleportOnTrigger.TargetPosition = targetPos; teleportOnTrigger.HasRotation = targetEuler.HasValue; teleportOnTrigger.TargetRotation = (targetEuler.HasValue ? Quaternion.Euler(targetEuler.Value) : Quaternion.identity); } } private static GameObject FindByFullPathIncludingInactive(string fullPath) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(fullPath)) { return null; } string[] array = fullPath.Split('/'); for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (!((Scene)(ref sceneAt)).isLoaded) { continue; } foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref sceneAt)).GetRootGameObjects()) { if (((Object)item).name != array[0]) { continue; } Transform val = item.transform; for (int j = 1; j < array.Length; j++) { if (!((Object)(object)val != (Object)null)) { break; } val = val.Find(array[j]); } if (!((Object)(object)val != (Object)null)) { continue; } return ((Component)val).gameObject; } } return null; } } [RegisterTypeInIl2Cpp] public class TeleportOnTrigger : MonoBehaviour { public Vector3 TargetPosition = Vector3.zero; public Quaternion TargetRotation = Quaternion.identity; public bool HasRotation = false; public string ActivateRootName = null; public string DeactivateRootName = null; public TeleportOnTrigger(IntPtr ptr) : base(ptr) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) public TeleportOnTrigger() : base(ClassInjector.DerivedConstructorPointer<TeleportOnTrigger>()) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } private static GameObject FindRootByNameAllScenes(string name) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(name)) { return null; } int sceneCount = SceneManager.sceneCount; for (int i = 0; i < sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (!((Scene)(ref sceneAt)).isLoaded) { continue; } Il2CppReferenceArray<GameObject> rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects(); for (int j = 0; j < ((Il2CppArrayBase<GameObject>)(object)rootGameObjects).Length; j++) { GameObject val = ((Il2CppArrayBase<GameObject>)(object)rootGameObjects)[j]; if ((Object)(object)val != (Object)null && ((Object)val).name == name) { return val; } } } return null; } private void OnTriggerEnter(Collider other) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) try { Transform val = ((Component)other).transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } if ((Object)(object)val != (Object)null && ((Object)val).name == "DesertMap") { return; } Rigidbody component = ((Component)val).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.position = TargetPosition; if (HasRotation) { component.rotation = TargetRotation; } component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } else { val.position = TargetPosition; if (HasRotation) { val.rotation = TargetRotation; } } if (!string.IsNullOrEmpty(ActivateRootName)) { GameObject val2 = FindRootByNameAllScenes(ActivateRootName); if ((Object)(object)val2 != (Object)null) { val2.SetActive(true); } } if (!string.IsNullOrEmpty(DeactivateRootName)) { GameObject val3 = FindRootByNameAllScenes(DeactivateRootName); if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); } } } catch (Exception ex) { MelonLogger.Error("[Teleport] Error: " + ex); } } }