using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using Atlas.Loaders; using Atlas.MappingComponents; using Atlas.MappingComponents.Sandbox; using Atlas.MappingComponents.TakeAndHold; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using On.FistVR; using Sodalite.Api; using Sodalite.Utilities; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using Valve.Newtonsoft.Json; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("Atlas")] [assembly: AssemblyConfiguration("Runtime")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a55d304310eb38b449eab3c2a6aa71a7b61c7498")] [assembly: AssemblyProduct("Atlas")] [assembly: AssemblyTitle("Atlas")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [DebuggerNonUserCode] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] [DebuggerNonUserCode] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [DebuggerNonUserCode] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [DebuggerNonUserCode] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [DebuggerNonUserCode] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [DebuggerNonUserCode] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] [DebuggerNonUserCode] internal sealed class NotNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [DebuggerNonUserCode] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [DebuggerNonUserCode] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace Atlas { public static class AtlasConstants { public const string Name = "Atlas"; public const string Guid = "nrgill28.Atlas"; public const string Version = "1.0.4"; internal const string LoaderSandbox = "sandbox"; internal const string LoaderTakeAndHold = "takeandhold"; } [BepInPlugin("nrgill28.Atlas", "Atlas", "1.0.4")] [BepInDependency("nrgill28.Sodalite", "1.3.0")] [BepInProcess("h3vr.exe")] public class AtlasPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__FVRSceneSettingsOnAwake; public static hook_Start <1>__TNH_ManagerOnStart; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__4_2; public static Func <>9__4_3; public static Func <>9__4_4; public static Func <>9__4_5; public static Func <>9__4_6; public static hook_CheckPlayerEnvironment <>9__18_0; public static hook_Update <>9__18_1; public static Func <>9__25_0; internal bool b__4_2(Vector3 x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return x.z < -7f; } internal float b__4_3(Vector3 x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return 0f - x.z; } internal float b__4_4(Vector3 x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Mathf.Abs(x.y - 4.15f); } internal bool b__4_5(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return p.x > 0f; } internal bool b__4_6(CustomSceneInfo x) { return x.DisplayMode == "sandbox"; } internal void b__18_0(orig_CheckPlayerEnvironment orig, FVRReverbSystem self) { if (Object.op_Implicit((Object)(object)GM.CurrentPlayerBody)) { orig.Invoke(self); } } internal void b__18_1(orig_Update orig, FVRAmbienceController self) { if (Object.op_Implicit((Object)(object)GM.CurrentPlayerBody)) { orig.Invoke(self); } } internal bool b__25_0(CustomSceneInfo s) { return s.DisplayMode == "takeandhold"; } } internal static ManualLogSource Logger = null; internal static AtlasPlugin Instance = null; internal static CustomSceneInfo? LastLoadedScene; private static readonly List RegisteredScenes = new List(); public static readonly IDictionary Loaders = new Dictionary(); private static Hook DetourTnhUiManager_LoadLevel = null; private static Hook DetourTnhUiManager_SelectLevel = null; private static Hook DetourSceneLoader_LoadMG = null; public static CustomSceneInfo? CurrentScene { get; internal set; } public static ICollection CustomSceneInfos => RegisteredScenes.AsReadOnly(); public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; ApplyHooks(); Loaders["sandbox"] = new SandboxLoader(); Loaders["takeandhold"] = new TakeAndHoldLoader(); SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode _) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(SceneManagerOnSceneLoaded(scene)); }; } private IEnumerator SceneManagerOnSceneLoaded(Scene scene) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (((Scene)(ref scene)).name != "MainMenu3") { yield break; } GameObject sceneScreenBase = GameObject.Find("SceneScreen_GDC"); GameObject labelBase = GameObject.Find("Label_Description_1_Title (5)"); List screenPositions = new List(); for (int ii = 0; ii < 360; ii += 13) { for (int jj = 0; jj < 4; jj++) { screenPositions.Add(new Vector3(CircleX(ii), 0.5f + (float)(jj * 2), CircleZ(ii))); } } screenPositions = (from x in screenPositions where x.z < -7f orderby 0f - x.z descending, Mathf.Abs(x.y - 4.15f) select x).ToList(); screenPositions = screenPositions.Where((Vector3 p) => p.x > 0f).ToList(); GameObject moddedScenesLabel = Object.Instantiate(labelBase, labelBase.transform.parent); moddedScenesLabel.transform.position = new Vector3(4f, 8.3f, -15.5f); moddedScenesLabel.transform.localEulerAngles = new Vector3(-180f, -30f, 180f); moddedScenesLabel.GetComponent().text = "Atlas Sandbox Scenes"; CustomSceneInfo[] sandboxScenes = RegisteredScenes.Where((CustomSceneInfo x) => x.DisplayMode == "sandbox").ToArray(); int mainTex = Shader.PropertyToID("_MainTex"); for (int i = 0; i < sandboxScenes.Length; i++) { MainMenuScenePointable screen = Object.Instantiate(sceneScreenBase, sceneScreenBase.transform.parent).GetComponent(); ((Component)screen).transform.position = screenPositions[i]; ((Component)screen).transform.localEulerAngles = new Vector3(0f, 180f - 57.29578f * Mathf.Atan((0f - ((Component)screen).transform.position.x) / ((Component)screen).transform.position.z), 0f); ((Component)screen).transform.localScale = 0.5f * ((Component)screen).transform.localScale; MainMenuScenePointable screenComponent = ((Component)screen).GetComponent(); screenComponent.m_startScale = ((Component)screen).transform.localScale; CustomSceneInfo sceneInfo = sandboxScenes[i]; CustomMainMenuSceneDef def = ScriptableObject.CreateInstance(); ((MainMenuSceneDef)def).Name = sceneInfo.DisplayName; ((MainMenuSceneDef)def).Type = sceneInfo.Author; ((MainMenuSceneDef)def).Desciption = sceneInfo.Description; ((MainMenuSceneDef)def).Image = sceneInfo.ThumbnailSprite; def.CustomSceneInfo = sceneInfo; screen.Def = (MainMenuSceneDef)(object)def; ((Renderer)((Component)screen).GetComponent()).material.SetTexture(mainTex, (Texture)(object)sceneInfo.ThumbnailTexture); } static float CircleX(float x) { return 14.13f * Mathf.Cos((float)Math.PI / 180f * x) - 0.39f; } static float CircleZ(float z) { return 14.13f * Mathf.Sin((float)Math.PI / 180f * z) - 2.98f; } } public static void RegisterScene(string sceneBundleFilePath) { FileInfo fileInfo = new FileInfo(sceneBundleFilePath); Logger.LogDebug((object)("Attempting to load scene from bundle at: " + sceneBundleFilePath)); if (!fileInfo.Exists) { throw new FileNotFoundException("Path points to non-existing file!"); } CustomSceneInfo customSceneInfo = new CustomSceneInfo(fileInfo); RegisteredScenes.Add(customSceneInfo); Logger.LogInfo((object)("Registered " + customSceneInfo.DisplayName + " by " + customSceneInfo.Author + ".")); } public static CustomSceneInfo? GetCustomScene(string identifier) { return RegisteredScenes.FirstOrDefault((CustomSceneInfo x) => x.Identifier == identifier); } public static void LoadCustomScene(CustomSceneInfo sceneInfo) { ((MonoBehaviour)Instance).StartCoroutine(LoadCustomScene_Internal(sceneInfo)); } public static void LoadCustomScene(string identifier) { CustomSceneInfo customScene = GetCustomScene(identifier); if (customScene != null) { LoadCustomScene(customScene); } } private static IEnumerator LoadCustomScene_Internal(CustomSceneInfo sceneInfo) { if (!Object.op_Implicit((Object)(object)sceneInfo.SceneBundle)) { AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(sceneInfo.SceneBundleFile.FullName); yield return request; sceneInfo.SceneBundle = request.assetBundle; } LastLoadedScene = sceneInfo; string sceneName = sceneInfo.SceneBundle.GetAllScenePaths()[0]; SteamVR_LoadLevel.Begin(sceneName, false, 0.5f, 0f, 0f, 0f, 1f); } private void ApplyHooks() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //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_003d: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown object obj = <>O.<0>__FVRSceneSettingsOnAwake; if (obj == null) { hook_Awake val = FVRSceneSettingsOnAwake; <>O.<0>__FVRSceneSettingsOnAwake = val; obj = (object)val; } FVRSceneSettings.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__TNH_ManagerOnStart; if (obj2 == null) { hook_Start val2 = TNH_ManagerOnStart; <>O.<1>__TNH_ManagerOnStart = val2; obj2 = (object)val2; } TNH_Manager.Start += (hook_Start)obj2; MainMenuScreen.LoadScene += new hook_LoadScene(MainMenuScreenOnLoadScene); TNH_UIManager.Start += new hook_Start(TNH_UIManagerOnStart); object obj3 = <>c.<>9__18_0; if (obj3 == null) { hook_CheckPlayerEnvironment val3 = delegate(orig_CheckPlayerEnvironment orig, FVRReverbSystem self) { if (Object.op_Implicit((Object)(object)GM.CurrentPlayerBody)) { orig.Invoke(self); } }; <>c.<>9__18_0 = val3; obj3 = (object)val3; } FVRReverbSystem.CheckPlayerEnvironment += (hook_CheckPlayerEnvironment)obj3; object obj4 = <>c.<>9__18_1; if (obj4 == null) { hook_Update val4 = delegate(orig_Update orig, FVRAmbienceController self) { if (Object.op_Implicit((Object)(object)GM.CurrentPlayerBody)) { orig.Invoke(self); } }; <>c.<>9__18_1 = val4; obj4 = (object)val4; } FVRAmbienceController.Update += (hook_Update)obj4; if (GameAPI.BuildId >= 20345029) { MethodInfo methodInfo = AccessTools.Method(typeof(TNH_UIManager), "LoadCurrentlySelectedLevel", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(AtlasPlugin), "TNH_UIManagerOnLoadCurrentlySelectedLevel", (Type[])null, (Type[])null); DetourTnhUiManager_LoadLevel = new Hook((MethodBase)methodInfo, methodInfo2); } else { MethodInfo methodInfo3 = AccessTools.Method(typeof(SceneLoader), "LoadMG", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(AtlasPlugin), "SceneLoader_LoadMG", (Type[])null, (Type[])null); DetourSceneLoader_LoadMG = new Hook((MethodBase)methodInfo3, methodInfo4); } if (GameAPI.BuildId >= 23832685) { MethodInfo methodInfo5 = AccessTools.Method(typeof(TNH_UIManager), "UpdateLevelSelectUi", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(AtlasPlugin), "TNH_UIManagerOnUpdateLevelSelectUi", (Type[])null, (Type[])null); DetourTnhUiManager_SelectLevel = new Hook((MethodBase)methodInfo5, methodInfo6); } else { MethodInfo methodInfo7 = AccessTools.Method(typeof(TNH_UIManager), "UpdateLevelSelectDisplayAndLoader", (Type[])null, (Type[])null); MethodInfo methodInfo8 = AccessTools.Method(typeof(AtlasPlugin), "TNH_UIManagerOnUpdateLevelSelectDisplayAndLoader", (Type[])null, (Type[])null); DetourTnhUiManager_SelectLevel = new Hook((MethodBase)methodInfo7, methodInfo8); } } private static void FVRSceneSettingsOnAwake(orig_Awake orig, FVRSceneSettings self) { SceneSettingsOverride sceneSettingsOverride = Object.FindObjectOfType(); if (Object.op_Implicit((Object)(object)sceneSettingsOverride)) { sceneSettingsOverride.ApplyOverrides(self); ManagerSingleton.Instance.InitScene(); } else { CurrentScene = null; } orig.Invoke(self); } private static void TNH_ManagerOnStart(orig_Start orig, TNH_Manager self) { if (CurrentScene != null) { TNH_ManagerOverride tNH_ManagerOverride = Object.FindObjectOfType(); if (Object.op_Implicit((Object)(object)tNH_ManagerOverride)) { tNH_ManagerOverride.ApplyOverrides(self); } else { Logger.LogError((object)"TNH_Manager overrides were missing, you need one in your scene!"); } } orig.Invoke(self); } private void MainMenuScreenOnLoadScene(orig_LoadScene orig, MainMenuScreen self) { if (self.m_def is CustomMainMenuSceneDef customMainMenuSceneDef) { ((MonoBehaviour)this).StartCoroutine(LoadBundleThenScene(customMainMenuSceneDef.CustomSceneInfo)); } else { orig.Invoke(self); } IEnumerator LoadBundleThenScene(CustomSceneInfo sceneInfo) { if (!Object.op_Implicit((Object)(object)sceneInfo.SceneBundle)) { AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(sceneInfo.SceneBundleFile.FullName); while (((AsyncOperation)request).progress < 0.9f) { self.LoadSceneButton.GetComponentInChildren().text = $"Loading {((AsyncOperation)request).progress * 1.11f:P1}"; yield return null; } sceneInfo.SceneBundle = request.assetBundle; } self.m_def.SceneName = sceneInfo.SceneBundle.GetAllScenePaths()[0]; LastLoadedScene = sceneInfo; orig.Invoke(self); } } private void TNH_UIManagerOnStart(orig_Start orig, TNH_UIManager self) { foreach (CustomSceneInfo item in RegisteredScenes.Where((CustomSceneInfo s) => s.DisplayMode == "takeandhold")) { self.Levels.Add((LevelData)(object)new CustomLevelData(item)); } orig.Invoke(self); } private static void TNH_UIManagerOnUpdateLevelSelectUi(Action orig, TNH_UIManager self) { if (self.CurrentLevel is CustomLevelData customLevelData) { LastLoadedScene = customLevelData.SceneInfo; } else { LastLoadedScene = null; } orig(self); } private static void TNH_UIManagerOnUpdateLevelSelectDisplayAndLoader(Action orig, TNH_UIManager self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(TNH_UIManager), "GetLevelData", (Type[])null, (Type[])null); FieldInfo fieldInfo = AccessTools.Field(typeof(TNH_UIManager), "CurLevelID"); LevelData val = (LevelData)methodInfo.Invoke(self, new object[1] { fieldInfo.GetValue(self) }); if (val is CustomLevelData customLevelData) { LastLoadedScene = customLevelData.SceneInfo; } else { LastLoadedScene = null; } orig(self); } private static void TNH_UIManagerOnLoadCurrentlySelectedLevel(Action orig, TNH_UIManager self) { if (LastLoadedScene == null) { orig(self); return; } ((MonoBehaviour)Instance).StartCoroutine(LoadBundleThen(LastLoadedScene, delegate { self.CurrentLevel.LevelSceneName = LastLoadedScene.SceneBundle.GetAllScenePaths()[0]; orig(self); })); } private static void SceneLoader_LoadMG(Action orig, SceneLoader self) { //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) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "TakeAndHold_Lobby_2" || LastLoadedScene == null) { orig(self); return; } ((MonoBehaviour)Instance).StartCoroutine(LoadBundleThen(LastLoadedScene, delegate { self.LevelName = LastLoadedScene.SceneBundle.GetAllScenePaths()[0]; orig(self); })); } private static IEnumerator LoadBundleThen(CustomSceneInfo sceneInfo, Action continueWith) { if (!Object.op_Implicit((Object)(object)sceneInfo.SceneBundle)) { AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(sceneInfo.SceneBundleFile.FullName); yield return request; sceneInfo.SceneBundle = request.assetBundle; } continueWith(); } } [JsonObject(/*Could not decode attribute arguments.*/)] public class CustomSceneInfo { internal AssetBundle? SceneBundle; [JsonProperty] public string DisplayName { get; private set; } = ""; [JsonProperty] public string Identifier { get; private set; } = ""; [JsonProperty] private string Mode { set { DisplayMode = value; } } [JsonProperty] public string GameMode { get; private set; } = ""; [JsonProperty] public string DisplayMode { get; private set; } = ""; [JsonProperty] public string Author { get; private set; } = ""; [JsonProperty] public string Description { get; private set; } = ""; public Texture2D? ThumbnailTexture { get; } public Sprite? ThumbnailSprite { get; } internal FileInfo SceneBundleFile { get; } internal CustomSceneInfo(FileInfo sceneBundle) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) SceneBundleFile = sceneBundle; FileInfo fileInfo = new FileInfo(sceneBundle.FullName + ".json"); FileInfo fileInfo2 = new FileInfo(sceneBundle.FullName + ".png"); if (!fileInfo.Exists) { throw new FileNotFoundException(fileInfo.Name + " is missing! It should be beside the scene bundle file."); } JsonConvert.PopulateObject(File.ReadAllText(fileInfo.FullName), (object)this); if (!fileInfo2.Exists) { AtlasPlugin.Logger.LogWarning((object)("No " + fileInfo2.Name + " was found. This scene will not have a thumbnail.")); return; } ThumbnailTexture = new Texture2D(1, 1); ThumbnailTexture.LoadImage(File.ReadAllBytes(fileInfo2.FullName)); ThumbnailSprite = Sprite.Create(ThumbnailTexture, new Rect(0f, 0f, (float)((Texture)ThumbnailTexture).width, (float)((Texture)ThumbnailTexture).height), new Vector2(0f, 0f)); } } public static class Extensions { public static IEnumerable IterateChildren(this GameObject go) { for (int i = 0; i < go.transform.childCount; i++) { yield return ((Component)go.transform.GetChild(i)).gameObject; } } public static IEnumerable IterateChildren(this Transform go) { for (int i = 0; i < ((Component)go).transform.childCount; i++) { yield return ((Component)go).transform.GetChild(i); } } public static void GenericGizmoCube(Color color, Vector3 center, Vector3 size, Vector3 forward, params Transform[] markers) { //IL_0001: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) Gizmos.color = color; foreach (Transform val in markers) { if (Object.op_Implicit((Object)(object)val)) { Gizmos.matrix = val.localToWorldMatrix; Gizmos.DrawCube(center, size); Gizmos.DrawLine(center, center + forward); } } } public static void GenericGizmoCubeOutline(Color color, Vector3 center, Vector3 size, params Transform[] markers) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = color; foreach (Transform val in markers) { if (Object.op_Implicit((Object)(object)val)) { Gizmos.matrix = val.localToWorldMatrix; Gizmos.DrawWireCube(center, size); } } } public static void GenericGizmoSphere(Color color, Vector3 center, float radius, params Transform[] markers) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) Gizmos.color = color; foreach (Transform val in markers) { if (Object.op_Implicit((Object)(object)val)) { Gizmos.matrix = val.localToWorldMatrix; Gizmos.DrawSphere(center, radius); } } } } internal class CustomMainMenuSceneDef : MainMenuSceneDef { public CustomSceneInfo CustomSceneInfo = null; } internal class CustomLevelData : LevelData { public readonly CustomSceneInfo SceneInfo; public CustomLevelData(CustomSceneInfo info) { base.IsModLevel = true; base.LevelAuthor = info.Author; base.LevelDescription = info.Description; base.LevelDisplayName = info.DisplayName; base.LevelID = info.Identifier; base.LevelImage = info.ThumbnailSprite; SceneInfo = info; } } } namespace Atlas.MappingComponents { public class AtlasPMat : PMat { public enum MatDefEnum { _Air = -366646783, _Impenetrable = 1725752409, Armor_Solid = 1242992293, Armor_Thick = -134865591, Armor_Thin = 1827179403, Claypot = 1943035998, ConcreteBarrier = 1461872896, Floor_CarpetOverConcrete = -1661987665, Floor_CarpetOverWood = -1942452169, Floor_Concrete = 757445278, Floor_Metal = 1483923932, Floor_MetalGrating = -1690371124, Floor_TileOverConcrete = 1213917816, Floor_TileOverConcreteSolid = 434755139, Floor_TileOverWood = 1335110134, Floor_Wood = 1960591488, GasMask = 1752877821, GasMask_heavy = 367776345, Ground_Dirt = -1675716207, Ground_Grass = 1942859388, Ground_Sand = -1487240928, Ground_Water = 383750667, HeavyArmor_Metal = -1347286364, HeavyFabric = 644301452, Hedge = 432136527, LightArmor_Kevlar = -1669265951, Meat = -871205235, MediumArmor_Metal = -635266500, MediumArmor_Padded = 332398969, Melee_Metal = 942411018, Melee_Polymer = 2144447471, Melee_Wood = -1896619314, Metal_Plate = 666790754, Metal_Sheet = -1853667375, Metal_Strut = -321340768, Paper = -1779142660, PlasticTableTop = -1149654923, Rock_Large = 1211416655, Rock_Small = -34193051, RotMeat = 1273826288, Sandbag = 1417815362, Solid_Armor = -529192027, Solid_Concrete = 1454812933, Solid_Metal = -213122109, Testing_MEat = 1985703140, Testing_Soft = 1729971855, Tires = -649847075, Wall_Brick = 892418936, Wall_DryWall = -1898909600, Wall_GlassBrick = -1258062406, Wall_GlassWindow = -1217966965, Wall_SheetMetal = 761218943, Wall_WoodSolid = 1081916419, Wall_WoodThick = -1271050433, Wall_WoodThin = 10600013, Water = -1779147911, WaterMelon = 610581220, WoodProp = -2101361410 } public MatDefEnum AtlasMatDef; private static readonly Dictionary MatDefResources = new Dictionary { { MatDefEnum._Air, "matdefs\\_Air" }, { MatDefEnum._Impenetrable, "matdefs\\structural\\_Impenetrable" }, { MatDefEnum.Armor_Solid, "matdefs\\structural\\Armor_Solid" }, { MatDefEnum.Armor_Thick, "matdefs\\structural\\Armor_Thick" }, { MatDefEnum.Armor_Thin, "matdefs\\structural\\Armor_Thin" }, { MatDefEnum.Claypot, "matdefs\\props\\Claypot" }, { MatDefEnum.ConcreteBarrier, "matdefs\\structural\\ConcreteBarrier" }, { MatDefEnum.Floor_CarpetOverConcrete, "matdefs\\structural\\Floor_CarpetOverConcrete" }, { MatDefEnum.Floor_CarpetOverWood, "matdefs\\structural\\Floor_CarpetOverWood" }, { MatDefEnum.Floor_Concrete, "matdefs\\structural\\Floor_Concrete" }, { MatDefEnum.Floor_Metal, "matdefs\\structural\\Floor_Metal" }, { MatDefEnum.Floor_MetalGrating, "matdefs\\structural\\Floor_MetalGrating" }, { MatDefEnum.Floor_TileOverConcrete, "matdefs\\structural\\Floor_TileOverConcrete" }, { MatDefEnum.Floor_TileOverConcreteSolid, "matdefs\\structural\\Floor_TileOverConcreteSolid" }, { MatDefEnum.Floor_TileOverWood, "matdefs\\structural\\Floor_TileOverWood" }, { MatDefEnum.Floor_Wood, "matdefs\\structural\\Floor_Wood" }, { MatDefEnum.GasMask, "matdefs\\agents\\GasMask" }, { MatDefEnum.GasMask_heavy, "matdefs\\agents\\GasMask_heavy" }, { MatDefEnum.Ground_Dirt, "matdefs\\nature\\Ground_Dirt" }, { MatDefEnum.Ground_Grass, "matdefs\\nature\\Ground_Grass" }, { MatDefEnum.Ground_Sand, "matdefs\\nature\\Ground_Sand" }, { MatDefEnum.Ground_Water, "matdefs\\nature\\Ground_Water" }, { MatDefEnum.HeavyArmor_Metal, "matdefs\\agents\\HeavyArmor_Metal" }, { MatDefEnum.HeavyFabric, "matdefs\\agents\\HeavyFabric" }, { MatDefEnum.Hedge, "matdefs\\nature\\Hedge" }, { MatDefEnum.LightArmor_Kevlar, "matdefs\\agents\\LightArmor_Kevlar" }, { MatDefEnum.Meat, "matdefs\\agents\\Meat" }, { MatDefEnum.MediumArmor_Metal, "matdefs\\agents\\MediumArmor_Metal" }, { MatDefEnum.MediumArmor_Padded, "matdefs\\agents\\MediumArmor_Padded" }, { MatDefEnum.Melee_Metal, "matdefs\\heldobjects\\Melee_Metal" }, { MatDefEnum.Melee_Polymer, "matdefs\\heldobjects\\Melee_Polymer" }, { MatDefEnum.Melee_Wood, "matdefs\\heldobjects\\Melee_Wood" }, { MatDefEnum.Metal_Plate, "matdefs\\structural\\Metal_Plate" }, { MatDefEnum.Metal_Sheet, "matdefs\\structural\\Metal_Sheet" }, { MatDefEnum.Metal_Strut, "matdefs\\structural\\Metal_Strut" }, { MatDefEnum.Paper, "matdefs\\props\\Paper" }, { MatDefEnum.PlasticTableTop, "matdefs\\props\\PlasticTableTop" }, { MatDefEnum.Rock_Large, "matdefs\\nature\\Rock_Large" }, { MatDefEnum.Rock_Small, "matdefs\\nature\\Rock_Small" }, { MatDefEnum.RotMeat, "matdefs\\agents\\RotMeat" }, { MatDefEnum.Sandbag, "matdefs\\structural\\Sandbag" }, { MatDefEnum.Solid_Armor, "matdefs\\structural\\Solid_Armor" }, { MatDefEnum.Solid_Concrete, "matdefs\\structural\\Solid_Concrete" }, { MatDefEnum.Solid_Metal, "matdefs\\structural\\Solid_Metal" }, { MatDefEnum.Testing_MEat, "matdefs\\heldobjects\\Testing_MEat" }, { MatDefEnum.Testing_Soft, "matdefs\\heldobjects\\Testing_Soft" }, { MatDefEnum.Tires, "matdefs\\props\\Tires" }, { MatDefEnum.Wall_Brick, "matdefs\\structural\\Wall_Brick" }, { MatDefEnum.Wall_DryWall, "matdefs\\structural\\Wall_DryWall" }, { MatDefEnum.Wall_GlassBrick, "matdefs\\structural\\Wall_GlassBrick" }, { MatDefEnum.Wall_GlassWindow, "matdefs\\structural\\Wall_GlassWindow" }, { MatDefEnum.Wall_SheetMetal, "matdefs\\structural\\Wall_SheetMetal" }, { MatDefEnum.Wall_WoodSolid, "matdefs\\structural\\Wall_WoodSolid" }, { MatDefEnum.Wall_WoodThick, "matdefs\\structural\\Wall_WoodThick" }, { MatDefEnum.Wall_WoodThin, "matdefs\\structural\\Wall_WoodThin" }, { MatDefEnum.Water, "matdefs\\structural\\Water" }, { MatDefEnum.WaterMelon, "matdefs\\props\\WaterMelon" }, { MatDefEnum.WoodProp, "matdefs\\props\\WoodProp" } }; private void Awake() { if (!Object.op_Implicit((Object)(object)base.MatDef)) { base.MatDef = Resources.Load(MatDefResources[AtlasMatDef]); } } } public class SceneSettingsOverride : MonoBehaviour { [SerializeField] [HideInInspector] private string GameMode = ""; [Header("Player Affordance")] public bool IsSpawnLockingEnabled = true; public bool AreHitBoxesEnabled; public bool DoesDamageGetRegistered; public float MaxPointingDistance = 2f; public float MaxProjectileRange = 500f; public bool ForcesCasingDespawn; public bool IsGravityForced; public GravityMode ForcedPhysGravity; [Header("Locomotion Options")] public bool IsLocoTeleportAllowed = true; public bool IsLocoSlideAllowed = true; public bool IsLocoDashAllowed = true; public bool IsLocoTouchpadAllowed = true; public bool IsLocoArmSwingerAllowed = true; public bool DoesTeleportUseCooldown; public bool DoesAllowAirControl; public bool UseMaxSpeedClamp; public float MaxSpeedClamp = 3f; [Header("Player Catching Options")] public bool UsesPlayerCatcher = true; public float CatchHeight = -50f; [Header("Player Respawn Options")] public int DefaultPlayerIFF; public bool DoesPlayerRespawnOnDeath = true; public float PlayerDeathFade = 3f; public float PlayerRespawnLoadDelay = 3.5f; public string SceneToLoadOnDeath = ""; public bool DoesUseHealthBar; public bool IsQuickbeltSwappingAllowed = true; public bool AreQuickbeltSlotsEnabled = true; public bool ConfigQuickbeltOnLoad; public int QuickbeltToConfig; public bool IsSceneLowLight; public bool IsAmmoInfinite; public bool AllowsInfiniteAmmoMags = true; public bool UsesUnlockSystem; [Header("Audio Stuff")] public float BaseLoudness = 5f; public bool UsesWeaponHandlingAISound; public float MaxImpactSoundEventDistance = 15f; private readonly List _audioSources = new List(); private void Awake() { AtlasPlugin.CurrentScene = AtlasPlugin.LastLoadedScene; if (string.IsNullOrEmpty(GameMode)) { GameMode = AtlasPlugin.CurrentScene.GameMode; } AtlasPlugin.Loaders[GameMode].Awake(); AudioSource[] array = Object.FindObjectsOfType(); foreach (AudioSource val in array) { if (((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; _audioSources.Add(val); } } } private IEnumerator Start() { yield return null; yield return AtlasPlugin.Loaders[GameMode].Start(); foreach (AudioSource source in _audioSources) { ((Behaviour)source).enabled = true; } } internal void ApplyOverrides(FVRSceneSettings self) { //IL_0057: 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_018f: Unknown result type (might be due to invalid IL or missing references) self.IsSpawnLockingEnabled = IsSpawnLockingEnabled; self.AreHitboxesEnabled = AreHitBoxesEnabled; self.DoesDamageGetRegistered = DoesDamageGetRegistered; self.MaxPointingDistance = MaxPointingDistance; self.MaxProjectileRange = MaxProjectileRange; self.ForcesCasingDespawn = ForcesCasingDespawn; self.IsGravityForced = IsGravityForced; self.ForcedPhysGravity = ForcedPhysGravity; self.IsLocoTeleportAllowed = IsLocoTeleportAllowed; self.IsLocoSlideAllowed = IsLocoSlideAllowed; self.IsLocoDashAllowed = IsLocoDashAllowed; self.IsLocoTouchpadAllowed = IsLocoTouchpadAllowed; self.IsLocoArmSwingerAllowed = IsLocoArmSwingerAllowed; self.DoesTeleportUseCooldown = DoesTeleportUseCooldown; self.DoesAllowAirControl = DoesAllowAirControl; self.UsesMaxSpeedClamp = UseMaxSpeedClamp; self.MaxSpeedClamp = MaxSpeedClamp; self.UsesPlayerCatcher = UsesPlayerCatcher; self.CatchHeight = CatchHeight; self.DefaultPlayerIFF = DefaultPlayerIFF; self.DoesPlayerRespawnOnDeath = DoesPlayerRespawnOnDeath; self.PlayerDeathFade = PlayerDeathFade; self.PlayerRespawnLoadDelay = PlayerRespawnLoadDelay; self.SceneToLoadOnDeath = SceneToLoadOnDeath; self.DoesUseHealthBar = DoesUseHealthBar; self.IsQuickbeltSwappingAllowed = IsQuickbeltSwappingAllowed; self.AreQuickbeltSlotsEnabled = AreQuickbeltSlotsEnabled; self.ConfigQuickbeltOnLoad = ConfigQuickbeltOnLoad; self.QuickbeltToConfig = QuickbeltToConfig; self.IsSceneLowLight = IsSceneLowLight; self.IsAmmoInfinite = IsAmmoInfinite; self.AllowsInfiniteAmmoMags = AllowsInfiniteAmmoMags; self.UsesUnlockSystem = UsesUnlockSystem; self.DefaultSoundEnvironment = (FVRSoundEnvironment)0; self.BaseLoudness = BaseLoudness; self.UsesWeaponHandlingAISound = UsesWeaponHandlingAISound; self.MaxImpactSoundEventDistance = MaxImpactSoundEventDistance; } private void OnValidate() { if (!string.IsNullOrEmpty(GameMode)) { GameMode = ""; } } } } namespace Atlas.MappingComponents.TakeAndHold { public class AtlasHoldPoint : MonoBehaviour { public List Bounds = null; public GameObject NavBlockers = null; public List BarrierPoints = null; public List AttackVectors = null; [Header("Spawn Points")] public Transform SystemNode = null; public List Targets = null; public List Turrets = null; public List SosigDefense = null; private void OnDrawGizmos() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)SystemNode)) { Extensions.GenericGizmoSphere(new Color(0f, 0.8f, 0.8f), 1.5f * Vector3.up, 0.25f, SystemNode); } Extensions.GenericGizmoCubeOutline(Color.white, Vector3.zero, Vector3.one, Bounds.ToArray()); Extensions.GenericGizmoSphere(new Color(0.8f, 0f, 0f, 0.5f), Vector3.zero, 0.25f, SosigDefense.ToArray()); Extensions.GenericGizmoSphere(new Color(0.8f, 0f, 0f, 0.1f), Vector3.zero, 0.25f, Turrets.ToArray()); Extensions.GenericGizmoCube(new Color(1f, 0f, 0f, 0.5f), Vector3.zero, new Vector3(0.1f, 0.5f, 0.1f), Vector3.zero, Targets.ToArray()); Extensions.GenericGizmoCube(new Color(0f, 0.6f, 0f, 0.5f), new Vector3(0f, 1f, 0f), new Vector3(1f, 2f, 0.1f), Vector3.forward, BarrierPoints.ToArray()); foreach (AttackVector attackVector in AttackVectors) { Extensions.GenericGizmoSphere(new Color(0.8f, 0f, 0f, 0.5f), Vector3.zero, 0.25f, attackVector.SpawnPoints_Sosigs_Attack.ToArray()); if (Object.op_Implicit((Object)(object)attackVector.GrenadeVector)) { Extensions.GenericGizmoCube(new Color(0.1f, 0.5f, 0.1f, 0.5f), Vector3.zero, 0.5f * Vector3.one, Vector3.forward, attackVector.GrenadeVector); } } } } public class AtlasSupplyPoint : MonoBehaviour { public Transform Bounds = null; [Header("Spawn Points")] public Transform Player = null; public List SosigDefense = null; public List Turrets = null; public List Panels = null; public List Boxes = null; public List Tables = null; public Transform CaseLarge = null; public Transform CaseSmall = null; public Transform Melee = null; public List SmallItem = null; public Transform Shield = null; [Header("Atlas Settings")] [Tooltip("If checked, this supply point will become the spawn point of every sequence if the sequences are generated.")] public bool ForceSpawnHere; [Tooltip("If checked, this supply point will only be used for the initial spawn and then never again.")] public bool OnlySpawn; private void OnDrawGizmos() { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) Extensions.GenericGizmoCubeOutline(Color.white, Vector3.zero, Vector3.one, Bounds); Extensions.GenericGizmoCube(new Color(0.4f, 0.4f, 0.9f, 0.5f), new Vector3(0f, 1.5f, 0.25f), new Vector3(2.3f, 1.2f, 0.5f), Vector3.forward, Panels.ToArray()); Extensions.GenericGizmoCube(new Color(1f, 0.4f, 0f, 0.5f), new Vector3(0f, 0.12f, 0f), new Vector3(1.4f, 0.24f, 0.35f), Vector3.forward, CaseLarge); Extensions.GenericGizmoCube(new Color(1f, 0.4f, 0f, 0.5f), new Vector3(0f, 0.12f, 0f), new Vector3(0.6f, 0.24f, 0.35f), Vector3.forward, CaseSmall); Extensions.GenericGizmoCube(new Color(0.5f, 0.5f, 0.5f, 0.5f), new Vector3(0f, 0.4f, 0.1f), new Vector3(0.7f, 0.8f, 1.5f), Vector3.zero, Tables.ToArray()); Extensions.GenericGizmoCube(new Color(0.7f, 0.7f, 0.7f, 0.5f), Vector3.zero, 0.5f * Vector3.one, Vector3.zero, Boxes.ToArray()); Extensions.GenericGizmoSphere(new Color(0.8f, 0f, 0f, 0.5f), Vector3.zero, 0.25f, SosigDefense.ToArray()); Extensions.GenericGizmoSphere(new Color(0.8f, 0f, 0f, 0.1f), Vector3.zero, 0.25f, Turrets.AsEnumerable().ToArray()); Extensions.GenericGizmoSphere(new Color(0f, 0.8f, 0f, 0.5f), Vector3.zero, 0.2f, Melee); Extensions.GenericGizmoSphere(new Color(0f, 0.8f, 0f, 0.5f), Vector3.zero, 0.1f, SmallItem.ToArray()); Extensions.GenericGizmoSphere(new Color(0f, 0.8f, 0.8f, 0.5f), Vector3.zero, 0.25f, Player); Extensions.GenericGizmoCube(new Color(0f, 0.8f, 0f, 0.1f), Vector3.zero, new Vector3(0.4f, 0.6f, 0.1f), Vector3.zero, Shield); } } public class TNH_ManagerOverride : MonoBehaviour { [Header("System Connections")] public List HoldPoints = null; public List SupplyPoints = null; public Transform ScoreDisplayPoint = null; internal void ApplyOverrides(TNH_Manager manager) { GameObject val = GameObject.Find("SupplyPoint_0"); GameObject val2 = GameObject.Find("HoldPoint_0"); GameObject gameObject = ((Component)val2.transform.Find("Barrier_SpawnPoint")).gameObject; List realHoldPoints = new List(); List realSupplyPoints = new List(); InitializeHoldPoints(val2, gameObject, realHoldPoints); InitializeSupplyPoints(val, realSupplyPoints); InitializeManager(manager, realHoldPoints, realSupplyPoints); InitializeState(manager); Object.Destroy((Object)(object)val2); Object.Destroy((Object)(object)val); } private TNH_SafePositionMatrix GenerateSafePositionMatrix(TNH_Manager manager) { //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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown TNH_SafePositionMatrix val = ScriptableObject.CreateInstance(); val.Entries_HoldPoints = new List(); val.Entries_SupplyPoints = new List(); for (int i = 0; i < manager.HoldPoints.Count; i++) { PositionEntry val2 = new PositionEntry { SafePositions_HoldPoints = new List(), SafePositions_SupplyPoints = new List() }; val.Entries_HoldPoints.Add(val2); for (int j = 0; j < manager.HoldPoints.Count; j++) { val2.SafePositions_HoldPoints.Add(i != j); } foreach (AtlasSupplyPoint supplyPoint in SupplyPoints) { val2.SafePositions_SupplyPoints.Add(!supplyPoint.OnlySpawn); } } val.GenereateSupplyPointsData(); for (int k = 0; k < manager.SupplyPoints.Count; k++) { PositionEntry val3 = val.Entries_SupplyPoints[k]; for (int l = 0; l < manager.SupplyPoints.Count; l++) { AtlasSupplyPoint atlasSupplyPoint = SupplyPoints[l]; val3.SafePositions_SupplyPoints.Add(k != l && !atlasSupplyPoint.OnlySpawn); } } return val; } private TNH_PointSequence GeneratePointSequence() { TNH_PointSequence val = ScriptableObject.CreateInstance(); AtlasSupplyPoint atlasSupplyPoint = SupplyPoints.FirstOrDefault((AtlasSupplyPoint s) => s.ForceSpawnHere); val.StartSupplyPointIndex = SupplyPoints.IndexOf(Object.op_Implicit((Object)(object)atlasSupplyPoint) ? atlasSupplyPoint : SodaliteUtils.GetRandom((IList)SupplyPoints)); val.HoldPoints = (from x in HoldPoints.OrderBy((AtlasHoldPoint _) => Random.Range(0, 100)).Take(5) select HoldPoints.IndexOf(x)).ToList(); return val; } private void InitializeHoldPoints(GameObject templateHoldPoint, GameObject templateBarrierSpawnPoint, List realHoldPoints) { //IL_0034: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) foreach (AtlasHoldPoint holdPoint in HoldPoints) { TNH_HoldPoint component = Object.Instantiate(templateHoldPoint).GetComponent(); ((Component)component).transform.SetPositionAndRotation(((Component)holdPoint).transform.position, ((Component)holdPoint).transform.rotation); foreach (GameObject item in ((Component)component).gameObject.IterateChildren()) { Object.Destroy((Object)(object)item); } component.Bounds = holdPoint.Bounds; component.NavBlockers = holdPoint.NavBlockers; component.SpawnPoint_SystemNode = holdPoint.SystemNode; component.SpawnPoints_Targets = holdPoint.Targets; component.SpawnPoints_Turrets = holdPoint.Turrets; component.AttackVectors = holdPoint.AttackVectors; component.SpawnPoints_Sosigs_Defense = holdPoint.SosigDefense; component.BarrierPoints.Clear(); foreach (Transform barrierPoint in holdPoint.BarrierPoints) { TNH_DestructibleBarrierPoint component2 = Object.Instantiate(templateBarrierSpawnPoint, ((Component)component).transform).GetComponent(); ((Component)component2).transform.SetPositionAndRotation(((Component)barrierPoint).transform.position, ((Component)barrierPoint).transform.rotation); component.BarrierPoints.Add(component2); } realHoldPoints.Add(component); } } private void InitializeSupplyPoints(GameObject templateSupplyPoint, List realSupplyPoints) { foreach (AtlasSupplyPoint supplyPoint in SupplyPoints) { TNH_SupplyPoint component = Object.Instantiate(templateSupplyPoint).GetComponent(); foreach (GameObject item in ((Component)component).gameObject.IterateChildren()) { Object.Destroy((Object)(object)item); } component.Bounds = supplyPoint.Bounds; component.SpawnPoint_PlayerSpawn = supplyPoint.Player; component.SpawnPoints_Sosigs_Defense = supplyPoint.SosigDefense; component.SpawnPoints_Turrets = supplyPoint.Turrets; component.SpawnPoints_Panels = supplyPoint.Panels; component.SpawnPoints_Boxes = supplyPoint.Boxes; component.SpawnPoint_Tables = supplyPoint.Tables; component.SpawnPoint_CaseLarge = supplyPoint.CaseLarge; component.SpawnPoint_CaseSmall = supplyPoint.CaseSmall; component.SpawnPoint_Melee = supplyPoint.Melee; component.SpawnPoints_SmallItem = supplyPoint.SmallItem; component.SpawnPoint_Shield = supplyPoint.Shield; realSupplyPoints.Add(component); } } private void InitializeManager(TNH_Manager manager, List realHoldPoints, List realSupplyPoints) { manager.LevelName = AtlasPlugin.CurrentScene?.Identifier; manager.HoldPoints = realHoldPoints; manager.SupplyPoints = realSupplyPoints; manager.ScoreDisplayPoint = ScoreDisplayPoint; manager.IsBigLevel = false; manager.UsesClassicPatrolBehavior = true; } private void InitializeState(TNH_Manager manager) { //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_0057: Unknown result type (might be due to invalid IL or missing references) State state = Random.state; Random.InitState(AtlasPlugin.CurrentScene.Identifier.GetHashCode()); manager.PossibleSequnces = new List(); for (int i = 0; i < 10; i++) { manager.PossibleSequnces.Add(GeneratePointSequence()); } manager.SafePosMatrix = GenerateSafePositionMatrix(manager); Random.state = state; } } } namespace Atlas.MappingComponents.Sandbox { public class ObjectSpawnPoint : MonoBehaviour { public string ObjectId = ""; public bool SpawnOnStart = true; private IEnumerator Start() { if (SpawnOnStart) { yield return null; yield return SpawnAsync(); } } public void Spawn() { ((MonoBehaviour)this).StartCoroutine(SpawnAsync()); } private IEnumerator SpawnAsync() { if (!IM.OD.TryGetValue(ObjectId, out var obj)) { AtlasPlugin.Logger.LogWarning((object)("No object found with id '" + ObjectId + "'.")); yield break; } AnvilCallback callback = ((AnvilAsset)obj).GetGameObjectAsync(); yield return callback; Object.Instantiate(callback.Result, ((Component)this).transform.position, ((Component)this).transform.rotation).SetActive(true); } private void OnDrawGizmos() { //IL_0015: 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_003c: 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_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0f, 0f, 0.6f, 0.5f); Gizmos.DrawSphere(((Component)this).transform.position, 0.1f); Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.forward * 0.25f); } } public class PlayerResetPoint : MonoBehaviour { private IEnumerator Start() { yield return null; Transform deathResetPoint = GM.CurrentSceneSettings.DeathResetPoint; if (Object.op_Implicit((Object)(object)deathResetPoint)) { deathResetPoint.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); } else { GM.CurrentSceneSettings.DeathResetPoint = ((Component)this).transform; } } } public class PlayerSpawnPoint : MonoBehaviour { private IEnumerator Start() { yield return null; GM.CurrentMovementManager.TeleportToPoint(((Component)this).transform.position, true, ((Component)this).transform.position + ((Component)this).transform.forward); } private void OnDrawGizmos() { //IL_0015: 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_003c: 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_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0.2f, 0.8f, 0.2f, 0.5f); Gizmos.DrawSphere(((Component)this).transform.position, 0.1f); Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.forward * 0.25f); } } public class PrefabSpawnPoint : MonoBehaviour { public enum PrefabType { ItemSpawner, Destructobin, SosigSpawner, WhizzBangADinger, BangerDetonator } internal static readonly Dictionary CachedObjects = new Dictionary(); internal static bool ObjectsCached = false; public PrefabType Type; private IEnumerator Start() { while (!ObjectsCached) { yield return null; } Vector3 spawnPosition = ((Component)this).transform.position; if (Type == PrefabType.ItemSpawner) { spawnPosition += ((Component)this).transform.forward * 0.025f; } if (CachedObjects.ContainsKey(Type) && Object.op_Implicit((Object)(object)CachedObjects[Type])) { GameObject obj = Object.Instantiate(CachedObjects[Type], spawnPosition, ((Component)this).transform.rotation); obj.SetActive(true); } } private void OnDrawGizmos() { //IL_0015: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0.4f, 0.4f, 0.9f, 0.5f); Gizmos.matrix = ((Component)this).transform.localToWorldMatrix; Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); Vector3 val3; switch (Type) { case PrefabType.ItemSpawner: ((Vector3)(ref val))..ctor(0f, 0.7f, 0.25f); ((Vector3)(ref val2))..ctor(2.3f, 1.2f, 0.5f); val3 = Vector3.forward; break; case PrefabType.Destructobin: ((Vector3)(ref val))..ctor(0f, 0.525f, 0f); ((Vector3)(ref val2))..ctor(0.65f, 1.05f, 0.65f); val3 = Vector3.left; break; case PrefabType.SosigSpawner: ((Vector3)(ref val))..ctor(0f, 0.11f, 0f); ((Vector3)(ref val2))..ctor(0.3f, 0.43f, 0.05f); val3 = Vector3.forward; break; case PrefabType.WhizzBangADinger: ((Vector3)(ref val))..ctor(0f, 0.425f, -0.05f); ((Vector3)(ref val2))..ctor(0.4f, 0.85f, 0.5f); val3 = Vector3.forward; break; case PrefabType.BangerDetonator: ((Vector3)(ref val))..ctor(0f, 0f, 0.1f); ((Vector3)(ref val2))..ctor(0.05f, 0.05f, 0.33f); val3 = Vector3.forward; break; default: throw new ArgumentOutOfRangeException(); } Gizmos.DrawCube(val, val2); Gizmos.DrawLine(val, val + val3 * 0.5f); } } public class SosigSpawnPoint : MonoBehaviour { [Header("Spawn Options")] public bool SpawnOnStart = true; [Header("Sosig Options")] public SosigEnemyID SosigType; public int IFF; public bool SpawnActive; public SosigOrder SpawnState; public IEnumerator Start() { yield return (object)new WaitForEndOfFrame(); if (SpawnOnStart) { Spawn(); } } public void Spawn() { //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_0013: 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_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_0035: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0062: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) SpawnOptions val = new SpawnOptions { SpawnActivated = SpawnActive, SpawnState = SpawnState, IFF = IFF, SpawnWithFullAmmo = true, EquipmentMode = (EquipmentSlots)7, SosigTargetPosition = ((Component)this).transform.position, SosigTargetRotation = ((Component)this).transform.eulerAngles }; SosigAPI.Spawn(ManagerSingleton.Instance.odicSosigObjsByID[SosigType], val, ((Component)this).transform.position, ((Component)this).transform.rotation); } private void OnDrawGizmos() { //IL_0015: 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_003c: 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_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references) Gizmos.color = new Color(0.8f, 0.2f, 0.2f, 0.5f); Gizmos.DrawSphere(((Component)this).transform.position, 0.1f); Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.forward * 0.25f); } } } namespace Atlas.Loaders { public interface ISceneLoader { void Awake(); IEnumerator Start(); } public class SandboxLoader : ISceneLoader { public virtual void Awake() { PrefabSpawnPoint.ObjectsCached = false; SceneManager.LoadScene("ModBlank_Simple", (LoadSceneMode)1); } public virtual IEnumerator Start() { Scene sceneByName = SceneManager.GetSceneByName("ModBlank_Simple"); GameObject[] objects = ((Scene)(ref sceneByName)).GetRootGameObjects(); PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.ItemSpawner] = IM.Prefab_ItemSpawner; PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.Destructobin] = objects.First((GameObject x) => ((Object)x).name == "Destructobin"); PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.SosigSpawner] = objects.First((GameObject x) => ((Object)x).name == "SosigSpawner"); PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.BangerDetonator] = objects.First((GameObject x) => ((Object)x).name == "BangerDetonator"); PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.WhizzBangADinger] = objects.First((GameObject x) => ((Object)x).name == "WhizzBangADinger2"); foreach (GameObject obj in PrefabSpawnPoint.CachedObjects.Values) { obj.SetActive(false); } PrefabSpawnPoint.ObjectsCached = true; yield break; } } public class TakeAndHoldLoader : ISceneLoader { public virtual void Awake() { PrefabSpawnPoint.ObjectsCached = false; SceneManager.LoadScene("ModBlank_Take&Hold", (LoadSceneMode)1); } public virtual IEnumerator Start() { if ((int)GM.TNH_Manager.ItemSpawnerMode == 1) { PrefabSpawnPoint.CachedObjects[PrefabSpawnPoint.PrefabType.ItemSpawner] = GM.TNH_Manager.ItemSpawner; } PrefabSpawnPoint.ObjectsCached = true; yield break; } } }