Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ImmersiveEntrance v1.1.2
BepInEx/plugins/com.github.zehsteam.ImmersiveEntrance.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CullFactory.Behaviours.API; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.RendererUtils; using UnityEngine.SceneManagement; using com.github.zehsteam.ImmersiveEntrance.Dependencies.CullFactoryMod; using com.github.zehsteam.ImmersiveEntrance.Dependencies.LethalConfigMod; using com.github.zehsteam.ImmersiveEntrance.Extensions; using com.github.zehsteam.ImmersiveEntrance.Helpers; using com.github.zehsteam.ImmersiveEntrance.Helpers.IL; using com.github.zehsteam.ImmersiveEntrance.Managers; using com.github.zehsteam.ImmersiveEntrance.MonoBehaviours; using com.github.zehsteam.ImmersiveEntrance.Objects; using com.github.zehsteam.ImmersiveEntrance.Objects.PortalSettingTypes; using com.github.zehsteam.ImmersiveEntrance.Patches; using com.github.zehsteam.ImmersiveEntrance.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Zehs")] [assembly: AssemblyDescription("See the other side through the main entrance doors.")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+374a5d67af37c811643542e8ec33ad14fedc93a6")] [assembly: AssemblyProduct("ImmersiveEntrance")] [assembly: AssemblyTitle("com.github.zehsteam.ImmersiveEntrance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsUnmanagedAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.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 com.github.zehsteam.ImmersiveEntrance { internal static class Assets { public static readonly string AssetBundleFileName = "immersiveentrance_assets"; public static AssetBundle AssetBundle { get; private set; } public static bool IsLoaded { get; private set; } public static GameObject DoorPortalPrefab { get; private set; } public static Shader PosterizeShader { get; private set; } public static EntranceDoorReplacement MansionEntranceDoorReplacement { get; private set; } public static void Load() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, AssetBundleFileName); if (!File.Exists(text)) { Logger.LogFatal("Failed to load assets. AssetBundle file could not be found at path \"" + text + "\". Make sure the \"" + AssetBundleFileName + "\" file is in the same folder as the mod's DLL file."); } else { AssetBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)AssetBundle == (Object)null) { Logger.LogFatal("Failed to load assets. AssetBundle is null."); return; } OnAssetBundleLoaded(AssetBundle); IsLoaded = true; } } private static void OnAssetBundleLoaded(AssetBundle assetBundle) { DoorPortalPrefab = LoadAsset<GameObject>("DoorPortal", assetBundle); PosterizeShader = LoadAsset<Shader>("Posterize", assetBundle); MansionEntranceDoorReplacement = LoadAsset<EntranceDoorReplacement>("MansionEntranceDoorReplacement", assetBundle); } private static T LoadAsset<T>(string name, AssetBundle assetBundle) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" from AssetBundle. Name is null or whitespace."); return default(T); } if ((Object)(object)assetBundle == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null."); return default(T); } T val = assetBundle.LoadAsset<T>(name); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. No asset found with that type and name."); return default(T); } return val; } private static bool TryLoadAsset<T>(string name, AssetBundle assetBundle, out T asset) where T : Object { asset = LoadAsset<T>(name, assetBundle); return (Object)(object)asset != (Object)null; } } internal static class Logger { public static ManualLogSource ManualLogSource { get; private set; } public static bool IsExtendedLoggingEnabled => ConfigManager.Misc_ExtendedLogging?.Value ?? false; public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void LogDebug(object data) { Log((LogLevel)32, data); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogMessage(object data, bool extended = false) { Log((LogLevel)8, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } public static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!extended || IsExtendedLoggingEnabled) { ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } } [BepInPlugin("com.github.zehsteam.ImmersiveEntrance", "ImmersiveEntrance", "1.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("com.github.zehsteam.ImmersiveEntrance"); internal static Plugin Instance { get; private set; } private void Awake() { Instance = this; Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.ImmersiveEntrance")); Logger.LogInfo("ImmersiveEntrance has awoken!"); _harmony.PatchAll(typeof(StartOfRound_Patches)); _harmony.PatchAll(typeof(RoundManager_Patches)); _harmony.PatchAll(typeof(TimeOfDay_Patches)); _harmony.PatchAll(typeof(MatchLocalPlayerPosition_Patches)); _harmony.PatchAll(typeof(EntranceTeleport_Patches)); Assets.Load(); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.ImmersiveEntrance"; public const string PLUGIN_NAME = "ImmersiveEntrance"; public const string PLUGIN_VERSION = "1.1.2"; } } namespace com.github.zehsteam.ImmersiveEntrance.Rendering { public class PosterizationCustomPass : CustomPass { public static Material PosterizationMaterial; public static Shader PosterizationShader; public static RTHandle PosterizationRT; public static RTHandle ExclusionMaskRT; protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { //IL_000a: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) PosterizationShader = Assets.PosterizeShader; PosterizationRT = RTHandles.Alloc(Vector2.one, TextureXR.slices, (DepthBits)0, (GraphicsFormat)74, (FilterMode)0, (TextureWrapMode)0, TextureXR.dimension, false, false, true, false, 1, 0f, (MSAASamples)1, false, true, (RenderTextureMemoryless)0, (VRTextureUsage)0, "Posterization Buffer"); PosterizationMaterial = CoreUtils.CreateEngineMaterial(PosterizationShader); ExclusionMaskRT = RTHandles.Alloc(Vector2.one, TextureXR.slices, (DepthBits)0, (GraphicsFormat)5, (FilterMode)0, (TextureWrapMode)0, TextureXR.dimension, false, false, true, false, 1, 0f, (MSAASamples)1, false, true, (RenderTextureMemoryless)0, (VRTextureUsage)0, "Exclusion Mask Buffer"); } protected override void Execute(CustomPassContext ctx) { //IL_0000: 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_0012: 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_0033: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0065: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_014e: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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) CoreUtils.SetRenderTarget(ctx.cmd, ExclusionMaskRT, ctx.cameraDepthBuffer, (ClearFlag)1, Color.white, 0, (CubemapFace)(-1), -1); RendererListDesc val = default(RendererListDesc); ((RendererListDesc)(ref val))..ctor((ShaderTagId[])(object)new ShaderTagId[1] { new ShaderTagId("PosterizeExclusion") }, ctx.cullingResults, ctx.hdCamera.camera); val.rendererConfiguration = (PerObjectData)0; val.renderQueueRange = RenderQueueRange.all; val.sortingCriteria = (SortingCriteria)0; RendererListDesc val2 = val; ScriptableRenderContext renderContext = ctx.renderContext; CommandBuffer cmd = ctx.cmd; ScriptableRenderContext renderContext2 = ctx.renderContext; CoreUtils.DrawRendererList(renderContext, cmd, ((ScriptableRenderContext)(ref renderContext2)).CreateRendererList(val2)); ctx.propertyBlock.SetFloat("_OutlineThickness", 0.001f); ctx.propertyBlock.SetFloat("_DepthThreshold", 0.4f); ctx.propertyBlock.SetFloat("_DepthCurve", 0.4f); ctx.propertyBlock.SetFloat("_DepthStrength", 6f); ctx.propertyBlock.SetFloat("_ColorThreshold", 0.47f); ctx.propertyBlock.SetFloat("_ColorCurve", 2.94f); ctx.propertyBlock.SetFloat("_ColorStrength", 0.65f); ctx.propertyBlock.SetTexture("_ExclusionMaskBuffer", RTHandle.op_Implicit(ExclusionMaskRT)); ctx.propertyBlock.SetFloat("_PlayerCameraNearClipPlane", 0.05f); ctx.propertyBlock.SetFloat("_PlayerCameraFarClipPlane", 400f); bool value = ConfigManager.Debug_UseSimulatedDeviceDepth.Value; ctx.propertyBlock.SetInt("_UseSimulatedDeviceDepth", value ? 1 : 0); CoreUtils.SetRenderTarget(ctx.cmd, PosterizationRT, (ClearFlag)7, 0, (CubemapFace)(-1), -1); CoreUtils.DrawFullScreen(ctx.cmd, PosterizationMaterial, ctx.propertyBlock, PosterizationMaterial.FindPass("ReadColor")); ctx.propertyBlock.SetTexture("_PosterizationBuffer", RTHandle.op_Implicit(PosterizationRT)); CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer, (ClearFlag)0, 0, (CubemapFace)(-1), -1); CoreUtils.DrawFullScreen(ctx.cmd, PosterizationMaterial, ctx.propertyBlock, PosterizationMaterial.FindPass("WriteColor")); } protected override void Cleanup() { CoreUtils.Destroy((Object)(object)PosterizationMaterial); PosterizationRT.Release(); ExclusionMaskRT.Release(); } } } namespace com.github.zehsteam.ImmersiveEntrance.Patches { [HarmonyPatch(typeof(EntranceTeleport))] internal static class EntranceTeleport_Patches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Patch(EntranceTeleport __instance) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (Logger.IsExtendedLoggingEnabled) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("| EntranceTeleport.Awake();"); stringBuilder.AppendLine("| "); stringBuilder.AppendLine("| " + __instance.GetLogInfo()); stringBuilder.AppendLine("| "); stringBuilder.AppendLine("| Moon: \"" + LevelHelper.GetCurrentMoonName() + "\""); stringBuilder.AppendLine("| Interior: \"" + InteriorHelper.GetCurrentInteriorName() + "\""); stringBuilder.AppendLine("| "); Scene scene = ((Component)__instance).gameObject.scene; stringBuilder.AppendLine("| Scene: \"" + ((Scene)(ref scene)).name + "\""); stringBuilder.AppendLine("| Hierarchy path: \"" + ((Component)__instance).transform.GetHierarchyPath() + "\""); Logger.LogInfo("\n\n" + stringBuilder.ToString().Trim() + "\n"); } EntranceManager.SpawnDoorPortal(__instance); } } [HarmonyPatch(typeof(MatchLocalPlayerPosition))] internal static class MatchLocalPlayerPosition_Patches { [HarmonyPatch("LateUpdate")] [HarmonyPrefix] private static bool LateUpdate_Patch(MatchLocalPlayerPosition __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!PlayerUtils.IsLocalPlayerCameraInsideInterior()) { return true; } if (DoorPortal.TryGetRenderingInstance(out var doorPortal)) { ((Component)__instance).transform.position = ((Component)doorPortal.PortalCamera).transform.position; return false; } return false; } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManager_Patches { [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpc_Patch(RoundManager __instance) { if (NetworkUtils.IsExecutingRPCMethod((NetworkBehaviour)(object)__instance)) { Logger.LogInfo("Current moon is " + LevelHelper.GetCurrentMoonName()); Logger.LogInfo("Current interior is " + InteriorHelper.GetCurrentInteriorName()); EntranceManager.LinkMainEntrancePortals(); } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRound_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(0)] private static void Start_Patch() { PortalSettingsManager.Initialize(); CustomPassHelper.ReplaceVanillaCustomPass(); } [HarmonyPatch("EndOfGame")] [HarmonyPostfix] private static void EndOfGame_Patch() { EntranceManager.Reset(); LevelHelper.Reset(); } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPostfix] private static void OnLocalDisconnect_Patch() { EntranceManager.Reset(); LevelHelper.Reset(); } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDay_Patches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Patch(TimeOfDay __instance) { ((Component)__instance).gameObject.AddComponent<WeatherAudioManager>(); } [HarmonyPatch("SetInsideLightingDimness")] [HarmonyPostfix] private static void SetInsideLightingDimness_Patch(TimeOfDay __instance) { float lightDimmer = (PlayerUtils.IsLocalPlayerCameraInsideInterior() ? 0f : 1f); __instance.indirectLightData.lightDimmer = lightDimmer; } [HarmonyPatch("SetWeatherEffects")] [HarmonyPrefix] private static void SetWeatherEffects_Patch(TimeOfDay __instance) { if (ConfigManager.PortalGraphics_WeatherEffectsEnabled.Value && LevelHelper.IsForceWeatherEffectsEnabled) { __instance.SetCurrentLevelWeatherEnabled(value: true); } } [HarmonyPatch("SetWeatherEffects")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SetWeatherEffects_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown ILInjector iLInjector = new ILInjector(instructions); iLInjector.Find(ILMatcher.Call(typeof(StartOfRound).GetProperty("Instance").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 52), ILMatcher.Ldfld(typeof(StartOfRound).GetField("spectateCamera"), "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 53), ILMatcher.Callvirt(typeof(Component).GetProperty("transform").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 54), ILMatcher.Callvirt(typeof(Transform).GetProperty("position").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 55), ILMatcher.Stloc().CaptureAs(out var variable)); if (iLInjector.IsValid) { iLInjector.ReplaceLastMatch(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelHelper), "GetPositionForWeatherEffects", (Type[])null, (Type[])null)), variable); iLInjector.Find(ILMatcher.Call(typeof(StartOfRound).GetProperty("Instance").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 74), ILMatcher.Ldfld(typeof(StartOfRound).GetField("localPlayerController"), "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 75), ILMatcher.Callvirt(typeof(Component).GetProperty("transform").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 76), ILMatcher.Callvirt(typeof(Transform).GetProperty("position").GetMethod, "SetWeatherEffects_Transpiler", "./Patches/TimeOfDay_Patches.cs", 77), ILMatcher.Stloc().CaptureAs(out var variable2)); if (iLInjector.IsValid) { iLInjector.ReplaceLastMatch(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LevelHelper), "GetPositionForWeatherEffects", (Type[])null, (Type[])null)), variable2); return iLInjector.ReleaseInstructions(); } Logger.LogError("[TimeOfDay_Patches] SetWeatherEffects_Transpiler: Failed to run! Could not match instructions."); return instructions; } Logger.LogError("[TimeOfDay_Patches] SetWeatherEffects_Transpiler: Failed to run! Could not match instructions."); return instructions; } } } namespace com.github.zehsteam.ImmersiveEntrance.Objects { [CreateAssetMenu(menuName = "ImmersiveEntrance/EntranceDoorReplacement", order = 0, fileName = "EntranceDoorReplacement")] public class EntranceDoorReplacement : ScriptableObject { [field: SerializeField] public GameObject DoorFrame { get; private set; } [field: SerializeField] public GameObject DoorLeft { get; private set; } [field: SerializeField] public GameObject DoorRight { get; private set; } } public class EntranceObjects { public bool IsOutside; public GameObject ViewBlocker; public GameObject DoorFrame; public GameObject DoorLeft; public GameObject DoorRight; public bool IsValid() { if ((Object)(object)ViewBlocker == (Object)null) { return false; } if (!IsOutside && (Object)(object)DoorFrame == (Object)null) { return false; } if ((Object)(object)DoorLeft == (Object)null) { return false; } if ((Object)(object)DoorRight == (Object)null) { return false; } return true; } public void SetViewBlockerEnabled(bool value) { GameObject viewBlocker = ViewBlocker; if (viewBlocker != null) { viewBlocker.SetActive(value); } } public void SetObjectsEnabled(bool value) { GameObject doorFrame = DoorFrame; if (doorFrame != null) { doorFrame.SetActive(value); } GameObject doorLeft = DoorLeft; if (doorLeft != null) { doorLeft.SetActive(value); } GameObject doorRight = DoorRight; if (doorRight != null) { doorRight.SetActive(value); } } public void LogMissingObjects() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(string.Format("[{0}] (IsOutside: {1}) is missing these objects:", "EntranceObjects", IsOutside)); if ((Object)(object)ViewBlocker == (Object)null) { stringBuilder.AppendLine("- ViewBlocker"); } if ((Object)(object)DoorFrame == (Object)null) { stringBuilder.AppendLine("- DoorFrame"); } if ((Object)(object)DoorLeft == (Object)null) { stringBuilder.AppendLine("- DoorLeft"); } if ((Object)(object)DoorRight == (Object)null) { stringBuilder.AppendLine("- DoorRight"); } Logger.LogWarning(stringBuilder.ToString()); } } public enum InteriorType { Facility = 0, Mansion = 1, Mineshaft = 2, Unknown = 999 } public class MainEntranceData { public EntranceTeleport EntranceTeleport { get; set; } public DoorPortal DoorPortal { get; set; } public EntranceObjects EntranceObjects { get; set; } public bool IsOutside => EntranceTeleport.IsOutside(); public bool HasEntranceTeleport => (Object)(object)EntranceTeleport != (Object)null; public bool HasDoorPortal => (Object)(object)DoorPortal != (Object)null; public void Reset() { EntranceTeleport = null; if ((Object)(object)DoorPortal != (Object)null) { Object.Destroy((Object)(object)DoorPortal); } EntranceObjects = null; } } public enum NearClipPlaneMode { Default, ObliqueProjection } public struct Padding { public float Left { get; set; } public float Right { get; set; } public float Top { get; set; } public float Bottom { get; set; } public Padding(float left, float right, float top, float bottom) { Left = left; Right = right; Top = top; Bottom = bottom; } } public enum PixelResolutionType { PlayerCamera, Default, Performance, UltraPerformance, Retro } } namespace com.github.zehsteam.ImmersiveEntrance.Objects.PortalSettingTypes { public class InteriorPortalSettings : PortalSettings { public struct InteriorDefaultValues { public Func<EntranceDoorReplacement> GetDoorReplacement { get; set; } public InteriorDefaultValues() { GetDoorReplacement = null; } public InteriorDefaultValues(Func<EntranceDoorReplacement> getDoorReplacement = null) { GetDoorReplacement = getDoorReplacement; } } private InteriorDefaultValues _interiorDefaultValues; private bool _boundConfigs; public InteriorType InteriorType { get; private set; } = InteriorType.Unknown; public string DungeonFlowName { get; private set; } public bool HasDoorReplacement => GetDoorReplacement != null; public Func<EntranceDoorReplacement> GetDoorReplacement => _interiorDefaultValues.GetDoorReplacement; public ConfigEntry<bool> ReplaceDoor { get; private set; } public override string ConfigSection => "Interior: " + GetInteriorName(); public InteriorPortalSettings(InteriorType interiorType, InteriorDefaultValues interiorDefaultValues, DefaultValues defaultValues) : base(defaultValues) { InteriorType = interiorType; _interiorDefaultValues = interiorDefaultValues; } public InteriorPortalSettings(string dungeonFlowName, InteriorDefaultValues interiorDefaultValues, DefaultValues defaultValues) : base(defaultValues) { InteriorType = InteriorType.Unknown; DungeonFlowName = dungeonFlowName; _interiorDefaultValues = interiorDefaultValues; } public override void BindConfigs() { if (!_boundConfigs) { _boundConfigs = true; base.BindConfigs(); if (HasDoorReplacement) { ReplaceDoor = ConfigHelper.Bind(ConfigSection, "ReplaceDoor", defaultValue: true, "If enabled, will replace the door model."); } } } public bool Matches(DungeonFlow dungeonFlow) { InteriorType interiorType = InteriorHelper.GetInteriorType(dungeonFlow); if (interiorType == InteriorType.Unknown) { return ((Object)dungeonFlow).name.Equals(DungeonFlowName, StringComparison.OrdinalIgnoreCase); } return interiorType == InteriorType; } public string GetInteriorName() { if (InteriorType != InteriorType.Unknown) { return InteriorType.ToString(); } return DungeonFlowName; } } public class MoonPortalSettings : PortalSettings { public string PlanetName { get; private set; } public override string ConfigSection => "Moon: " + PlanetName; public MoonPortalSettings(string planetName, DefaultValues defaultValues) : base(defaultValues) { PlanetName = planetName; } public bool Matches(SelectableLevel level) { return PlanetName.Equals(level.PlanetName, StringComparison.OrdinalIgnoreCase); } public string GetStrippedPlanetName() { if (!PlanetName.Contains(" ")) { return PlanetName; } return PlanetName.Substring(PlanetName.IndexOf(" ")); } } public abstract class PortalSettings { public struct DefaultValues { public bool Enabled { get; set; } public bool UseDynamicPivot { get; set; } public Vector3 PivotPositionOffset { get; set; } public Vector3 PivotRotationOffset { get; set; } public Padding ScreenCrop { get; set; } public bool UseViewDistance { get; set; } public float ViewDistance { get; set; } public DefaultValues() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) PivotPositionOffset = default(Vector3); PivotRotationOffset = default(Vector3); ScreenCrop = default(Padding); UseViewDistance = false; Enabled = true; UseDynamicPivot = true; ViewDistance = 50f; } public DefaultValues(bool enabled = true, bool useDynamicPivot = true, Vector3? pivotPositionOffset = null, Vector3? pivotRotationOffset = null, Padding? screenCrop = null, float? viewDistance = null) { //IL_0023: 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_0043: 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) Enabled = enabled; UseDynamicPivot = useDynamicPivot; PivotPositionOffset = (Vector3)(((??)pivotPositionOffset) ?? Vector3.zero); PivotRotationOffset = (Vector3)(((??)pivotRotationOffset) ?? Vector3.zero); ScreenCrop = screenCrop.GetValueOrDefault(); UseViewDistance = viewDistance.HasValue; ViewDistance = viewDistance.GetValueOrDefault(50f); } } protected DefaultValues _defaultValues; public ConfigEntry<bool> Enabled { get; private set; } public bool UseDynamicPivot => _defaultValues.UseDynamicPivot; public Vector3 PivotPositionOffset => _defaultValues.PivotPositionOffset; public Vector3 PivotRotationOffset => _defaultValues.PivotRotationOffset; public Padding ScreenCrop => _defaultValues.ScreenCrop; public ConfigEntry<bool> UseViewDistance { get; private set; } public ConfigEntry<float> ViewDistance { get; private set; } public abstract string ConfigSection { get; } public PortalSettings(DefaultValues defaultValues) { _defaultValues = defaultValues; } public virtual void BindConfigs() { Enabled = ConfigHelper.Bind(ConfigSection, "Enabled", _defaultValues.Enabled, "Enable this portal. If disabled, will also disable the other portal."); UseViewDistance = ConfigHelper.Bind(ConfigSection, "UseViewDistance", _defaultValues.UseViewDistance, "If enabled, this portal will use the view distance in this config instead of the global view distance config."); ViewDistance = ConfigHelper.Bind(ConfigSection, "ViewDistance", _defaultValues.ViewDistance, "The distance you can see through this portal. Requires UseViewDistance to be enabled.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.06f, 250f)); UseViewDistance.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; ViewDistance.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; } } public class PortalSettingsDatabase<T> where T : PortalSettings { protected readonly List<T> _entries = new List<T>(); public IReadOnlyList<T> Entries => _entries; public virtual bool AddEntry(T entry) { if (_entries.Contains(entry)) { return false; } _entries.Add(entry); return true; } public virtual bool RemoveEntry(T entry) { return _entries.Remove(entry); } public virtual bool ContainsEntry(T entry) { return _entries.Contains(entry); } } public class MoonPortalSettingsDatabase : PortalSettingsDatabase<MoonPortalSettings> { public bool AddEntry(SelectableLevel level, PortalSettings.DefaultValues? defaultValues = null) { if (!level.planetHasTime) { return false; } if (ContainsEntry(level)) { return false; } return ((PortalSettingsDatabase<MoonPortalSettings>)this).AddEntry(new MoonPortalSettings(level.PlanetName, defaultValues ?? new PortalSettings.DefaultValues())); } public void BindConfigs() { List<MoonPortalSettings> list = _entries.OrderBy((MoonPortalSettings x) => x.GetStrippedPlanetName()).ToList(); foreach (MoonPortalSettings item in list) { item.BindConfigs(); } } public MoonPortalSettings GetEntry(SelectableLevel level) { return base.Entries.FirstOrDefault((MoonPortalSettings x) => x.Matches(level)); } public bool TryGetEntry(SelectableLevel level, out MoonPortalSettings settings) { settings = GetEntry(level); return settings != null; } public bool ContainsEntry(SelectableLevel level) { MoonPortalSettings settings; return TryGetEntry(level, out settings); } public MoonPortalSettings GetEntryForCurrentMoon() { return GetEntry(StartOfRound.Instance?.currentLevel); } public bool TryGetEntryForCurrentMoon(out MoonPortalSettings settings) { settings = GetEntryForCurrentMoon(); return settings != null; } } public class InteriorPortalSettingsDatabase : PortalSettingsDatabase<InteriorPortalSettings> { public bool AddEntry(InteriorType interiorType, InteriorPortalSettings.InteriorDefaultValues? interiorDefaultValues = null, PortalSettings.DefaultValues? defaultValues = null) { InteriorPortalSettings.InteriorDefaultValues valueOrDefault = interiorDefaultValues.GetValueOrDefault(); if (!interiorDefaultValues.HasValue) { valueOrDefault = new InteriorPortalSettings.InteriorDefaultValues(); interiorDefaultValues = valueOrDefault; } PortalSettings.DefaultValues valueOrDefault2 = defaultValues.GetValueOrDefault(); if (!defaultValues.HasValue) { valueOrDefault2 = new PortalSettings.DefaultValues(); defaultValues = valueOrDefault2; } return ((PortalSettingsDatabase<InteriorPortalSettings>)this).AddEntry(new InteriorPortalSettings(interiorType, interiorDefaultValues.Value, defaultValues.Value)); } public bool AddEntry(DungeonFlow dungeonFlow, InteriorPortalSettings.InteriorDefaultValues? interiorDefaultValues = null, PortalSettings.DefaultValues? defaultValues = null) { InteriorPortalSettings.InteriorDefaultValues valueOrDefault = interiorDefaultValues.GetValueOrDefault(); if (!interiorDefaultValues.HasValue) { valueOrDefault = new InteriorPortalSettings.InteriorDefaultValues(); interiorDefaultValues = valueOrDefault; } PortalSettings.DefaultValues valueOrDefault2 = defaultValues.GetValueOrDefault(); if (!defaultValues.HasValue) { valueOrDefault2 = new PortalSettings.DefaultValues(); defaultValues = valueOrDefault2; } InteriorType interiorType = InteriorHelper.GetInteriorType(dungeonFlow); if (interiorType == InteriorType.Unknown) { return ((PortalSettingsDatabase<InteriorPortalSettings>)this).AddEntry(new InteriorPortalSettings(((Object)dungeonFlow).name, interiorDefaultValues.Value, defaultValues.Value)); } return ((PortalSettingsDatabase<InteriorPortalSettings>)this).AddEntry(new InteriorPortalSettings(interiorType, interiorDefaultValues.Value, defaultValues.Value)); } public void BindConfigs() { List<InteriorPortalSettings> list = _entries.OrderBy((InteriorPortalSettings x) => x.GetInteriorName()).ToList(); foreach (InteriorPortalSettings item in list) { item.BindConfigs(); } } public InteriorPortalSettings GetEntry(DungeonFlow dungeonFlow) { return base.Entries.FirstOrDefault((InteriorPortalSettings x) => x.Matches(dungeonFlow)); } public bool TryGetEntry(DungeonFlow dungeonFlow, out InteriorPortalSettings settings) { settings = GetEntry(dungeonFlow); return settings != null; } public bool ContainsEntry(DungeonFlow dungeonFlow) { InteriorPortalSettings settings; return TryGetEntry(dungeonFlow, out settings); } public InteriorPortalSettings GetEntryForCurrentInterior() { return GetEntry(InteriorHelper.GetCurrentDungeonFlow()); } public bool TryGetEntryForCurrentInterior(out InteriorPortalSettings settings) { settings = GetEntryForCurrentInterior(); return settings != null; } } } namespace com.github.zehsteam.ImmersiveEntrance.MonoBehaviours { internal class CoroutineRunner : MonoBehaviour { public static CoroutineRunner Instance { get; private set; } public static CoroutineRunner Spawn() { //IL_002b: 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_0039: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("ImmersiveEntrance CoroutineRunner", new Type[1] { typeof(CoroutineRunner) }) { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)val); return val.GetComponent<CoroutineRunner>(); } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public static Coroutine Start(IEnumerator routine) { if ((Object)(object)Instance == (Object)null) { CoroutineRunner coroutineRunner = Spawn(); return ((coroutineRunner != null) ? ((MonoBehaviour)coroutineRunner).StartCoroutine(routine) : null) ?? null; } CoroutineRunner instance = Instance; return ((instance != null) ? ((MonoBehaviour)instance).StartCoroutine(routine) : null) ?? null; } public static void Stop(IEnumerator routine) { CoroutineRunner instance = Instance; if (instance != null) { ((MonoBehaviour)instance).StopCoroutine(routine); } } public static void Stop(Coroutine routine) { CoroutineRunner instance = Instance; if (instance != null) { ((MonoBehaviour)instance).StopCoroutine(routine); } } } public class DoorPortal : MonoBehaviour { private static readonly List<DoorPortal> _instances = new List<DoorPortal>(); [SerializeField] private Transform _pivot; [SerializeField] private MeshRenderer _screen; [SerializeField] private MeshRenderer _screenOccluder; [SerializeField] private GameObject _renderingContainer; [SerializeField] private Camera _portalCamera; [SerializeField] private Light _nightVision; [SerializeField] private GameObject _fogExclusionZone; private RenderTexture _viewTexture; private bool _isDrawing; private bool _isLocalPlayerInRange; private LayerMask _pivotRaycastMask; public Camera PortalCamera => _portalCamera; public bool IsOutside => MainEntrance.IsOutside; public MainEntranceData MainEntrance { get; private set; } public PortalSettings PortalSettings { get; private set; } public DoorPortal LinkedPortal { get; private set; } private void Awake() { ((Behaviour)_portalCamera).enabled = false; SetDrawing(value: false); SetRendering(value: false); } private void OnEnable() { if (!_instances.Contains(this)) { _instances.Add(this); } } private void OnDisable() { _instances.Remove(this); } private void Start() { if (CullFactoryProxy.IsInstalled) { CullFactoryProxy.DisableCullingForCamera(_portalCamera); } if (MainEntrance == null) { Logger.LogError("[DoorPortal] Start: MainEntranceData is null!"); return; } if (MainEntrance.IsOutside) { PortalSettings = PortalSettingsManager.MoonDatabase.GetEntryForCurrentMoon(); } else { PortalSettings = PortalSettingsManager.InteriorDatabase.GetEntryForCurrentInterior(); } if (PortalSettings == null) { Logger.LogError("[DoorPortal] Start: PortalSettings is null!"); return; } Utils.InvokeAfterDelay(InitializePivot, TimeSpan.FromSeconds(0.10000000149011612), (MonoBehaviour)(object)this); InitializeScreen(); InitializeCamera(); ApplyConfigSettings(); } private void Update() { if (!((Object)(object)LinkedPortal == (Object)null)) { UpdateScreenVisibility(); } } private void LateUpdate() { if (!((Object)(object)LinkedPortal == (Object)null)) { UpdatePortalCamera(); } } public void SetMainEntranceData(MainEntranceData mainEntrance) { MainEntrance = mainEntrance; } public void LinkPortal(DoorPortal other) { LinkedPortal = other; SetScreenRenderTexture(other._viewTexture); Logger.LogInfo("[DoorPortal] Linked portal " + MainEntrance.EntranceTeleport.GetLogInfo() + " -> " + other.MainEntrance.EntranceTeleport.GetLogInfo()); } public bool IsEnabled() { if (!ConfigManager.Portal_Enabled.Value) { return false; } if (PortalSettings == null || (Object)(object)LinkedPortal == (Object)null) { return false; } if (!PortalSettings.Enabled.Value) { return false; } if (!LinkedPortal.PortalSettings.Enabled.Value) { return false; } return true; } private void UpdateScreenVisibility() { if (!IsEnabled()) { _isLocalPlayerInRange = false; OnLocalPlayerExitRange(); return; } bool flag = IsLocalPlayerCameraInRange(); bool flag2 = CameraHelper.IsVisibleFromCamera((Renderer)(object)_screen, PlayerUtils.GetLocalPlayerCamera()); if (flag && flag2) { if (!_isLocalPlayerInRange) { _isLocalPlayerInRange = true; OnLocalPlayerEnterRange(); } } else if (_isLocalPlayerInRange) { _isLocalPlayerInRange = false; OnLocalPlayerExitRange(); } } private bool IsLocalPlayerCameraInRange() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) if (!PlayerUtils.TryGetLocalPlayerCamera(out var camera)) { return false; } float value = ConfigManager.Portal_ActivationRange.Value; Vector3 position = ((Component)camera).transform.position; float num = Vector3.Distance(position, _pivot.position); return num <= value; } private void OnLocalPlayerEnterRange() { SetDrawing(value: true); LinkedPortal.SetRendering(value: true); if (MainEntrance.IsOutside) { InteriorHelper.RenderInterior(); } else { LevelHelper.SetForceWeatherEffectsEnabled(value: true); } } private void OnLocalPlayerExitRange() { SetDrawing(value: false); LinkedPortal.SetRendering(value: false); if (!MainEntrance.IsOutside) { LevelHelper.SetForceWeatherEffectsEnabled(value: false); } } private void InitializePivot() { //IL_0012: 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) InitializePivot(PortalSettings.UseDynamicPivot, PortalSettings.PivotPositionOffset, PortalSettings.PivotRotationOffset); } public void InitializePivot(bool useDynamicPivot, Vector3 positionOffset, Vector3 rotationOffset) { //IL_0006: 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_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) _pivot.localPosition = Vector3.zero; _pivot.localRotation = Quaternion.identity; if (useDynamicPivot) { SetDynamicPivot(); } Transform pivot = _pivot; pivot.localPosition += positionOffset; Transform pivot2 = _pivot; Quaternion localRotation = _pivot.localRotation; pivot2.localRotation = Quaternion.Euler(((Quaternion)(ref localRotation)).eulerAngles + rotationOffset); } private void SetDynamicPivot() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) _pivotRaycastMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[2] { "Room", "Colliders" })); if (TryGetDynamicPivotPosition(out var position)) { _pivot.position = position; } if (TryGetDynamicPivotRotation(out var rotation)) { _pivot.rotation = rotation; } } private bool TryGetDynamicPivotPosition(out Vector3 position) { //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_0011: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0032: 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_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; Vector3 origin = _pivot.position + _pivot.forward * -0.25f; if (!TryRaycastForPivot(origin, _pivot.forward, out var hit)) { return false; } float num = -0.0015f; Vector3 val = ((RaycastHit)(ref hit)).point + _pivot.forward * num; if (TryRaycastForPivot(val, -_pivot.up, out var hit2, 5f)) { float num2 = ((Component)_screen).transform.lossyScale.y / 2f; float y = ((RaycastHit)(ref hit2)).point.y + num2; val.y = y; } position = val; return true; } private bool TryGetDynamicPivotRotation(out Quaternion rotation) { //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_0011: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0037: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_006e: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00bf: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00fd: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) rotation = Quaternion.identity; Vector3 val = _pivot.position + _pivot.forward * -0.25f; Vector3 forward = _pivot.forward; Vector3 origin = val + _pivot.right * -0.25f; if (!TryRaycastForPivot(origin, forward, out var hit)) { return false; } Vector3 origin2 = val + _pivot.right * 0.25f; if (!TryRaycastForPivot(origin2, forward, out var hit2)) { return false; } Vector3 val2 = ((RaycastHit)(ref hit)).normal + ((RaycastHit)(ref hit2)).normal; Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = ((RaycastHit)(ref hit2)).point - ((RaycastHit)(ref hit)).point; Vector3 normalized2 = ((Vector3)(ref val2)).normalized; Vector3 val3 = -normalized; val2 = Vector3.Cross(val3, normalized2); Vector3 normalized3 = ((Vector3)(ref val2)).normalized; rotation = Quaternion.LookRotation(val3, normalized3); return true; } private bool TryRaycastForPivot(Vector3 origin, Vector3 direction, out RaycastHit hit, float maxDistance = 1f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) return Physics.Raycast(origin, direction, ref hit, maxDistance, LayerMask.op_Implicit(_pivotRaycastMask), (QueryTriggerInteraction)1); } private void InitializeScreen() { ApplyScreenCrop(); } private void ApplyScreenCrop() { SetScreenCrop(PortalSettings.ScreenCrop); } public void SetScreenCrop(float left, float right, float top, float bottom) { SetScreenCrop(new Padding(left, right, top, bottom)); } public void SetScreenCrop(Padding padding, bool isUnityEditor = false) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) SetMaterialFloat("_CropLeft", padding.Left); SetMaterialFloat("_CropRight", padding.Right); SetMaterialFloat("_CropTop", padding.Top); SetMaterialFloat("_CropBottom", padding.Bottom); float num = 1f - padding.Left - padding.Right; float num2 = 1f - padding.Top - padding.Bottom; ((Component)_screenOccluder).transform.localScale = new Vector3(num, num2, 1f); float num3 = (padding.Left - padding.Right) * 0.5f; float num4 = (padding.Bottom - padding.Top) * 0.5f; Vector3 localPosition = ((Component)_screenOccluder).transform.localPosition; ((Component)_screenOccluder).transform.localPosition = new Vector3(num3, num4, localPosition.z); void SetMaterialFloat(string name, float value) { if (!isUnityEditor) { ((Renderer)_screen).material.SetFloat(name, value); } } } private void SetScreenRenderTexture(RenderTexture renderTexture) { ((Renderer)_screen).material.SetTexture("_MainTex", (Texture)(object)renderTexture); } private void SetDrawing(bool value) { _isDrawing = value; ((Component)_screen).gameObject.SetActive(value); UpdateDoor(); } private void InitializeCamera() { CreateViewTexture(); } private void ApplyCameraConfigSettings() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_004f: Unknown result type (might be due to invalid IL or missing references) bool value = ConfigManager.PortalGraphics_FogEnabled.Value; bool value2 = ConfigManager.PortalGraphics_CustomPassEnabled.Value; HDAdditionalCameraData component = ((Component)_portalCamera).GetComponent<HDAdditionalCameraData>(); component.customRenderingSettings = true; FrameSettings renderingPathCustomFrameSettings = component.renderingPathCustomFrameSettings; ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)27, value); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, value2); component.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; } private Size GetTargetViewTextureSize() { Size size; switch (ConfigManager.PortalGraphics_PixelResolution.Value) { case PixelResolutionType.PlayerCamera: return CameraHelper.GetCameraScreenSize(); case PixelResolutionType.Default: size = new Size(860, 520); break; case PixelResolutionType.Performance: size = new Size(620, 364); break; case PixelResolutionType.UltraPerformance: size = new Size(400, 260); break; case PixelResolutionType.Retro: size = new Size(186, 104); break; default: size = CameraHelper.GetCameraScreenSize(); break; } Size result = size; Size cameraScreenSize = CameraHelper.GetCameraScreenSize(); if (result.Width > cameraScreenSize.Width) { result.Width = cameraScreenSize.Width; } if (result.Height > cameraScreenSize.Height) { result.Height = cameraScreenSize.Height; } return result; } private void CreateViewTexture() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown Size targetSize = GetTargetViewTextureSize(); if (CanCreate()) { RenderTexture viewTexture = _viewTexture; if (viewTexture != null) { viewTexture.Release(); } RenderTextureDescriptor val = default(RenderTextureDescriptor); ((RenderTextureDescriptor)(ref val))..ctor(targetSize.Width, targetSize.Height); ((RenderTextureDescriptor)(ref val)).colorFormat = (RenderTextureFormat)0; ((RenderTextureDescriptor)(ref val)).depthStencilFormat = (GraphicsFormat)93; ((RenderTextureDescriptor)(ref val)).depthBufferBits = 32; ((RenderTextureDescriptor)(ref val)).msaaSamples = 1; ((RenderTextureDescriptor)(ref val)).mipCount = 0; ((RenderTextureDescriptor)(ref val)).useMipMap = false; ((RenderTextureDescriptor)(ref val)).autoGenerateMips = false; ((RenderTextureDescriptor)(ref val)).enableRandomWrite = false; ((RenderTextureDescriptor)(ref val)).useDynamicScale = false; ((RenderTextureDescriptor)(ref val)).sRGB = true; RenderTextureDescriptor val2 = val; _viewTexture = new RenderTexture(val2) { filterMode = (FilterMode)0 }; _viewTexture.Create(); Logger.LogInfo(string.Format("[{0}] {1}() width: {2}, height: {3}", "DoorPortal", "CreateViewTexture", targetSize.Width, targetSize.Height), extended: true); _portalCamera.targetTexture = _viewTexture; LinkedPortal?.SetScreenRenderTexture(_viewTexture); } bool CanCreate() { if ((Object)(object)_viewTexture == (Object)null) { return true; } if (((Texture)_viewTexture).width != targetSize.Width) { return true; } if (((Texture)_viewTexture).height != targetSize.Height) { return true; } return false; } } private bool IsRendering() { return _renderingContainer.activeSelf; } private void SetRendering(bool value) { _renderingContainer.SetActive(value); if (MainEntrance != null) { UpdateNightVision(); UpdateDoor(); } } private void UpdateNightVision() { if (MainEntrance != null && !MainEntrance.IsOutside) { ((Behaviour)_nightVision).enabled = IsRendering(); } } private void UpdatePortalCamera() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (IsRendering() && PlayerUtils.TryGetLocalPlayerCamera(out var camera)) { CreateViewTexture(); Transform transform = ((Component)LinkedPortal._screen).transform; Transform transform2 = ((Component)_screen).transform; Matrix4x4 val = transform.localToWorldMatrix * Matrix4x4.Rotate(Quaternion.Euler(0f, 180f, 0f)); Matrix4x4 val2 = transform2.localToWorldMatrix * Matrix4x4.Inverse(val); ((Component)_portalCamera).transform.SetPositionAndRotation(((Matrix4x4)(ref val2)).MultiplyPoint(((Component)camera).transform.position), ((Matrix4x4)(ref val2)).rotation * ((Component)camera).transform.rotation); _portalCamera.fieldOfView = camera.fieldOfView; SetFarClipPlane(); SetNearClipPlane(); LevelHelper.SetSunAndSkyEnabledThisFrame(MainEntrance.IsOutside); _portalCamera.Render(); LevelHelper.SetSunAndSkyEnabledThisFrame(!MainEntrance.IsOutside); } } private void SetFarClipPlane() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (MainEntrance != null) { float num = (PortalSettings.UseViewDistance.Value ? PortalSettings.ViewDistance.Value : ((!MainEntrance.IsOutside) ? ConfigManager.PortalGraphics_InsideViewDistance.Value : ConfigManager.PortalGraphics_OutsideViewDistance.Value)); float num2 = Vector3.Distance(((Component)_portalCamera).transform.position, ((Component)_screen).transform.position); _portalCamera.farClipPlane = num + num2; } } private void SetNearClipPlane() { NearClipPlaneMode value = ConfigManager.Debug_NearClipPlaneMode.Value; if (value == NearClipPlaneMode.ObliqueProjection) { SetObliqueNearClipPlane(); } else { SetDefaultNearClipPlane(); } } private void SetDefaultNearClipPlane() { //IL_0018: 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_0022: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)_screen).transform; Vector3 val = transform.InverseTransformPoint(((Component)_portalCamera).transform.position); MeshFilter component = ((Component)_screen).GetComponent<MeshFilter>(); Bounds? obj; if (component == null) { obj = null; } else { Mesh sharedMesh = component.sharedMesh; obj = ((sharedMesh != null) ? new Bounds?(sharedMesh.bounds) : null); } Bounds val2 = (Bounds)(((??)obj) ?? new Bounds(Vector3.zero, Vector3.one)); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(Mathf.Clamp(val.x, ((Bounds)(ref val2)).min.x, ((Bounds)(ref val2)).max.x), Mathf.Clamp(val.y, ((Bounds)(ref val2)).min.y, ((Bounds)(ref val2)).max.y), 0f); Vector3 val4 = transform.TransformPoint(val3); Vector3 val5 = val4 - ((Component)_portalCamera).transform.position; float num = Vector3.Dot(val5, ((Component)_portalCamera).transform.forward); _portalCamera.ResetProjectionMatrix(); _portalCamera.nearClipPlane = Mathf.Max(0.01f, num); } private void SetObliqueNearClipPlane() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) //IL_0066: 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_006c: 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_008e: 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) Transform transform = ((Component)_screen).transform; Plane val = default(Plane); ((Plane)(ref val))..ctor(-transform.forward, transform.position); Vector4 val2 = default(Vector4); ((Vector4)(ref val2))..ctor(((Plane)(ref val)).normal.x, ((Plane)(ref val)).normal.y, ((Plane)(ref val)).normal.z, ((Plane)(ref val)).distance); Vector4 val3 = Matrix4x4.Transpose(Matrix4x4.Inverse(_portalCamera.worldToCameraMatrix)) * val2; _portalCamera.nearClipPlane = 0.05f; _portalCamera.projectionMatrix = _portalCamera.CalculateObliqueMatrix(val3); } public static bool TryGetRenderingInstance(out DoorPortal doorPortal) { doorPortal = _instances.FirstOrDefault((DoorPortal x) => x.IsRendering()); return (Object)(object)doorPortal != (Object)null; } private void UpdateDoor() { if (MainEntrance != null) { if (IsRendering()) { MainEntrance.EntranceObjects.ViewBlocker.SetActive(false); } else { MainEntrance.EntranceObjects.ViewBlocker.SetActive(!_isDrawing); } if (ConfigManager.Debug_HideDoorObjects.Value) { MainEntrance.EntranceObjects.SetObjectsEnabled(value: false); } else { MainEntrance.EntranceObjects.SetObjectsEnabled(!IsRendering()); } } } private void ApplyConfigSettings() { ApplyCameraConfigSettings(); UpdateDoor(); bool value = ConfigManager.Debug_ExcludeFogBehindScreen.Value; GameObject fogExclusionZone = _fogExclusionZone; if (fogExclusionZone != null) { fogExclusionZone.SetActive(value); } } public static void OnConfigSettingsChanged() { foreach (DoorPortal instance in _instances) { instance.ApplyConfigSettings(); } } } public class WeatherAudioManager : MonoBehaviour { private readonly Dictionary<WeatherEffect, List<AudioSource>> _weatherAudioSources = new Dictionary<WeatherEffect, List<AudioSource>>(); public static WeatherAudioManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } private void Update() { UpdateWeatherAudio(); } private void UpdateWeatherAudio() { if (!((Object)(object)TimeOfDay.Instance == (Object)null)) { WeatherEffect[] effects = TimeOfDay.Instance.effects; foreach (WeatherEffect weatherEffect in effects) { UpdateWeatherAudioSources(weatherEffect); } } } private void UpdateWeatherAudioSources(WeatherEffect weatherEffect) { if (weatherEffect == null) { return; } bool mute = PlayerUtils.IsLocalPlayerCameraInsideInterior(); foreach (AudioSource item in GetAudioSourcesForWeather(weatherEffect)) { item.mute = mute; } } private List<AudioSource> GetAudioSourcesForWeather(WeatherEffect weatherEffect) { if (weatherEffect == null) { return new List<AudioSource>(); } if (_weatherAudioSources.TryGetValue(weatherEffect, out var value)) { return value; } GameObject effectObject = weatherEffect.effectObject; if ((Object)(object)effectObject == (Object)null) { return new List<AudioSource>(); } List<AudioSource> list = effectObject.GetComponentsInChildren<AudioSource>(true).ToList(); _weatherAudioSources[weatherEffect] = list; return list; } } } namespace com.github.zehsteam.ImmersiveEntrance.Managers { internal static class ConfigManager { public static ConfigFile ConfigFile { get; private set; } public static ConfigEntry<bool> Misc_ExtendedLogging { get; private set; } public static ConfigEntry<bool> Portal_Enabled { get; private set; } public static ConfigEntry<float> Portal_ActivationRange { get; private set; } public static ConfigEntry<PixelResolutionType> PortalGraphics_PixelResolution { get; private set; } public static ConfigEntry<float> PortalGraphics_OutsideViewDistance { get; private set; } public static ConfigEntry<float> PortalGraphics_InsideViewDistance { get; private set; } public static ConfigEntry<bool> PortalGraphics_FogEnabled { get; private set; } public static ConfigEntry<bool> PortalGraphics_WeatherEffectsEnabled { get; private set; } public static ConfigEntry<bool> PortalGraphics_CustomPassEnabled { get; private set; } public static ConfigEntry<bool> Debug_HideDoorObjects { get; private set; } public static ConfigEntry<bool> Debug_ExcludeFogBehindScreen { get; private set; } public static ConfigEntry<NearClipPlaneMode> Debug_NearClipPlaneMode { get; private set; } public static ConfigEntry<bool> Debug_UseSimulatedDeviceDepth { get; private set; } public static void Initialize(ConfigFile configFile) { ConfigFile = configFile; BindConfigs(); } private static void BindConfigs() { ConfigHelper.SkipAutoGen(); Misc_ExtendedLogging = ConfigHelper.Bind("Misc", "ExtendedLogging", defaultValue: false, "Enable extended logging."); Portal_Enabled = ConfigHelper.Bind("Portal", "Enabled", defaultValue: true, "Enable portals!"); Portal_ActivationRange = ConfigHelper.Bind("Portal", "ActivationRange", 10f, "The distance in meters the player needs to be within a portal for it to render.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("The rendering pixel resolution of portals."); stringBuilder.AppendLine("PlayerCamera = Automatically adjusts to the player camera's rendering resolution."); stringBuilder.AppendLine("Default = 860x520."); stringBuilder.AppendLine("Performance = 620x364."); stringBuilder.AppendLine("UltraPerformance = 400x260."); stringBuilder.AppendLine("Retro = 186x104."); PortalGraphics_PixelResolution = ConfigHelper.Bind("Portal Graphics", "PixelResolution", PixelResolutionType.PlayerCamera, stringBuilder.ToString()); PortalGraphics_OutsideViewDistance = ConfigHelper.Bind("Portal Graphics", "OutsideViewDistance", 250f, "The distance you can see through an outside portal.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.06f, 250f)); PortalGraphics_InsideViewDistance = ConfigHelper.Bind("Portal Graphics", "InsideViewDistance", 50f, "The distance you can see through an inside portal.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.06f, 100f)); PortalGraphics_FogEnabled = ConfigHelper.Bind("Portal Graphics", "FogEnabled", defaultValue: true, "Enable the rendering of fog."); PortalGraphics_WeatherEffectsEnabled = ConfigHelper.Bind("Portal Graphics", "WeatherEffectsEnabled", defaultValue: true, "Enable the rendering of weather effects."); PortalGraphics_CustomPassEnabled = ConfigHelper.Bind("Portal Graphics", "CustomPassEnabled", defaultValue: true, "Enable custom passes to render. This applies the Lethal Company signature shading to everything being viewed."); PortalGraphics_OutsideViewDistance.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; PortalGraphics_InsideViewDistance.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; PortalGraphics_FogEnabled.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; PortalGraphics_CustomPassEnabled.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; Debug_HideDoorObjects = ConfigHelper.Bind("Debug", "HideDoorObjects", defaultValue: false, "If enabled, will hide all of the door meshes and only show the portal screen."); Debug_ExcludeFogBehindScreen = ConfigHelper.Bind("Debug", "ExcludeFogBehindScreen", defaultValue: false, "If enabled, will exclude fog that is behind the portal screen from rendering."); Debug_NearClipPlaneMode = ConfigHelper.Bind("Debug", "NearClipPlaneMode", NearClipPlaneMode.Default, "The method the portal cameras use for calculating their near clip plane."); Debug_UseSimulatedDeviceDepth = ConfigHelper.Bind("Debug", "UseSimulatedDeviceDepth", defaultValue: true, ""); Debug_HideDoorObjects.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; Debug_ExcludeFogBehindScreen.SettingChanged += delegate { DoorPortal.OnConfigSettingsChanged(); }; } } internal static class EntranceDoorReplacementManager { [CompilerGenerated] private sealed class <>c__DisplayClass3_0 { public float delay; public GameObject gameObject; } public static void ReplaceDoor(MainEntranceData mainEntrance) { if (mainEntrance != null && !mainEntrance.IsOutside && PortalSettingsManager.InteriorDatabase.TryGetEntryForCurrentInterior(out var settings) && settings.HasDoorReplacement && settings.ReplaceDoor.Value) { ReplaceDoor(mainEntrance, settings.GetDoorReplacement()); } } private static void ReplaceDoor(MainEntranceData mainEntrance, EntranceDoorReplacement replacement) { if (mainEntrance != null && !((Object)(object)replacement == (Object)null)) { GameObject doorLeft = mainEntrance.EntranceObjects.DoorLeft; Transform val = ((doorLeft != null) ? doorLeft.transform : null); GameObject doorRight = mainEntrance.EntranceObjects.DoorRight; Transform val2 = ((doorRight != null) ? doorRight.transform : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { Logger.LogError("[EntranceDoorReplacementManager] Failed to replace main entrance door " + mainEntrance.EntranceTeleport.GetLogInfo() + " with " + ((Object)replacement).name + ". Could not find all of the original door objects."); } else { SpawnReplacementDoor(val, replacement.DoorLeft); SpawnReplacementDoor(val2, replacement.DoorRight); Logger.LogInfo("[EntranceDoorReplacementManager] Replaced main entrance door " + mainEntrance.EntranceTeleport.GetLogInfo() + " with " + ((Object)replacement).name, extended: true); } } } private static void SpawnReplacementDoor(Transform parent, GameObject prefab) { //IL_000e: 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) GameObject val = Object.Instantiate<GameObject>(prefab, parent); val.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); HideAfterDelay(((Component)parent).gameObject); } private static void HideAfterDelay(GameObject gameObject, float delay = 0.1f) { <>c__DisplayClass3_0 CS$<>8__locals0 = new <>c__DisplayClass3_0(); CS$<>8__locals0.delay = delay; CS$<>8__locals0.gameObject = gameObject; CoroutineRunner.Start(Coroutine()); [IteratorStateMachine(typeof(<>c__DisplayClass3_0.<<HideAfterDelay>g__Coroutine|0>d))] IEnumerator Coroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass3_0.<<HideAfterDelay>g__Coroutine|0>d(0) { <>4__this = CS$<>8__locals0 }; } } } internal static class EntranceManager { private static bool _linkedMainEntrancePortals; public static MainEntranceData OutsideMainEntrance { get; private set; } public static MainEntranceData InsideMainEntrance { get; private set; } public static void Reset() { OutsideMainEntrance?.Reset(); InsideMainEntrance?.Reset(); _linkedMainEntrancePortals = false; } public static void SpawnDoorPortal(EntranceTeleport entranceTeleport) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)entranceTeleport == (Object)null || !entranceTeleport.IsMainEntrance()) { return; } Logger.LogInfo("[EntranceManager] Attempting to spawn main entrance door portal! " + entranceTeleport.GetLogInfo()); MainEntranceData mainEntranceData; if (entranceTeleport.IsOutside()) { if (OutsideMainEntrance == null) { OutsideMainEntrance = new MainEntranceData(); } OutsideMainEntrance.Reset(); mainEntranceData = OutsideMainEntrance; } else { if (InsideMainEntrance == null) { InsideMainEntrance = new MainEntranceData(); } InsideMainEntrance.Reset(); mainEntranceData = InsideMainEntrance; } mainEntranceData.EntranceTeleport = entranceTeleport; mainEntranceData.EntranceObjects = EntranceObjectsHelper.GetEntranceObjects(entranceTeleport); if (!mainEntranceData.EntranceObjects.IsValid()) { Logger.LogWarning("[EntranceManager] Failed to spawn main entrance door portal. Could not find all entrance objects. " + entranceTeleport.GetLogInfo()); mainEntranceData.EntranceObjects.LogMissingObjects(); mainEntranceData?.Reset(); return; } GameObject val = Object.Instantiate<GameObject>(Assets.DoorPortalPrefab, ((Component)entranceTeleport).transform); val.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); Vector3 localScale = Assets.DoorPortalPrefab.transform.localScale; val.transform.SetLossyScale(localScale); DoorPortal doorPortal = (mainEntranceData.DoorPortal = val.GetComponent<DoorPortal>()); doorPortal.SetMainEntranceData(mainEntranceData); Logger.LogInfo("[EntranceManager] Successfully spawned main entrance door portal! " + entranceTeleport.GetLogInfo()); EntranceDoorReplacementManager.ReplaceDoor(mainEntranceData); } public static void LinkMainEntrancePortals() { if (_linkedMainEntrancePortals) { return; } _linkedMainEntrancePortals = true; Logger.LogInfo("[EntranceManager] Attempting to link main entrance portals."); if (OutsideMainEntrance == null) { Logger.LogError("[EntranceManager] Failed to link main entrance portals. OutsideMainEntrance is null."); return; } if (InsideMainEntrance == null) { Logger.LogError("[EntranceManager] Failed to link main entrance portals. InsideMainEntrance is null."); return; } bool flag = true; if (!OutsideMainEntrance.HasDoorPortal) { Logger.LogError("[EntranceManager] Failed to link main entrance portals. Outside door portal was not spawned."); flag = false; } if (!InsideMainEntrance.HasDoorPortal) { Logger.LogError("[EntranceManager] Failed to link main entrance portals. Inside door portal was not spawned."); flag = false; } if (!flag) { if (OutsideMainEntrance.HasDoorPortal) { Object.Destroy((Object)(object)((Component)OutsideMainEntrance.DoorPortal).gameObject); Logger.LogInfo("[EntranceManager] Despawned outside door portal."); } if (InsideMainEntrance.HasDoorPortal) { Object.Destroy((Object)(object)((Component)InsideMainEntrance.DoorPortal).gameObject); Logger.LogInfo("[EntranceManager] Despawned inside door portal."); } } else { OutsideMainEntrance.DoorPortal.LinkPortal(InsideMainEntrance.DoorPortal); InsideMainEntrance.DoorPortal.LinkPortal(OutsideMainEntrance.DoorPortal); Logger.LogInfo("[EntranceManager] Successfully linked main entrance portals!"); } } } internal static class PortalSettingsManager { private static readonly MoonPortalSettingsDatabase _predefinedMoonDatabase; private static readonly InteriorPortalSettingsDatabase _predefinedInteriorDatabase; private static bool _initialized; public static MoonPortalSettingsDatabase MoonDatabase { get; private set; } public static InteriorPortalSettingsDatabase InteriorDatabase { get; private set; } static PortalSettingsManager() { MoonDatabase = new MoonPortalSettingsDatabase(); InteriorDatabase = new InteriorPortalSettingsDatabase(); _predefinedMoonDatabase = new MoonPortalSettingsDatabase(); _predefinedInteriorDatabase = new InteriorPortalSettingsDatabase(); AddPredefinedEntries(); } private static void AddPredefinedEntries() { AddPredefinedMoonEntries(); AddPredefinedInteriorEntries(); AddMonesInteriorsSettings(); AddSlaughterhouseSettings(); } private static void AddPredefinedMoonEntries() { //IL_001b: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) ((PortalSettingsDatabase<MoonPortalSettings>)_predefinedMoonDatabase).AddEntry(new MoonPortalSettings("41 Experimentation", new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: false, (Vector3?)new Vector3(0.02f, 0.03417349f, 0.203743f), (Vector3?)null, (Padding?)null, (float?)null))); ((PortalSettingsDatabase<MoonPortalSettings>)_predefinedMoonDatabase).AddEntry(new MoonPortalSettings("56 Vow", new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, (Vector3?)new Vector3(0.04f, 0f, 0f), (Vector3?)null, (Padding?)null, (float?)null))); ((PortalSettingsDatabase<MoonPortalSettings>)_predefinedMoonDatabase).AddEntry(new MoonPortalSettings("61 March", new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: false, (Vector3?)new Vector3(0.063f, 0.081f, 0.209f), (Vector3?)new Vector3(0f, -0.017f, 0f), (Padding?)new Padding(0f, 0f, 0.03f, 0f), (float?)null))); MoonPortalSettingsDatabase predefinedMoonDatabase = _predefinedMoonDatabase; float? viewDistance = 75f; ((PortalSettingsDatabase<MoonPortalSettings>)predefinedMoonDatabase).AddEntry(new MoonPortalSettings("85 Rend", new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, null, null, null, viewDistance))); MoonPortalSettingsDatabase predefinedMoonDatabase2 = _predefinedMoonDatabase; Vector3? pivotPositionOffset = new Vector3(0.06f, 0f, 0f); Padding? screenCrop = new Padding(0f, 0f, 0.03f, 0f); ((PortalSettingsDatabase<MoonPortalSettings>)predefinedMoonDatabase2).AddEntry(new MoonPortalSettings("7 Dine", new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, pivotPositionOffset, null, screenCrop))); } private static void AddPredefinedInteriorEntries() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) ((PortalSettingsDatabase<InteriorPortalSettings>)_predefinedInteriorDatabase).AddEntry(new InteriorPortalSettings(InteriorType.Facility, new InteriorPortalSettings.InteriorDefaultValues(), new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: false, (Vector3?)new Vector3(-0.1f, 0.03f, 0.067f), (Vector3?)null, (Padding?)null, (float?)null))); InteriorPortalSettingsDatabase predefinedInteriorDatabase = _predefinedInteriorDatabase; InteriorPortalSettings.InteriorDefaultValues interiorDefaultValues = new InteriorPortalSettings.InteriorDefaultValues(() => Assets.MansionEntranceDoorReplacement); Vector3? pivotPositionOffset = new Vector3(-0.011f, 0f, 0f); Padding? screenCrop = new Padding(0.05f, 0.05f, 0.025f, 0f); ((PortalSettingsDatabase<InteriorPortalSettings>)predefinedInteriorDatabase).AddEntry(new InteriorPortalSettings(InteriorType.Mansion, interiorDefaultValues, new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, pivotPositionOffset, null, screenCrop))); InteriorPortalSettingsDatabase predefinedInteriorDatabase2 = _predefinedInteriorDatabase; InteriorPortalSettings.InteriorDefaultValues interiorDefaultValues2 = new InteriorPortalSettings.InteriorDefaultValues(); Vector3? pivotPositionOffset2 = new Vector3(-0.09f, 0f, 0f); screenCrop = new Padding(0f, 0f, 0.04f, 0f); float? viewDistance = 30f; ((PortalSettingsDatabase<InteriorPortalSettings>)predefinedInteriorDatabase2).AddEntry(new InteriorPortalSettings(InteriorType.Mineshaft, interiorDefaultValues2, new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, pivotPositionOffset2, null, screenCrop, viewDistance))); } private static void AddMonesInteriorsSettings() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) InteriorPortalSettingsDatabase predefinedInteriorDatabase = _predefinedInteriorDatabase; InteriorPortalSettings.InteriorDefaultValues interiorDefaultValues = new InteriorPortalSettings.InteriorDefaultValues(); Vector3? pivotPositionOffset = new Vector3(-0.055f, 0f, 0f); Padding? screenCrop = new Padding(0.026f, 0.026f, 0.026f, 0f); ((PortalSettingsDatabase<InteriorPortalSettings>)predefinedInteriorDatabase).AddEntry(new InteriorPortalSettings("EndlessHallDunFlow", interiorDefaultValues, new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, pivotPositionOffset, null, screenCrop))); InteriorPortalSettingsDatabase predefinedInteriorDatabase2 = _predefinedInteriorDatabase; InteriorPortalSettings.InteriorDefaultValues interiorDefaultValues2 = new InteriorPortalSettings.InteriorDefaultValues(() => Assets.MansionEntranceDoorReplacement); Vector3? pivotPositionOffset2 = new Vector3(-0.011f, 0f, 0f); screenCrop = new Padding(0.05f, 0.05f, 0.025f, 0f); ((PortalSettingsDatabase<InteriorPortalSettings>)predefinedInteriorDatabase2).AddEntry(new InteriorPortalSettings("HauntedHotelDunFlow", interiorDefaultValues2, new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, pivotPositionOffset2, null, screenCrop))); } private static void AddSlaughterhouseSettings() { InteriorPortalSettingsDatabase predefinedInteriorDatabase = _predefinedInteriorDatabase; InteriorPortalSettings.InteriorDefaultValues interiorDefaultValues = new InteriorPortalSettings.InteriorDefaultValues(); float? viewDistance = 100f; ((PortalSettingsDatabase<InteriorPortalSettings>)predefinedInteriorDatabase).AddEntry(new InteriorPortalSettings("SlaughterhouseFlow", interiorDefaultValues, new PortalSettings.DefaultValues(enabled: true, useDynamicPivot: true, null, null, null, viewDistance))); } public static void Initialize() { if (!_initialized) { _initialized = true; PopulateEntries(); BindConfigs(); } } private static void PopulateEntries() { PopulateMoonEntries(); PopulateInteriorEntries(); } private static void BindConfigs() { InteriorDatabase.BindConfigs(); MoonDatabase.BindConfigs(); } private static void PopulateMoonEntries() { if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError("[PortalSettingsManager] Failed to populate moon entries. StartOfRound instance is null."); return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel level in levels) { AddMoonEntry(level); } } private static void PopulateInteriorEntries() { if ((Object)(object)RoundManager.Instance == (Object)null) { Logger.LogError("[PortalSettingsManager] Failed to populate interior entries. RoundManager instance is null."); return; } IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes; foreach (IndoorMapType val in dungeonFlowTypes) { AddInteriorEntry(val.dungeonFlow); } } private static bool AddMoonEntry(SelectableLevel level) { if (_predefinedMoonDatabase.TryGetEntry(level, out var settings)) { return ((PortalSettingsDatabase<MoonPortalSettings>)MoonDatabase).AddEntry(settings); } return MoonDatabase.AddEntry(level); } private static bool AddInteriorEntry(DungeonFlow dungeonFlow) { if (_predefinedInteriorDatabase.TryGetEntry(dungeonFlow, out var settings)) { return ((PortalSettingsDatabase<InteriorPortalSettings>)InteriorDatabase).AddEntry(settings); } return InteriorDatabase.AddEntry(dungeonFlow); } } } namespace com.github.zehsteam.ImmersiveEntrance.Helpers { internal static class CameraHelper { public static bool IsVisibleFromCamera(Renderer renderer, Camera camera) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)renderer == (Object)null || (Object)(object)camera == (Object)null) { return false; } Plane[] array = GeometryUtility.CalculateFrustumPlanes(camera); return GeometryUtility.TestPlanesAABB(array, renderer.bounds); } public static Size GetCameraScreenSize() { IngamePlayerSettings instance = IngamePlayerSettings.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.playerGameplayScreenTex != (Object)null) { return new Size(((Texture)instance.playerGameplayScreenTex).width, ((Texture)instance.playerGameplayScreenTex).height); } return new Size(860, 520); } } internal static class ConfigHelper { public static void SkipAutoGen() { if (LethalConfigProxy.IsInstalled) { LethalConfigProxy.SkipAutoGen(); } } public static void AddButton(string section, string name, string buttonText, string description, Action callback) { if (LethalConfigProxy.IsInstalled) { LethalConfigProxy.AddButton(section, name, buttonText, description, callback); } } public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description, bool requiresRestart = false, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null) { if (configFile == null) { configFile = ConfigManager.ConfigFile; } ConfigEntry<T> configEntry = configFile.Bind(section, key, defaultValue, description, acceptableValues); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.IsInstalled) { LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart); } return configEntry; } } internal static class CustomPassHelper { public static GameObject OldVolume { get; private set; } public static GameObject NewVolume { get; private set; } public static CustomPass OldPass { get; private set; } public static CustomPass NewPass { get; private set; } public static void ReplaceVanillaCustomPass() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) OldVolume = GameObject.Find("CustomPass (1)"); Transform parent = OldVolume.transform.parent; CustomPassVolume component = OldVolume.GetComponent<CustomPassVolume>(); NewVolume = new GameObject("ImmersiveEntrance CustomPass"); NewVolume.transform.SetParent(parent); CustomPassVolume val = NewVolume.AddComponent<CustomPassVolume>(); val.injectionPoint = (CustomPassInjectionPoint)1; NewPass = (CustomPass)(object)new PosterizationCustomPass(); val.customPasses.Add(NewPass); foreach (CustomPass customPass in component.customPasses) { if (customPass.name == "LethalSponge") { OldPass = customPass; OldPass.enabled = false; break; } } } } internal static class EntranceObjectsHelper { private static TransformFindOptions _transformFindOptions; static EntranceObjectsHelper() { _transformFindOptions = new TransformFindOptions(onlyEnabled: true, null, new int[2] { LayerMask.NameToLayer("MapRadar"), LayerMask.NameToLayer("ScanNode") }); } public static EntranceObjects GetEntranceObjects(EntranceTeleport entranceTeleport) { if ((Object)(object)entranceTeleport == (Object)null) { return new EntranceObjects(); } Transform visualDoorsContainer = GetVisualDoorsContainer(entranceTeleport); if ((Object)(object)visualDoorsContainer == (Object)null) { return new EntranceObjects { IsOutside = entranceTeleport.IsOutside() }; } return new EntranceObjects { IsOutside = entranceTeleport.IsOutside(), ViewBlocker = GetViewBlocker(entranceTeleport, visualDoorsContainer), DoorFrame = GetDoorFrame(entranceTeleport, visualDoorsContainer), DoorLeft = GetDoorLeft(entranceTeleport, visualDoorsContainer), DoorRight = GetDoorRight(entranceTeleport, visualDoorsContainer) }; } private static GameObject GetViewBlocker(EntranceTeleport entranceTeleport, Transform visualDoorsContainer) { if (TryGetViewBlockerFromParent(((Component)entranceTeleport).transform, out var result)) { return ((Component)result).gameObject; } if (TryGetViewBlockerFromParent(visualDoorsContainer, out result)) { return ((Component)result).gameObject; } if (entranceTeleport.IsOutside() && TryGetViewBlockerFromParent(((Component)entranceTeleport).transform.parent, out result)) { return ((Component)result).gameObject; } if (!entranceTeleport.IsOutside()) { return null; } if (!LevelHelper.TryGetEnvironment(out var result2)) { return null; } if (TryGetViewBlockerFromParent(result2.transform, out result)) { return ((Component)result).gameObject; } if (result2.transform.TryFind("MainFactory", out var result3) && TryGetViewBlockerFromParent(result3, out result)) { return ((Component)result).gameObject; } return null; } private static GameObject GetDoorFrame(EntranceTeleport entranceTeleport, Transform visualDoorsContainer) { if (TryGetDoorFrameFromParent(((Component)entranceTeleport).transform, out var result)) { return ((Component)result).gameObject; } if (TryGetDoorFrameFromParent(visualDoorsContainer, out result)) { return ((Component)result).gameObject; } if (!entranceTeleport.IsOutside()) { return null; } if (!LevelHelper.TryGetEnvironment(out var result2)) { return null; } if (TryGetDoorFrameFromParent(result2.transform, out result)) { return ((Component)result).gameObject; } if (result2.transform.TryFind("MainFactory", out var result3) && TryGetDoorFrameFromParent(result3, out result)) { return ((Component)result).gameObject; } return null; } private static GameObject GetDoorLeft(EntranceTeleport entranceTeleport, Transform visualDoorsContainer) { if (TryGetDoorLeftFromParent(visualDoorsContainer, out var result)) { return ((Component)result).gameObject; } return null; } private static GameObject GetDoorRight(EntranceTeleport entranceTeleport, Transform visualDoorsContainer) { if (TryGetDoorRightFromParent(visualDoorsContainer, out var result)) { return ((Component)result).gameObject; } return null; } private static bool TryGetViewBlockerFromParent(Transform parent, out Transform result) { if ((Object)(object)parent == (Object)null) { result = null; return false; } return parent.TryFindFirst(new <>z__ReadOnlyArray<string>(new string[2] { "Plane", "LightBehindDoor" }), out result, _transformFindOptions); } private static bool TryGetDoorFrameFromParent(Transform parent, out Transform result) { if ((Object)(object)parent == (Object)null) { result = null; return false; } retur