Decompiled source of UltraPortal v0.2.2
plugins/UltraPortal/UltraPortal.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using AUU; using AUU.Portals; using BepInEx; using BepInEx.Logging; using Configgy; using HarmonyLib; using Sandbox; using ULTRAKILL.Portal; using ULTRAKILL.Portal.Native; using UltraPortal.Colorizers; using UltraPortal.Extensions; using UltraPortal.Projectiles; using UltraPortal.Shared; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UltraPortal")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UltraPortal")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("E06BCEE7-CB1F-477B-B385-AF8D67AD477C")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace UltraPortal { public class AudioManager : MonoSingleton<AudioManager> { public AudioSource PlayAudioFromAsset(string assetName, Vector3 emitterPositon, bool loop = false, float minDistance = 1f, float maxDistance = 100f, float spatialBlend = 1f) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0054: Expected O, but got Unknown AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "audio"); AudioClip val2 = val.LoadAsset<AudioClip>(assetName); if (!Object.op_Implicit((Object)(object)val2)) { return null; } GameObject val3 = new GameObject("Temporary Audio Source (" + assetName + ")"); val3.transform.position = emitterPositon; GameObject val4 = val3; AudioSource val5 = val4.AddComponent<AudioSource>(); val5.outputAudioMixerGroup = MonoSingleton<AudioMixerController>.Instance.goreGroup; val5.volume = MonoSingleton<AudioMixerController>.Instance.sfxVolume; val5.minDistance = minDistance; val5.maxDistance = maxDistance; val5.rolloffMode = (AudioRolloffMode)1; val5.spatialBlend = spatialBlend; val5.clip = val2; val5.loop = loop; AudioSourceExtensions.Play(val5, true); if (!loop) { Object.Destroy((Object)(object)val4, val2.length + 0.2f); } return val5; } } public static class Constants { public static class AssetPaths { public static class Sfx { public const string BundleName = "audio"; public const string PortalOpen = "Portal Open"; public const string PortalClose = "Portal Close"; public const string PortalAmbiance = "Portal Ambiance"; } public static bool UseAltBundlePath; public const string PortalBundle = "portals"; public const string WeaponBundle = "weapons"; public const string DebugBundle = "debug"; public const string PortalExit = "Portal Exit"; public const string Mirror = "Mirror"; public const string PortalGun = "Portal Gun"; public const string MirrorGun = "Mirror Gun"; public const string TwistGun = "Twist Gun Variant"; public const string Projectile = "Projectile"; public const string PortalGunIcon = "UltraPortalGunIcon"; public const string PortalGunIconGlow = "UltraPortalGunIconGlow"; public const string Explosion = "Explosion"; public const string DebugForwardArrow = "ForwardArrow"; public const string UltraPortalSharedAssembly = "UltraPortal.Shared"; public static string AssemblyPath => Assembly.GetExecutingAssembly().Location; public static string AssemblyFolderPath => Path.GetDirectoryName(AssemblyPath); public static string BundlePath { get { if (UseAltBundlePath) { return AssemblyFolderPath; } return Path.Combine(AssemblyFolderPath, "Bundles"); } } } private static LayerMask _environmentLayer = LayerMask.op_Implicit(-1); private static LayerMask _travellerLayer = LayerMask.op_Implicit(-1); public const string PortalExplosionWeapon = "dynamicportal"; public const string PortalProjectileWeapon = "portalprojectile"; public const string StyleSafetyHazardId = "style.ultraportal.safetyhazard"; public const string StyleSafetyHazardName = "SAFETY HAZARD"; public const int StyleSafetyHazardPoints = 100; public const string StylePortalProjectileId = "style.ultraportal.projectiled"; public const string StylePortalProjectileName = "DISPLACEMENT"; public const int StylePortalProjectilePoints = 25; private static Camera _mainCamera; public static LayerMask EnvironmentLayer { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (LayerMask.op_Implicit(_environmentLayer) == -1) { _environmentLayer = LayerMaskDefaults.Get((LMD)1); } return _environmentLayer; } } public static LayerMask TravellerLayer { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (LayerMask.op_Implicit(_travellerLayer) == -1) { _travellerLayer = LayerMaskDefaults.Get((LMD)7); } return _travellerLayer; } } public static int PortalLayer => 30; public static int ItemLayer => 22; public static Camera MainCamera { get { if (!Object.op_Implicit((Object)(object)_mainCamera)) { _mainCamera = Camera.main; } return _mainCamera; } } } public static class ModConfig { private const string RequiresLevelReload = "Requires restart of current level!"; [Configgable("Controls", "Portal Gun Slot", 0, null)] public static ConfigKeybind PortalGunKeybind = new ConfigKeybind((KeyCode)55); [Configgable("Controls", "Close Portals With Mouse", 0, "By default, you can close portals by pressing the primary and alternative fire at once, toggling this option off changes it to a keybind on your keyboard.")] public static ConfigToggle CloseWithMouse = new ConfigToggle(true); [Configgable("Controls", null, 0, null)] public static ConfigKeybind AltCloseKeybind = new ConfigKeybind((KeyCode)0); [Configgable("Debugging", "Verbose Logging", 0, "Toggling this option allows the mod to log extra, often excessive, information to the BepInEx console. It may lead to severe performance issues. So only toggle it if you're debugging!")] public static ConfigToggle VerboseLogging = new ConfigToggle(false); [Configgable("Debugging", "Unload Asset Bundles", 0, "Only use if you intend to swap out asset bundles in real time!")] public static ConfigButton UnloadAssetBundles = new ConfigButton((Action)AssetBundleUtils.UnloadAllAssetBundles, (string)null); [Configgable("Debugging", "New Gravity", 0, null)] private static ConfigVector3 _newGravity = new ConfigVector3(Vector3.down * -40f, (Func<Vector3, bool>)null); [Configgable("Debugging", "Draw Debug Arrows", 0, null)] public static ConfigToggle DrawDebugObjects = new ConfigToggle(false); [Configgable("Debugging", "Set Gravity", 0, null)] private static ConfigButton _setGravity = new ConfigButton((Action)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) PortalGunManager.UsedPortalGun = true; MonoSingleton<NewMovement>.Instance.SwitchGravity(((ConfigValueElement<Vector3>)(object)_newGravity).GetValue(), true, true); }, (string)null); [Configgable("Gameplay", null, 0, null)] public static ConfigToggle UseOtherPortalForProjectileTeleport = new ConfigToggle(true); [Configgable("Visuals/Guns/Portal Gun", null, 0, null)] public static ConfigColor PrimaryPortalColor = new ConfigColor(new Color(84f / 85f, 1f / 85f, 23f / 85f)); [Configgable("Visuals/Guns/Portal Gun/Particles", null, 0, null)] public static ConfigColor PrimaryPortalParticleColor = new ConfigColor(new Color(0.5803922f, 8f / 85f, 19f / 85f)); [Configgable("Visuals/Guns/Portal Gun", null, 0, null)] public static ConfigColor SecondaryPortalColor = new ConfigColor(new Color(0.18039216f, 0.23529412f, 1f)); [Configgable("Visuals/Guns/Portal Gun/Particles", null, 0, null)] public static ConfigColor SecondaryPortalParticleColor = new ConfigColor(new Color(0.101960786f, 0.11764706f, 0.36078432f)); [Configgable("Visuals/Guns/Mirror Gun", null, 0, null)] public static ConfigColor PrimaryMirrorColor = new ConfigColor(new Color(0f, 1f, 0.369f)); [Configgable("Visuals/Guns/Mirror Gun/Particles", null, 0, null)] public static ConfigColor PrimaryMirrorParticleColor = new ConfigColor(new Color(0f, 0.639f, 0.235f)); [Configgable("Visuals/Guns/Mirror Gun", null, 0, null)] public static ConfigColor FlippedMirrorColor = new ConfigColor(new Color(1f, 0.78f, 0f)); [Configgable("Visuals/Guns/Mirror Gun/Particles", null, 0, null)] public static ConfigColor FlippedMirrorParticleColor = new ConfigColor(new Color(0.741f, 0.58f, 0f)); [Configgable("Visuals/Guns/Twist Gun", null, 0, null)] public static ConfigColor PrimaryTwistColor = new ConfigColor(new Color(1f, 0f, 0f)); [Configgable("Visuals/Guns/Twist Gun/Particles", null, 0, null)] public static ConfigColor PrimaryTwistParticleColor = new ConfigColor(new Color(0.8f, 0f, 0f)); [Configgable("Visuals/Guns/Twist Gun", null, 0, null)] public static ConfigColor SecondaryTwistColor = new ConfigColor(new Color(1f, 1f, 1f)); [Configgable("Visuals/Guns/Twist Gun/Particles", null, 0, null)] public static ConfigColor SecondaryTwistParticleColor = new ConfigColor(new Color(0.8f, 0.8f, 0.8f)); [Configgable("Visuals", null, 0, null)] public static ConfigColor ExplosionColor = new ConfigColor(new Color(0.35686f, 0.02745f, 0.45098f)); [Configgable("Visuals", null, 0, null)] public static IntegerSlider ExplosionEmissionIntensity = new IntegerSlider(-1, -5, 5); [Configgable("Visuals/Portals", null, 1, null)] public static ConfigToggle CanSeePortalBorders = new ConfigToggle(true); [Configgable("Visuals/Portals", "Emission On Portal Border", 0, null)] public static ConfigToggle UseEmission = new ConfigToggle(true); [Configgable("Visuals/Portals", null, 0, null)] public static ConfigToggle ShowPortalSpawnParticles = new ConfigToggle(true); [Configgable("Visuals/Portals", null, 0, null)] public static ConfigToggle ShowPortalAmbianceParticles = new ConfigToggle(true); [Configgable("Visuals/Portals", "Infinite Portal Recursions?", 0, "Requires restart of current level!")] public static ConfigToggle InfiniteRecursions = new ConfigToggle(false); [Configgable("Visuals/Portals", "Maximum Portal Recursions", 0, "Requires restart of current level!")] public static IntegerSlider MaxPortalRecursions = new IntegerSlider(3, 0, 10); [Configgable("Visuals/Style", null, 0, null)] public static ConfigColor SafetyHazardColor = new ConfigColor(new Color(1f, 0f, 0f)); [Configgable("Visuals/Style", null, 0, null)] public static ConfigColor ProjectileBonusColor = new ConfigColor(new Color(0f, 1f, 0f)); [Configgable("Gameplay/Guns/Experimental", "Projectile Speed", 0, null)] public static ConfigInputField<float> PortalProjectileSpeed = new ConfigInputField<float>(95f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Guns", null, 0, null)] public static ConfigToggle UseBeamForProjectiles = new ConfigToggle(false); [Configgable("Gameplay", null, 0, null)] public static ConfigToggle AreExplosionsUltraboosters = new ConfigToggle(false); [Configgable("", "Enabled", 0, null)] public static ConfigToggle IsEnabled = new ConfigToggle(true); [Configgable("Gameplay/Portals", "Portal Scale Modifier", 0, "Requires restart of current level!")] public static ConfigInputField<float> PortalScaleMod = new ConfigInputField<float>(1f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Guns/Experimental", null, 0, null)] public static ConfigInputField<float> ProjectileEnemyGroundPortalBoostMultiplier = new ConfigInputField<float>(0.5f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Guns/Experimental", null, 0, null)] public static ConfigInputField<float> ProjectileEnemyNormalPortalBoostMultiplier = new ConfigInputField<float>(2f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", "Minimum Entry/Exit Speed", 0, "Requires restart of current level!")] public static ConfigInputField<float> MinimumEntryExitSpeed = new ConfigInputField<float>(20f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", null, 0, "The required dot product threshold for a portal to be determined perpendicular to a collider.")] public static ConfigInputField<float> PerpendicularThreshold = new ConfigInputField<float>(0.01f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", null, 0, "An assisted portal is a portal with special checks to ensure functionality for ground portals.")] public static ConfigInputField<float> AssistedPortalThreshold = new ConfigInputField<float>(0.6f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", null, 0, "The size of a sphere, which checks colliders around a portal")] public static ConfigInputField<float> PortalSphereCheckRadius = new ConfigInputField<float>(1.5f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", "Portal Wall Offset", 0, null)] public static ConfigInputField<float> PortalWallOffset = new ConfigInputField<float>(0.5f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Gameplay/Portals/Experimental", "Enemy Velocity Threshold", 0, "The threshold an enemy's velocity has to cross for the portals to disable the associated rigidbody. To be fully transparent: this is a temporary solution to make +TERMINAL VELOCITY function reliably for this update. We are working on fixing it in future versions of ULTRAPORTAL.")] public static ConfigInputField<float> EnemyMaxVelocity = new ConfigInputField<float>(80f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Audio", "Hear Ambiance SFX", 0, null)] public static ConfigToggle CanHearAmbiance = new ConfigToggle(true); [Configgable("Audio", "Hear Portal SFX", 0, "This means sound effects such as portals opening and closing.")] public static ConfigToggle CanHearSFX = new ConfigToggle(true); [Configgable("Audio", "Portal Ambiance Minimum Distance", 0, "The radius from the portal where the ambiance is loudest.")] public static ConfigInputField<float> PortalAmbianceMinDistance = new ConfigInputField<float>(10f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); [Configgable("Audio", "Portal Ambiance Maximum Distance", 0, "The radius from the portal where the ambiance is no longer audible.")] public static ConfigInputField<float> PortalAmbianceMaxDistance = new ConfigInputField<float>(30f, (Func<float, bool>)null, (Func<string, ValueTuple<bool, float>>)null); } [HarmonyPatch] public static class EnemyPatches { public static List<EnemyIdentifier> AlreadyAppliedStyle = new List<EnemyIdentifier>(); private static void ApplyStyleBonus(EnemyIdentifier eid, string id, int points, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) DebugUtils.LogVerboseInfo("using style: " + id); MonoSingleton<StyleHUD>.Instance.AddPoints(points, id, (GameObject)null, (EnemyIdentifier)null, -1, "<color=#" + ColorUtility.ToHtmlStringRGB(color) + ">", "</color>"); AlreadyAppliedStyle.Add(eid); } [HarmonyPostfix] [HarmonyPatch(typeof(EnemyIdentifier), "DeliverDamage")] public static void DeliverDamagePatch(EnemyIdentifier __instance) { //IL_004b: 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) if (!AlreadyAppliedStyle.Contains(__instance)) { DebugUtils.LogVerboseInfo("checking if enemy qualifies for style bonuses; name: " + ((Object)__instance).name); if (__instance.hitterWeapons.Contains("dynamicportal")) { ApplyStyleBonus(__instance, "style.ultraportal.safetyhazard", 100, ((ConfigValueElement<Color>)(object)ModConfig.SafetyHazardColor).GetValue()); } if (__instance.hitterWeapons.Contains("portalprojectile")) { ApplyStyleBonus(__instance, "style.ultraportal.projectiled", 25, ((ConfigValueElement<Color>)(object)ModConfig.ProjectileBonusColor).GetValue()); } } } } [HarmonyPatch] public static class PlayerPatches { public static bool RespawnFlag { get; private set; } [HarmonyPrefix] [HarmonyPatch(typeof(NewMovement), "Respawn")] private static void RespawnPatch() { PortalGun portalGun = Object.FindObjectOfType<PortalGun>(true); if (Object.op_Implicit((Object)(object)portalGun)) { portalGun.Reset(); } MirrorGun mirrorGun = Object.FindObjectOfType<MirrorGun>(true); if (Object.op_Implicit((Object)(object)mirrorGun)) { mirrorGun.Reset(); } TwistGun twistGun = Object.FindObjectOfType<TwistGun>(true); if (Object.op_Implicit((Object)(object)twistGun)) { twistGun.Reset(); } } [HarmonyPrefix] [HarmonyPatch(typeof(NewMovement), "Update")] private static void UpdatePatch() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if ((double)((Component)MonoSingleton<NewMovement>.Instance).transform.position.y < -100000.0) { if (!RespawnFlag) { RespawnFlag = true; MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("Sorry about that!\n- ULTRAPORTAL Developers", "", "", 0, false, false, true); if (Object.op_Implicit((Object)(object)MonoSingleton<StatsManager>.Instance.currentCheckPoint)) { MonoSingleton<StatsManager>.Instance.currentCheckPoint.OnRespawn(); } else { SceneHelper.RestartScene(); } } } else { RespawnFlag = false; } } } [BepInPlugin("com.ultraportal", "ULTRAPORTAL", "0.2.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("ULTRAKILL.exe")] public class Plugin : BaseUnityPlugin { private static class PluginInfo { public const string Name = "ULTRAPORTAL"; public const string Guid = "com.ultraportal"; public const string Version = "0.2.2"; } public static ConfigBuilder ConfiggyConfig; public static ManualLogSource LogSource { get; private set; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown LogSource = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("com.ultraportal"); val.PatchAll(); ConfiggyConfig = new ConfigBuilder("com.ultraportal", "ULTRAPORTAL"); ConfiggyConfig.BuildAll(); ConfiggyConfig.Rebuild(); if (!Directory.Exists(Constants.AssetPaths.BundlePath)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Path for ULTRAPORTAL bundles does not exist! Looked for: " + Constants.AssetPaths.BundlePath + "; Trying other bundle path.")); Constants.AssetPaths.UseAltBundlePath = true; } SceneManager.sceneLoaded += OnSceneLoaded; ConfiggyConfig.OnConfigElementsChanged += delegate { ConfiggyConfig.SaveData(); }; } private void OnSceneLoaded(Scene scene, LoadSceneMode loadMode) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown PortalGunManager.UsedPortalGun = false; PortalProjectileHelper.PortalScaleSceneStart = ((ConfigValueElement<float>)(object)ModConfig.PortalScaleMod).GetValue(); if (!SceneUtils.IsInLevel()) { return; } try { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Currently playing: " + SceneHelper.CurrentScene)); GameObject val = new GameObject("Portal Gun Manager"); val.AddComponent<PortalGunManager>(); GameObject val2 = new GameObject("Audio Manager"); val2.AddComponent<AudioManager>(); MonoSingleton<StyleHUD>.Instance.RegisterStyleItem("style.ultraportal.safetyhazard", "SAFETY HAZARD"); MonoSingleton<StyleHUD>.Instance.RegisterStyleItem("style.ultraportal.projectiled", "DISPLACEMENT"); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Scene is not compatible! Failed to spawn portal spawner!"); } } } public class DynamicPortalExit : MonoBehaviour { [CompilerGenerated] private sealed class <IClearEnemyGroundCheck>d__45 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EnemyIdentifier eid; public DynamicPortalExit <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <IClearEnemyGroundCheck>d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(0.05f); <>1__state = 1; return true; case 1: <>1__state = -1; eid.gce.StopForceOff(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool _playerNearEntry; private static bool _playerNearExit; private Action<PortalSide, Collider, bool, bool> _toggleColliderAction; public Action OnInitialized; public DynamicPortalExit otherExit; public PortalInfo info; public Portal hostPortal; public PortalSide side; public PortalGunBase hostGun; private GameObject _passableBlockage; private List<Collider> _colliders = new List<Collider>(); private List<Collider> _currentTravellers = new List<Collider>(); private ParticleSystem _particles; private PortalColorManager _colorManager; private KeepActive _keepActive; private PortalSandboxObject _sandbox; private AudioSource _ambianceSource; private Dictionary<EnemyIdentifier, Rigidbody> _eidRbMap = new Dictionary<EnemyIdentifier, Rigidbody>(); public bool IsInitialized { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - PortalGunBase.DefaultPortalPosition; return ((Vector3)(ref val)).sqrMagnitude > 1f; } } public bool AssistedPortalTravel { get; private set; } = false; public NativePortalTransform PortalTransform { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0023: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((int)side == 1) { return hostPortal.entryTransform; } return hostPortal.exitTransform; } } public bool IsBlocked { get { if (!Object.op_Implicit((Object)(object)_passableBlockage)) { return false; } return _passableBlockage.activeSelf; } } private void Awake() { //IL_006a: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown _sandbox = ((Component)this).gameObject.AddComponent<PortalSandboxObject>(); info = ((Component)this).GetComponent<PortalInfo>(); if (!Object.op_Implicit((Object)(object)info)) { DebugUtils.LogError("PortalInfo not found on " + ((Object)this).name + "!"); } _particles = info.spawnParticles; Transform transform = ((Component)_particles).transform; transform.localScale *= ((ConfigValueElement<float>)(object)ModConfig.PortalScaleMod).GetValue(); Transform transform2 = ((Component)info.ambianceParticles).transform; transform2.localScale *= ((ConfigValueElement<float>)(object)ModConfig.PortalScaleMod).GetValue(); _passableBlockage = info.passable; _colorManager = ((Component)this).gameObject.AddComponent<PortalColorManager>(); _colorManager.associated = this; CalculateAssistance(); GameObject val = new GameObject(((Object)this).name + " Keep Active"); _keepActive = val.AddComponent<KeepActive>(); _toggleColliderAction = (Action<PortalSide, Collider, bool, bool>)Delegate.Combine(_toggleColliderAction, (Action<PortalSide, Collider, bool, bool>)delegate(PortalSide portalSide, Collider collider, bool toggle, bool assistance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ToggleColliders(toggle, collider, assistance, portalSide); }); RegisterTriggers(); } private void RegisterTriggers() { info.playerDetectorTrigger.OnEnter.AddListener((UnityAction<Collider>)delegate(Collider c) { ColliderEventCaller(c, TriggerEnterEvent, info.playerDetectorTrigger); }); info.playerDetectorTrigger.OnExit.AddListener((UnityAction<Collider>)delegate(Collider c) { ColliderEventCaller(c, TriggerExitEvent, info.playerDetectorTrigger); }); info.otherDetectorTrigger.OnEnter.AddListener((UnityAction<Collider>)delegate(Collider c) { ColliderEventCaller(c, TriggerEnterEvent, info.otherDetectorTrigger); }); info.otherDetectorTrigger.OnExit.AddListener((UnityAction<Collider>)delegate(Collider c) { ColliderEventCaller(c, TriggerExitEvent, info.otherDetectorTrigger); }); static void ColliderEventCaller(Collider collider, Action<Collider> action, PortalExitCollider exitCollider) { if (exitCollider.detectsPlayer) { if (LayerMaskDefaults.IsMatchingLayer(((Component)collider).gameObject.layer, (LMD)8)) { action(collider); } } else { action(collider); } } } private void AddCollider(Collider c, bool checkChildren = true) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)c) || c.isTrigger || info.portalColliders.Contains(c)) { return; } Vector3 val = ((Component)c).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = Mathf.Abs(Vector3.Dot(-((Component)this).transform.forward, normalized)); DebugUtils.LogVerboseInfo($"Dot of {((Object)c).name}: {num}"); if (Mathf.Abs(num) < ((ConfigValueElement<float>)(object)ModConfig.PerpendicularThreshold).GetValue()) { DebugUtils.LogVerboseInfo("Rejected: " + ((Object)c).name + " (close to perpendicular to exit)"); return; } DebugUtils.LogVerboseInfo($"Adding collider: {((Object)c).name}; Checking children: {checkChildren}"); _colliders.SafeAdd(c); if (!checkChildren) { return; } Collider[] componentsInChildren = ((Component)c).GetComponentsInChildren<Collider>(); Collider[] array = componentsInChildren; foreach (Collider val2 in array) { DebugUtils.LogVerboseInfo("Child (" + ((Object)val2).name + ") layer: " + LayerMask.LayerToName(((Component)val2).gameObject.layer)); if (!Constants.EnvironmentLayer.Contains(((Component)val2).gameObject.layer)) { DebugUtils.LogVerboseWarning("Rejected: " + ((Object)val2).name); } else { AddCollider(val2, checkChildren: false); } } } private void GetNearbyCollider() { //IL_0007: 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) Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, ((ConfigValueElement<float>)(object)ModConfig.PortalSphereCheckRadius).GetValue(), LayerMask.op_Implicit(Constants.EnvironmentLayer), (QueryTriggerInteraction)1); Collider[] array2 = array; foreach (Collider val in array2) { if (Object.op_Implicit((Object)(object)val)) { AddCollider(val); } } } private void CalculateAssistance() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_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_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.forward; Vector3 normalized = ((Vector3)(ref val)).normalized; val = PhysicsExtensions.GetGravityVector(MonoSingleton<NewMovement>.Instance.rb); float num = Mathf.Abs(Vector3.Dot(normalized, ((Vector3)(ref val)).normalized)); string name = ((Object)this).name; val = PhysicsExtensions.GetGravityVector(MonoSingleton<NewMovement>.Instance.rb); DebugUtils.LogVerboseInfo($"{name} dot to {((Vector3)(ref val)).normalized}: {num}"); AssistedPortalTravel = num > ((ConfigValueElement<float>)(object)ModConfig.AssistedPortalThreshold).GetValue(); } private void Cleanup() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_ambianceSource)) { _ambianceSource.mute = true; _ambianceSource.Stop(); Object.Destroy((Object)(object)((Component)_ambianceSource).gameObject); } if (_currentTravellers == null) { _currentTravellers = new List<Collider>(); return; } foreach (Collider currentTraveller in _currentTravellers) { if (Object.op_Implicit((Object)(object)currentTraveller)) { DebugUtils.LogVerboseInfo("Resetting: " + ((Object)currentTraveller).name); ToggleColliders(value: false, currentTraveller, assisted: true, side); } } _currentTravellers.Clear(); } public void Initialize(Portal portal, PortalSide portalSide, RaycastHit hit) { //IL_0003: 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_000d: Unknown result type (might be due to invalid IL or missing references) Initialize(portal, portalSide, ((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, ((RaycastHit)(ref hit)).collider); } public void Initialize(Portal portal, PortalSide portalSide, Vector3 position, Vector3 forward, Collider hitCollider = null) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_sandbox) && ((SpawnableInstance)_sandbox).frozen) { MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("The portal you attempted to set is <color=#00FFFF>frozen</color>.", "", "", 0, false, false, true); return; } if (!Object.op_Implicit((Object)(object)portal)) { Plugin.LogSource.LogError((object)"Portal is invalid!"); return; } Cleanup(); if (((ConfigValueElement<bool>)(object)ModConfig.ShowPortalSpawnParticles).GetValue() && Object.op_Implicit((Object)(object)_particles)) { _particles.Play(); } ((Component)this).transform.forward = forward; ((Component)this).transform.position = position + -((Vector3)(ref forward)).normalized * ((ConfigValueElement<float>)(object)ModConfig.PortalWallOffset).GetValue(); hostPortal = portal; side = portalSide; AddCollider(hitCollider); GetNearbyCollider(); if (OnInitialized != null) { OnInitialized(); } _colorManager.ColorPortal(); _keepActive.target = ((Component)this).gameObject; DebugUtils.ShowForwardArrow(((Component)this).transform.position, -((Component)this).transform.forward, 10f); if (!Object.op_Implicit((Object)(object)MonoSingleton<AudioManager>.Instance)) { DebugUtils.LogError("Audio Manager is not present in scene!"); return; } if (((ConfigValueElement<bool>)(object)ModConfig.CanHearSFX).GetValue()) { MonoSingleton<AudioManager>.Instance.PlayAudioFromAsset("Portal Open", ((Component)Constants.MainCamera).transform.position, loop: false, 1f, 100f, 0f); } if (((ConfigValueElement<bool>)(object)ModConfig.CanHearAmbiance).GetValue()) { Vector3 position2 = ((Component)this).transform.position; _ambianceSource = MonoSingleton<AudioManager>.Instance.PlayAudioFromAsset("Portal Ambiance", position2, loop: true, ((ConfigValueElement<float>)(object)ModConfig.PortalAmbianceMinDistance).GetValue(), ((ConfigValueElement<float>)(object)ModConfig.PortalAmbianceMaxDistance).GetValue()); } } private void TriggerEnterEvent(Collider other) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) if (_colliders.Contains(other)) { return; } if (!Object.op_Implicit((Object)(object)other.attachedRigidbody)) { if (!other.isTrigger) { DebugUtils.LogVerboseInfo("ENTRY TRAVEL: Adding " + ((Object)other).name + " as collider!"); AddCollider(other); } return; } if ((other.attachedRigidbody.isKinematic || (int)other.attachedRigidbody.constraints == 126) && !LayerMaskDefaults.IsMatchingLayer(((Component)other.attachedRigidbody).gameObject.layer, (LMD)4)) { DebugUtils.LogVerboseError("ENTRY TRAVEL: " + ((Object)other).name + " has too many rigidbody constraints!"); return; } if (((Object)other).name == "Projectile Parry Zone" || ((Object)other).name.Contains("GroundCheck") || ((Object)other).name.Contains("Ground Check")) { DebugUtils.LogVerboseError("ENTRY TRAVEL: " + ((Object)other).name + " is a ground check or projectile parry zone!"); return; } if (!_currentTravellers.Contains(other)) { Collider component = ((Component)other.attachedRigidbody).GetComponent<Collider>(); if (((Object)other).name.Contains("EnvironmentChunk") || (!PortalUtils.IsInFrontOfPortal(((Component)other).transform.position, PortalTransform) && !AssistedPortalTravel)) { return; } if (Object.op_Implicit((Object)(object)((Component)component).GetComponent<EnemyIdentifier>())) { DebugUtils.LogVerboseInfo("ENTRY TRAVEL: " + ((Object)component).name + " is EnemyIdentifier"); _currentTravellers.SafeAdd(component); } DebugUtils.LogVerboseInfo("ENTRY TRAVEL: " + ((Object)other).name + " is traveller!"); _currentTravellers.SafeAdd(other); } if (!Object.op_Implicit((Object)(object)_passableBlockage) || !_passableBlockage.activeSelf) { if (Object.op_Implicit((Object)(object)otherExit)) { otherExit.CalculateAssistance(); otherExit._toggleColliderAction(side, other, arg3: true, otherExit.AssistedPortalTravel); } CalculateAssistance(); _toggleColliderAction(side, other, arg3: true, AssistedPortalTravel); } } private void Update() { if (Object.op_Implicit((Object)(object)MonoSingleton<PortalGunManager>.Instance)) { int layer = (MonoSingleton<PortalGunManager>.Instance.IsUsingSpawnerArm ? Constants.ItemLayer : Constants.PortalLayer); ((Component)this).gameObject.layer = layer; } } private void OnDestroy() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected I4, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 Cleanup(); DebugUtils.LogInfo("FINISHED CLEANUP!"); Object.Destroy((Object)(object)((Component)_keepActive).gameObject); if (!Object.op_Implicit((Object)(object)hostGun) || !Object.op_Implicit((Object)(object)hostPortal)) { return; } WeaponVariant variant = hostGun.variant; WeaponVariant val = variant; switch ((int)val) { case 0: { PortalGun portalGun = hostGun as PortalGun; if ((int)side == 1) { portalGun.SpawnEntry(reinit: true); } else { portalGun.SpawnExit(reinit: true); } break; } case 1: { MirrorGun mirrorGun = hostGun as MirrorGun; if ((int)side == 1) { mirrorGun.SpawnPrimaryMirror(reinit: true); } else { mirrorGun.SpawnFlippedMirror(reinit: true); } break; } case 2: { TwistGun twistGun = hostGun as TwistGun; if ((int)side == 1) { twistGun.SpawnEntry(reinit: true); } else { twistGun.SpawnExit(reinit: true); } break; } } } public bool ShouldBeDisabled() { if (Object.op_Implicit((Object)(object)_passableBlockage) && _passableBlockage.activeInHierarchy) { return true; } _currentTravellers = _currentTravellers.Where((Collider x) => (Object)(object)x != (Object)null && ((Component)x).gameObject.activeInHierarchy).ToList(); _currentTravellers.ForEach(delegate(Collider c) { DebugUtils.LogVerboseInfo(((Object)this).name + " has traveller: " + ((Object)c).name); }); return _currentTravellers.Count < 1; } public void SetPassable(bool canPass) { if (!Object.op_Implicit((Object)(object)_passableBlockage)) { DebugUtils.LogWarning(((Object)this).name + " doesn't have a portal blockage defined!"); } else { _passableBlockage.SetActive(!canPass); } } private void TriggerExitEvent(Collider other) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!_colliders.Contains(other) && (!Object.op_Implicit((Object)(object)_passableBlockage) || !_passableBlockage.activeSelf)) { if (Object.op_Implicit((Object)(object)otherExit)) { otherExit.CalculateAssistance(); otherExit._toggleColliderAction(side, other, arg3: false, arg4: true); } _toggleColliderAction(side, other, arg3: false, arg4: true); _currentTravellers.SafeRemove(other); } } public void Reset() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_sandbox) || !((SpawnableInstance)_sandbox).frozen) { ((Component)this).transform.parent = null; ((Component)this).transform.position = PortalGunBase.DefaultPortalPosition; Cleanup(); } } private void HandleSpecialTraveller(bool value, Collider other, bool assisted, PortalSide inputSide) { //IL_0030: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)other).GetComponent<NewMovement>())) { if (MonoSingleton<CheatsManager>.Instance.GetCheatState("ultrakill.noclip")) { return; } if (assisted && inputSide == side) { ((Behaviour)((Component)MonoSingleton<NewMovement>.Instance).GetComponent<VerticalClippingBlocker>()).enabled = !value; ((Component)((Component)MonoSingleton<NewMovement>.Instance).transform.Find("GroundCheck")).gameObject.SetActive(!value); ((Behaviour)MonoSingleton<NewMovement>.Instance).enabled = !value; } ((Behaviour)((Component)MonoSingleton<NewMovement>.Instance).GetComponent<PortalAwarePlayerCollider>()).enabled = !value; ((Behaviour)((Component)MonoSingleton<NewMovement>.Instance).GetComponent<KeepInBounds>()).enabled = !value; ((Behaviour)((Component)MonoSingleton<NewMovement>.Instance).GetComponent<WallCheckGroup>()).enabled = !value; } EnemyIdentifierIdentifier component = ((Component)other).GetComponent<EnemyIdentifierIdentifier>(); EnemyIdentifier val = ((!Object.op_Implicit((Object)(object)component)) ? ((Component)other).GetComponent<EnemyIdentifier>() : component.eid); if (!Object.op_Implicit((Object)(object)val)) { return; } if (!assisted) { value = false; } Rigidbody enemyRigidbody = GetEnemyRigidbody(val); if (Object.op_Implicit((Object)(object)enemyRigidbody)) { Vector3 velocity = enemyRigidbody.velocity; float num = Mathf.Abs(((Vector3)(ref velocity)).magnitude); if (num > ((ConfigValueElement<float>)(object)ModConfig.EnemyMaxVelocity).GetValue() && !val.hooked) { enemyRigidbody.detectCollisions = false; } } if (value) { val.gce.ForceOff(); } else { ((MonoBehaviour)this).StartCoroutine(IClearEnemyGroundCheck(val)); } } private Rigidbody GetEnemyRigidbody(EnemyIdentifier eid) { if (!_eidRbMap.TryGetValue(eid, out var value)) { ((Component)eid).TryGetComponent<Rigidbody>(ref value); } return value; } [IteratorStateMachine(typeof(<IClearEnemyGroundCheck>d__45))] private IEnumerator IClearEnemyGroundCheck(EnemyIdentifier eid) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <IClearEnemyGroundCheck>d__45(0) { <>4__this = this, eid = eid }; } private void ToggleColliders(bool value, Collider other, bool assisted, PortalSide inputSide) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (_colliders == null || !Object.op_Implicit((Object)(object)other) || _colliders.Count < 1) { return; } foreach (Collider collider in _colliders) { if (Object.op_Implicit((Object)(object)collider)) { if (!value) { DebugUtils.LogVerboseInfo("Re-enabling collisions for: " + ((Object)other).name + " and " + ((Object)collider).name); } HandleSpecialTraveller(value, other, assisted, inputSide); Physics.IgnoreCollision(collider, other, value); } } } } public class PortalSandboxObject : SandboxProp, IAlter, IAlterOptions<Vector3> { public string alterKey => "ultraportal_portals"; public string alterCategoryName => "ULTRAPORTALS"; AlterOption<Vector3>[] IAlterOptions<Vector3>.options => new AlterOption<Vector3>[1] { new AlterOption<Vector3> { key = "rotation", name = "Local Rotation", value = ((Component)this).transform.localEulerAngles, callback = delegate(Vector3 value) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localEulerAngles = value; } } }; public override void SetSize(Vector3 size) { } } public class CollisionPrinter : MonoBehaviour { private void OnCollisionEnter(Collision other) { Plugin.LogSource.LogInfo((object)(((Object)this).name + " COLLIDED WITH " + ((Object)other.gameObject).name)); } private void OnCollisionExit(Collision other) { Plugin.LogSource.LogInfo((object)(((Object)this).name + " STOPPED COLLIDING WITH " + ((Object)other.gameObject).name)); } private void OnTriggerEnter(Collider other) { Plugin.LogSource.LogInfo((object)(((Object)this).name + " IN TRIGGER " + ((Object)((Component)other).gameObject).name)); } private void OnTriggerExit(Collider other) { Plugin.LogSource.LogInfo((object)(((Object)this).name + " STOPPED TRIGGERING " + ((Object)((Component)other).gameObject).name)); } } public static class ColorHelpers { public static Color GetPortalColor(WeaponVariant variant, PortalSide side) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected I4, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_002e: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0033: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) return (Color)((int)variant switch { 0 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryPortalColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.SecondaryPortalColor).GetValue(), 1 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryMirrorColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.FlippedMirrorColor).GetValue(), 2 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryTwistColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.SecondaryTwistColor).GetValue(), _ => throw new ArgumentOutOfRangeException(), }); } public static Color GetPortalParticleColor(WeaponVariant variant, PortalSide side) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected I4, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_002e: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0033: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) return (Color)((int)variant switch { 0 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryPortalParticleColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.SecondaryPortalParticleColor).GetValue(), 1 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryMirrorParticleColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.FlippedMirrorParticleColor).GetValue(), 2 => ((int)side == 1) ? ((ConfigValueElement<Color>)(object)ModConfig.PrimaryTwistParticleColor).GetValue() : ((ConfigValueElement<Color>)(object)ModConfig.SecondaryTwistParticleColor).GetValue(), _ => throw new ArgumentOutOfRangeException(), }); } } public static class DebugUtils { private static ManualLogSource Logger => Plugin.LogSource; public static void Log(LogLevel level, string message) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Logger.Log(level, (object)message); } public static void LogInfo(string message) { Log((LogLevel)16, message); } public static void LogWarning(string message) { Log((LogLevel)4, message); } public static void LogError(string message) { Log((LogLevel)2, message); } public static void LogFatal(string message) { Log((LogLevel)1, message); } public static void LogVerbose(LogLevel level, string message) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (((ConfigValueElement<bool>)(object)ModConfig.VerboseLogging).GetValue()) { Log(level, message); } } public static void LogVerboseInfo(string message) { LogVerbose((LogLevel)16, message); } public static void LogVerboseWarning(string message) { LogVerbose((LogLevel)4, message); } public static void LogVerboseError(string message) { LogVerbose((LogLevel)2, message); } public static void LogVerboseFatal(string message) { LogVerbose((LogLevel)1, message); } public static void ShowForwardArrow(Vector3 position, Vector3 forward, float duration = -1f) { //IL_0032: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (((ConfigValueElement<bool>)(object)ModConfig.DrawDebugObjects).GetValue()) { AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "debug"); GameObject val2 = val.LoadAsset<GameObject>("ForwardArrow"); GameObject val3 = Object.Instantiate<GameObject>(val2, position, Quaternion.identity); val3.transform.forward = forward; if (!(duration < 0f)) { Object.Destroy((Object)(object)val3, duration); } } } } public class KeepActive : MonoBehaviour { public GameObject target; private List<GameObject> GetTargetHierarchy() { List<GameObject> list = new List<GameObject>(); list.Add(target); GameObject gameObject = target; while (Object.op_Implicit((Object)(object)gameObject.transform.parent)) { gameObject = ((Component)gameObject.transform.parent).gameObject; list.Add(gameObject); } return list; } private void Update() { if (!Object.op_Implicit((Object)(object)target) || MonoSingleton<NewMovement>.Instance.dead || target.activeInHierarchy) { return; } List<GameObject> targetHierarchy = GetTargetHierarchy(); foreach (GameObject item in targetHierarchy) { item.SetActive(true); Plugin.LogSource.LogInfo((object)("Setting " + ((Object)item).name + " to active!")); } } } public class LayerPrinter : MonoBehaviour { private List<int> _collectedLayers = new List<int>(); private Dictionary<int, List<GameObject>> _objectMap = new Dictionary<int, List<GameObject>>(); private void GatherChildren(Transform root) { for (int i = 0; i < root.childCount; i++) { GameObject gameObject = ((Component)((Component)this).transform.GetChild(i)).gameObject; AddLayer(gameObject.layer, gameObject); } } private void Start() { _collectedLayers = new List<int>(); _objectMap = new Dictionary<int, List<GameObject>>(); AddLayer(((Component)this).gameObject.layer, ((Component)this).gameObject); GatherChildren(((Component)this).transform); Plugin.LogSource.LogInfo((object)("-- LAYERS IN " + ((Object)((Component)this).gameObject).name + " --")); foreach (int collectedLayer in _collectedLayers) { Plugin.LogSource.LogInfo((object)("- " + LayerMask.LayerToName(collectedLayer) + " -")); foreach (GameObject item in _objectMap[collectedLayer]) { Plugin.LogSource.LogInfo((object)(((Object)item).name ?? "")); } } } private void AddLayer(int layer, GameObject obj) { if (_collectedLayers.Contains(layer)) { List<GameObject> list = _objectMap[layer]; list.Add(obj); } else { _collectedLayers.Add(layer); _objectMap.Add(layer, new List<GameObject>()); } } } public class GunBase : MonoBehaviour { [CompilerGenerated] private sealed class <IFireCooldown>d__13 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public bool isPrimary; public GunBase <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <IFireCooldown>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.SetCanFire(isPrimary, value: false); <>2__current = (object)new WaitForSeconds(<>4__this.fireCooldown); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.SetCanFire(isPrimary, value: true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public float fireCooldown = 1f; protected Action OnPrimaryFire; protected Action OnSecondaryFire; protected bool CanPrimaryFire = true; protected bool CanSecondaryFire = true; public WeaponVariant variant; public Sprite icon; public Sprite glowIcon; public WeaponPos WeaponPos; public WeaponIcon WeaponIcon; public WeaponIdentifier WeaponIdentifier; protected virtual void Start() { //IL_00fb: 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) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0060: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)WeaponPos)) { WeaponPos = ((Component)this).gameObject.AddComponent<WeaponPos>(); WeaponPos.middlePos = new Vector3(((Component)this).transform.localPosition.x, 0f, ((Component)this).transform.localPosition.z); WeaponPos.middleRot = Vector3.zero; WeaponPos.middleScale = ((Component)this).transform.localScale; } WeaponIdentifier = ((Component)this).gameObject.AddComponent<WeaponIdentifier>(); WeaponIdentifier.speedMultiplier = 1f; WeaponIcon = ((Component)this).gameObject.AddComponent<WeaponIcon>(); WeaponIcon.weaponDescriptor = ScriptableObject.CreateInstance<WeaponDescriptor>(); WeaponIcon.weaponDescriptor.icon = icon; WeaponIcon.weaponDescriptor.glowIcon = glowIcon; WeaponIcon.weaponDescriptor.variationColor = variant; } private void SetCanFire(bool isPrimary, bool value) { if (isPrimary) { CanPrimaryFire = value; } else { CanSecondaryFire = value; } } [IteratorStateMachine(typeof(<IFireCooldown>d__13))] protected virtual IEnumerator IFireCooldown(bool isPrimary) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <IFireCooldown>d__13(0) { <>4__this = this, isPrimary = isPrimary }; } protected virtual void HandleFiring() { if (MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame && CanPrimaryFire) { if (OnPrimaryFire != null) { OnPrimaryFire(); } ((MonoBehaviour)this).StartCoroutine(IFireCooldown(isPrimary: true)); } if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.WasPerformedThisFrame && CanSecondaryFire) { if (OnSecondaryFire != null) { OnSecondaryFire(); } ((MonoBehaviour)this).StartCoroutine(IFireCooldown(isPrimary: false)); } } protected Projectile SpawnProjectileFromAsset(string assetName, float speed) { AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "weapons"); return SpawnProjectileFromPrefab(val.LoadAsset<GameObject>(assetName), speed); } protected Projectile SpawnProjectileFromPrefab(GameObject prefab, float speed) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(prefab, ((Component)Constants.MainCamera).transform.position, Quaternion.identity); val.transform.forward = ((Component)Constants.MainCamera).transform.forward; Projectile val2 = val.AddComponent<Projectile>(); val2.damage = 0f; val2.sourceWeapon = ((Component)this).gameObject; val2.playerBullet = true; val2.isTargetPlayer = false; val2.friendly = true; val2.speed = speed; val2.bulletType = ""; val2.ignoreEnvironment = false; val2.ignoreExplosions = false; val2.unparryable = true; return val2; } protected virtual void OnDisable() { ((MonoBehaviour)this).StopAllCoroutines(); CanPrimaryFire = true; CanSecondaryFire = true; } } public struct GunPosition { public Vector3 Position; public Vector3 Rotation; public Vector3 Scale; public GunPosition(Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) Position = position; Rotation = rotation; Scale = scale; } } public sealed class MirrorGun : PortalGunBase { private readonly Vector2 _portalSize = new Vector2(11f, 11f) * ((ConfigValueElement<float>)(object)ModConfig.PortalScaleMod).GetValue(); private Portal _mirrorPortal; private Portal _flippedMirrorPortal; private static ManualLogSource Logger => Plugin.LogSource; public DynamicPortalExit PrimaryMirror { get; private set; } public DynamicPortalExit FlippedMirror { get; private set; } public void SpawnPrimaryMirror(bool reinit = false) { PrimaryMirror = SpawnPortalExit("Primary Mirror", (PortalSide)1, _mirrorPortal, "Mirror"); if (Object.op_Implicit((Object)(object)PrimaryMirror)) { DynamicPortalExit primaryMirror = PrimaryMirror; primaryMirror.OnInitialized = (Action)Delegate.Combine(primaryMirror.OnInitialized, (Action)delegate { PrimaryMirror.SetPassable(canPass: true); }); } if (reinit) { InitMirror(); } } public void SpawnFlippedMirror(bool reinit = false) { FlippedMirror = SpawnPortalExit("Flipped Mirror", (PortalSide)2, _flippedMirrorPortal, "Mirror"); if (Object.op_Implicit((Object)(object)FlippedMirror)) { DynamicPortalExit flippedMirror = FlippedMirror; flippedMirror.OnInitialized = (Action)Delegate.Combine(flippedMirror.OnInitialized, (Action)delegate { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003b: Unknown result type (might be due to invalid IL or missing references) FlippedMirror.SetPassable(canPass: true); Vector3 localEulerAngles = ((Component)FlippedMirror).transform.localEulerAngles; ((Component)FlippedMirror).transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, 90f); }); } if (reinit) { InitMirror(); } } protected override void Start() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) base.Start(); AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "portals"); GameObject val2 = val.LoadAsset<GameObject>("Mirror"); if (!Object.op_Implicit((Object)(object)val2)) { Logger.LogError((object)"Failed to load mirror prefab!"); return; } _animator = ((Component)this).GetComponentInChildren<Animator>(); if (!Object.op_Implicit((Object)(object)_animator)) { MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=#ff000>Animator is invalid!</color>", "", "", 0, false, false, true); } SpawnPrimaryMirror(); SpawnFlippedMirror(); OnPrimaryFire = (Action)Delegate.Combine(OnPrimaryFire, (Action)delegate { FireProjectile(PrimaryMirror, _mirrorPortal); UpdateLastProjectile((PortalSide)1); _animator.Play(_info.PrimaryFireAnimation); }); OnSecondaryFire = (Action)Delegate.Combine(OnSecondaryFire, (Action)delegate { UpdateLastProjectile((PortalSide)2); FireProjectile(FlippedMirror, _flippedMirrorPortal); _animator.Play(_info.AltFireAnimation); }); UpdateLastProjectile(PrimaryMirror.side); InitMirror(); } private void InitMirror() { //IL_001f: 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) _mirrorPortal = CreatePortal("Mirror Head", ((Component)PrimaryMirror).transform, ((Component)PrimaryMirror).transform, _portalSize); _flippedMirrorPortal = CreatePortal("Flipped Mirror Portal", ((Component)FlippedMirror).transform, ((Component)FlippedMirror).transform, _portalSize); _flippedMirrorPortal.usePerceivedGravityOnEnter = true; _flippedMirrorPortal.usePerceivedGravityOnExit = true; } public override bool ShouldBeReset() { if (!Object.op_Implicit((Object)(object)PrimaryMirror) || !Object.op_Implicit((Object)(object)FlippedMirror)) { return true; } return PrimaryMirror.ShouldBeDisabled() && FlippedMirror.ShouldBeDisabled(); } public override bool ShouldPlayReset() { return ShouldBeReset() && (PrimaryMirror.IsInitialized || FlippedMirror.IsInitialized); } public void Reset() { if (Object.op_Implicit((Object)(object)PrimaryMirror)) { PrimaryMirror.Reset(); } if (Object.op_Implicit((Object)(object)FlippedMirror)) { FlippedMirror.Reset(); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)PrimaryMirror)) { Object.Destroy((Object)(object)((Component)PrimaryMirror).gameObject); } if (Object.op_Implicit((Object)(object)FlippedMirror)) { Object.Destroy((Object)(object)((Component)FlippedMirror).gameObject); } if (Object.op_Implicit((Object)(object)_mirrorPortal)) { Object.Destroy((Object)(object)((Component)_mirrorPortal).gameObject); } if (Object.op_Implicit((Object)(object)_flippedMirrorPortal)) { Object.Destroy((Object)(object)((Component)_flippedMirrorPortal).gameObject); } } } public sealed class PortalGun : PortalGunBase { private Portal _portal; private readonly Vector2 _portalSize = new Vector2(5.95f, 7.95f) * ((ConfigValueElement<float>)(object)ModConfig.PortalScaleMod).GetValue(); private static ManualLogSource Logger => Plugin.LogSource; public DynamicPortalExit PortalEntry { get; private set; } public DynamicPortalExit PortalExit { get; private set; } public bool BothPortalsInit { get { if (!Object.op_Implicit((Object)(object)PortalEntry) || !Object.op_Implicit((Object)(object)PortalExit)) { return false; } return PortalEntry.IsInitialized && PortalExit.IsInitialized; } } public void SpawnEntry(bool reinit = false) { PortalEntry = SpawnPortalExit("Entry", (PortalSide)1, _portal); if (Object.op_Implicit((Object)(object)PortalEntry)) { DynamicPortalExit portalEntry = PortalEntry; portalEntry.OnInitialized = (Action)Delegate.Combine(portalEntry.OnInitialized, new Action(UpdatePortalPassable)); } if (reinit) { InitPortals(); UpdatePortalPassable(); } } public void SpawnExit(bool reinit = false) { PortalExit = SpawnPortalExit("Exit", (PortalSide)2, _portal); if (Object.op_Implicit((Object)(object)PortalExit)) { DynamicPortalExit portalExit = PortalExit; portalExit.OnInitialized = (Action)Delegate.Combine(portalExit.OnInitialized, new Action(UpdatePortalPassable)); } if (reinit) { InitPortals(); UpdatePortalPassable(); } } protected override void Start() { base.Start(); _animator = ((Component)this).GetComponentInChildren<Animator>(); if (!Object.op_Implicit((Object)(object)_animator)) { MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=#ff000>Animator is invalid!</color>", "", "", 0, false, false, true); } SpawnEntry(); SpawnExit(); OnPrimaryFire = (Action)Delegate.Combine(OnPrimaryFire, (Action)delegate { FireProjectile(PortalEntry, _portal); UpdateLastProjectile((PortalSide)1); _animator.Play(_info.PrimaryFireAnimation); }); OnSecondaryFire = (Action)Delegate.Combine(OnSecondaryFire, (Action)delegate { FireProjectile(PortalExit, _portal); UpdateLastProjectile((PortalSide)2); _animator.Play(_info.AltFireAnimation); }); InitPortals(); PortalEntry.otherExit = PortalExit; PortalExit.otherExit = PortalEntry; } public override bool ShouldBeReset() { if (!Object.op_Implicit((Object)(object)PortalEntry) || !Object.op_Implicit((Object)(object)PortalExit)) { return true; } return PortalEntry.ShouldBeDisabled() && PortalExit.ShouldBeDisabled(); } public override bool ShouldPlayReset() { return ShouldBeReset() && (PortalEntry.IsInitialized || PortalExit.IsInitialized); } private void UpdatePortalPassable() { if (Object.op_Implicit((Object)(object)PortalEntry)) { PortalEntry.SetPassable(BothPortalsInit); } if (Object.op_Implicit((Object)(object)PortalExit)) { PortalExit.SetPassable(BothPortalsInit); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)PortalEntry)) { Object.Destroy((Object)(object)((Component)PortalEntry).gameObject); } if (Object.op_Implicit((Object)(object)PortalExit)) { Object.Destroy((Object)(object)((Component)PortalExit).gameObject); } if (Object.op_Implicit((Object)(object)_portal)) { Object.Destroy((Object)(object)((Component)_portal).gameObject); } } private void InitPortals() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) _portal = CreatePortal("Portal", ((Component)PortalEntry).transform, ((Component)PortalExit).transform, _portalSize); } public void Reset() { if (Object.op_Implicit((Object)(object)PortalEntry)) { PortalEntry.Reset(); } if (Object.op_Implicit((Object)(object)PortalExit)) { PortalExit.Reset(); } UpdatePortalPassable(); } } public abstract class PortalGunBase : GunBase { public static readonly Vector3 DefaultPortalPosition = new Vector3(0f, -1000000f, 0f); protected PortalGunInfo _info; protected Animator _animator; protected ProjectileColorManager LastProjectileColors; private bool triggeredPortalReset = false; public bool WantsToReset { get; protected set; } protected override void Start() { base.Start(); _info = ((Component)this).GetComponent<PortalGunInfo>(); LastProjectileColors = _info.lastProjectile.AddComponent<ProjectileColorManager>(); OnPrimaryFire = (Action)Delegate.Combine(OnPrimaryFire, new Action(UpdateUsedPortalGun)); OnSecondaryFire = (Action)Delegate.Combine(OnSecondaryFire, new Action(UpdateUsedPortalGun)); _animator = _info.animator; } private void UpdateUsedPortalGun() { PortalGunManager.UsedPortalGun = true; } protected virtual void UpdateLastProjectile(PortalSide side) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)LastProjectileColors)) { LastProjectileColors.side = side; LastProjectileColors.variant = variant; LastProjectileColors.ColorProjectile(); } } public abstract bool ShouldBeReset(); public abstract bool ShouldPlayReset(); protected virtual void OnEnable() { if (Object.op_Implicit((Object)(object)LastProjectileColors) && LastProjectileColors.FirstColorDone) { LastProjectileColors.ColorProjectile(); } } protected DynamicPortalExit SpawnPortalExit(string objectName, PortalSide side, Portal hostPortal, string prefabName = "Portal Exit") { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "portals"); GameObject val2 = val.LoadAsset<GameObject>(prefabName); if (!Object.op_Implicit((Object)(object)val2)) { Plugin.LogSource.LogError((object)"Failed to load portal prefab!"); return null; } Vector3 defaultPortalPosition = DefaultPortalPosition; GameObject val3 = Object.Instantiate<GameObject>(val2, defaultPortalPosition, Quaternion.identity); ((Object)val3).name = objectName; DynamicPortalExit dynamicPortalExit = val3.AddComponent<DynamicPortalExit>(); dynamicPortalExit.side = side; dynamicPortalExit.hostPortal = hostPortal; dynamicPortalExit.hostGun = this; return dynamicPortalExit; } protected void FirePhysicsProjectile(DynamicPortalExit exit, Portal portal) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) Projectile val = SpawnProjectileFromAsset("Projectile", ((ConfigValueElement<float>)(object)ModConfig.PortalProjectileSpeed).GetValue()); PortalProjectileHelper portalProjectileHelper = ((Component)val).gameObject.AddComponent<PortalProjectileHelper>(); portalProjectileHelper.exit = exit; portalProjectileHelper.portal = portal; ProjectileColorManager projectileColorManager = ((Component)val).gameObject.AddComponent<ProjectileColorManager>(); projectileColorManager.side = exit.side; projectileColorManager.variant = variant; projectileColorManager.ColorProjectile(); } protected void FireBeamProjectile(DynamicPortalExit exit, Portal portal) { //IL_000b: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) PhysicsCastResult val = default(PhysicsCastResult); if (PortalPhysicsV2.Raycast(((Component)Constants.MainCamera).transform.position, ((Component)Constants.MainCamera).transform.forward, ref val, float.PositiveInfinity, LayerMask.op_Implicit(Constants.EnvironmentLayer), (QueryTriggerInteraction)1)) { PortalGunManager.SummonPortalExit(exit, portal, val.point, -val.normal, val.transform, val.collider); } } protected virtual void FireProjectile(DynamicPortalExit exit, Portal portal) { if (((ConfigValueElement<bool>)(object)ModConfig.UseBeamForProjectiles).GetValue()) { FireBeamProjectile(exit, portal); } else { FirePhysicsProjectile(exit, portal); } } protected virtual void Update() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (MonoSingleton<OptionsManager>.Instance.paused) { return; } bool num; if (!((ConfigValueElement<bool>)(object)ModConfig.CloseWithMouse).GetValue()) { num = Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)ModConfig.AltCloseKeybind).GetValue()); } else { if (!MonoSingleton<InputManager>.Instance.InputSource.Fire1.IsPressed) { goto IL_00b3; } num = MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed; } if (num) { WantsToReset = !triggeredPortalReset; if (!triggeredPortalReset) { triggeredPortalReset = true; if (ShouldPlayReset()) { _animator.Play(_info.CloseAnimation); } } return; } goto IL_00b3; IL_00b3: triggeredPortalReset = false; WantsToReset = false; HandleFiring(); } protected Portal CreatePortal(string objectName, Transform entry, Transform exit, Vector2 size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown return PortalSpawner.CreatePortal(objectName, entry, exit, new PortalParameters { AllowCameraTraversals = true, AppearsInRecursions = true, MaxRecursionCount = ((ConfigValueElement<int>)(object)ModConfig.MaxPortalRecursions).GetValue(), InfiniteRecursions = ((ConfigValueElement<bool>)(object)ModConfig.InfiniteRecursions).GetValue(), CanSeeItself = true, CanSeePortals = true, ConsumeAudio = false, CanHearAudio = false, MinimumEntrySpeed = ((ConfigValueElement<float>)(object)ModConfig.MinimumEntryExitSpeed).GetValue(), MinimumExitSpeed = ((ConfigValueElement<float>)(object)ModConfig.MinimumEntryExitSpeed).GetValue(), Size = size }); } } [DefaultExecutionOrder(-100000)] public class PortalGunManager : MonoSingleton<PortalGunManager> { [CompilerGenerated] private sealed class <IDestroyPortals>d__22 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PortalGunBase gun; public DynamicPortalExit[] exits; public PortalGunManager <>4__this; private bool <gunShouldReset>5__1; private DynamicPortalExit[] <>s__2; private int <>s__3; private DynamicPortalExit <exit>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <IDestroyPortals>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = null; <exit>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0129: 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_00f2: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)gun)) { return false; } <gunShouldReset>5__1 = gun.ShouldBeReset(); if (<gunShouldReset>5__1) { break; } <>s__2 = exits; for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++) { <exit>5__4 = <>s__2[<>s__3]; if (Object.op_Implicit((Object)(object)<exit>5__4)) { <>4__this.SpawnPortalExplosion(((Component)<exit>5__4).transform.position); <exit>5__4 = null; } } <>s__2 = null; <>2__current = (object)new WaitForSeconds(PortalGunResetWait); <>1__state = 1; return true; case 1: <>1__state = -1; break; } if (gun.ShouldPlayReset()) { MonoSingleton<AudioManager>.Instance.PlayAudioFromAsset("Portal Close", ((Component)Constants.MainCamera).transform.position, loop: false, 1f, 100f, 0f); } ((MonoBehaviour)gun).Invoke("Reset", 0f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static float PortalGunResetWait = 0.1f; private static int PortalGunSlot = -1; private static bool _UsedPortalGun = false; private int _currentVariationIndex = -1; private bool _wasEnabledLastFrame = false; private bool _showedWarning = false; private PortalGun _portalGun; private MirrorGun _mirrorGun; private TwistGun _twistGun; public bool IsUsingSpawnerArm { get; private set; } = false; private bool AnyPortalsInit { get { bool flag = false; if (Object.op_Implicit((Object)(object)_portalGun)) { flag |= _portalGun.BothPortalsInit; } if (Object.op_Implicit((Object)(object)_mirrorGun)) { flag |= Object.op_Implicit((Object)(object)_mirrorGun.PrimaryMirror) || Object.op_Implicit((Object)(object)_mirrorGun.FlippedMirror); } if (Object.op_Implicit((Object)(object)_twistGun)) { flag |= _twistGun.BothPortalsInit; } return flag; } } public static bool UsedPortalGun { get { return _UsedPortalGun; } set { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (value) { BalancingManager.DisableRankSubmission("USED PORTAL GUN", new Color(0.98f, 0.039f, 0.337f)); } _UsedPortalGun = value; } } public static void SummonPortalExit(DynamicPortalExit exit, Portal portal, Vector3 position, Vector3 forward, Transform parent = null, Collider collider = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((Component)exit).transform.parent = null; Vector3 val = Vector3.one * PortalProjectileHelper.PortalScaleSceneStart; ((Component)exit).transform.localScale = new Vector3(val.x, val.y, 1f); ((Component)exit).transform.SetParent(parent, true); exit.Initialize(portal, exit.side, position, forward, collider); } private GunBase SpawnPortalGun(Type type, string assetPrefabPath, WeaponVariant variant, GunPosition defaultPos, GunPosition middlePos) { //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_006e: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!type.IsSubclassOf(typeof(GunBase))) { Plugin.LogSource.LogError((object)"Type must be a subclass of GunBase!"); return null; } AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "weapons"); GameObject val2 = val.LoadAsset<GameObject>(assetPrefabPath); GameObject val3 = Object.Instantiate<GameObject>(val2, Vector3.zero, Quaternion.identity, ((Component)MonoSingleton<GunControl>.Instance).transform); val3.transform.localPosition = defaultPos.Position; val3.transform.localEulerAngles = defaultPos.Rotation; val3.transform.localScale = defaultPos.Scale; GunBase gunBase = val3.AddComponent(type) as GunBase; gunBase.fireCooldown = 0.5f; gunBase.icon = val.LoadAsset<Sprite>("UltraPortalGunIcon"); gunBase.glowIcon = val.LoadAsset<Sprite>("UltraPortalGunIconGlow"); gunBase.variant = variant; gunBase.WeaponPos = val3.AddComponent<WeaponPos>(); gunBase.WeaponPos.middlePos = middlePos.Position; gunBase.WeaponPos.middleRot = middlePos.Rotation; gunBase.WeaponPos.middleScale = middlePos.Scale; val3.SetActive(false); return gunBase; } private void Start() { //IL_0012: 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_0035: 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_0064: 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_0073: Unknown result type (might be due to invalid IL or missing references) GunPosition middlePos = new GunPosition(new Vector3(0f, -0.8478f, 0.8907f), new Vector3(0f, 270f, 0f), Vector3.one * 1.2f); GunPosition defaultPos = new GunPosition(new Vector3(0.8236f, -0.7478f, 0.8907f), new Vector3(0f, 263.3673f, 14.1545f), Vector3.one * 1.2f); _portalGun = SpawnPortalGun(typeof(PortalGun), "Portal Gun", (WeaponVariant)0, defaultPos, middlePos) as PortalGun; _mirrorGun = SpawnPortalGun(typeof(MirrorGun), "Mirror Gun", (WeaponVariant)1, defaultPos, middlePos) as MirrorGun; _twistGun = SpawnPortalGun(typeof(TwistGun), "Twist Gun Variant", (WeaponVariant)2, defaultPos, middlePos) as TwistGun; if (!Object.op_Implicit((Object)(object)_portalGun) || !Object.op_Implicit((Object)(object)_mirrorGun) || !Object.op_Implicit((Object)(object)_twistGun)) { DebugUtils.LogError($"Portal Gun?: {_portalGun}, Mirror Gun?: {_mirrorGun}, Twist Gun?: {_twistGun}"); } if (((ConfigValueElement<bool>)(object)ModConfig.IsEnabled).GetValue()) { AddToSlots(); } } private void AddToSlots() { if (!Object.op_Implicit((Object)(object)_portalGun) || !Object.op_Implicit((Object)(object)_mirrorGun) || !Object.op_Implicit((Object)(object)_twistGun)) { DebugUtils.LogError($"Portal Gun: {_portalGun}; Mirror Gun: {_mirrorGun}; Twist Gun: {_twistGun}"); return; } MonoSingleton<GunControl>.Instance.slots.Add(new List<GameObject> { ((Component)_portalGun).gameObject, ((Component)_mirrorGun).gameObject, ((Component)_twistGun).gameObject }); PortalGunSlot = MonoSingleton<GunControl>.Instance.slots.Count; MonoSingleton<GunControl>.Instance.UpdateWeaponList(false); } [IteratorStateMachine(typeof(<IDestroyPortals>d__22))] private IEnumerator IDestroyPortals(PortalGunBase gun, params DynamicPortalExit[] exits) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <IDestroyPortals>d__22(0) { <>4__this = this, gun = gun, exits = exits }; } private void SpawnPortalExplosion(Vector3 position) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) AssetBundle val = AssetBundleUtils.LoadAssetBundle(Constants.AssetPaths.BundlePath, "weapons"); GameObject val2 = val.LoadAsset<GameObject>("Explosion"); GameObject val3 = Object.Instantiate<GameObject>(val2, position, Quaternion.identity); float maxSize = 15f; ExplosionColorManager explosionColorManager = val3.AddComponent<ExplosionColorManager>(); explosionColorManager.ColorExplosion(); Explosion val4 = val3.AddComponent<Explosion>(); val4.enemyDamageMultiplier = 1.5f; val4.toIgnore = new List<EnemyType>(); val4.sourceWeapon = ((Component)this).gameObject; val4.hitterWeapon = "dynamicportal"; val4.damage = 25; val4.speed = 15f; val4.maxSize = maxSize; val4.harmless = false; val4.ultrabooster = ((ConfigValueElement<bool>)(object)ModConfig.AreExplosionsUltraboosters).GetValue(); } public void DestroyPortals(WeaponVariant variant, bool useSfx = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected I4, but got Unknown switch ((int)variant) { case 0: ((MonoBehaviour)this).StartCoroutine(IDestroyPortals(_portalGun, _portalGun.PortalEntry, _portalGun.PortalExit)); break; case 1: ((MonoBehaviour)this).StartCoroutine(IDestroyPortals(_mirrorGun, _mirrorGun.PrimaryMirror, _mirrorGun.FlippedMirror)); break; case 2: ((MonoBehaviour)this).StartCoroutine(IDestroyPortals(_twistGun, _twistGun.TwistExit, _twistGun.TwistExit)); break; } } private void Update() { //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) if (MonoSingleton<GunControl>.Instance.currentSlotIndex != PortalGunSlot) { _currentVariationIndex = -1; } IsUsingSpawnerArm = MonoSingleton<GunControl>.Instance.currentSlotIndex == 6; if (!((ConfigValueElement<bool>)(object)ModConfig.IsEnabled).GetValue()) { if (!_wasEnabledLastFrame) { return; } _wasEnabledLastFrame = false; DestroyPortals((WeaponVariant)0); DestroyPortals((WeaponVariant)1); DestroyPortals((WeaponVariant)2); DestroyPortals((WeaponVariant)3); int currentSlotIndex = MonoSingleton<GunControl>.Instance.currentSlotIndex; MonoSingleton<GunControl>.Instance.slots.RemoveAt(PortalGunSlot - 1); PortalGunSlot = -1; MonoSingleton<GunControl>.Instance.UpdateWeaponList(false); if (MonoSingleton<GunControl>.Instance.currentSlotIndex != currentSlotIndex) { return; } if (MonoSingleton<GunControl>.Instance.noWeapons) { MonoSingleton<GunControl>.Instance.currentSlotIndex = 1; MonoSingleton<GunControl>.Instance.NoWeapon(); return; } for (int i = 0; i < MonoSingleton<GunControl>.Instance.slots.Count; i++) { if (MonoSingleton<GunControl>.Instance.slots[i].Count > 0) { MonoSingleton<GunControl>.Instance.SwitchWeapon(i + 1, (int?)null, false, false, false); return; } } MonoSingleton<GunControl>.Instance.stayUnarmed = true; return; } bool noWeapons = MonoSingleton<GunControl>.Instance.noWeapons; if (PortalGunSlot == -1) { AddToSlots(); } if (!_wasEnabledLastFrame && noWeapons && PortalGunSlot != -1) { MonoSingleton<GunControl>.Instance.SwitchWeapon(PortalGunSlot, (int?)0, false, false, false); } _wasEnabledLastFrame = true; if (!MonoSingleton<OptionsManager>.Instance.paused && !GameStateManager.Instance.PlayerInputLocked && MonoSingleton<GunControl>.Instance.activated) { if (_portalGun.WantsToReset) { DestroyPortals(_portalGun.variant, useSfx: true); } if (_mirrorGun.WantsToReset) { DestroyPortals(_mirrorGun.variant, useSfx: true); } if (_twistGun.WantsToReset) { DestroyPortals(_twistGun.variant, useSfx: true); } int index = PortalGunSlot - 1; if (Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)ModConfig.PortalGunKeybind).GetValue()) && Object.op_Implicit((Object)(object)MonoSingleton<GunControl>.Instance) && MonoSingleton<GunControl>.Instance.slots[index].Count > 0 && Object.op_Implicit((Object)(object)MonoSingleton<GunControl>.Instance.slots[index][0])) { MonoSingleton<GunControl>.Instance.SwitchWeapon(PortalGunSlot, (int?)(_currentVariationIndex + 1), false, false, true); _currentVariationIndex = MonoSingleton<GunControl>.Instance.currentVariationIndex; } } } } public class TwistGun : PortalGunBase { [CompilerGenerated] private sealed class <ISwitchRigidbodyGravity>d__19 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Rigidbody rb; public DynamicPortalExit exit; public TwistGun <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ISwitchRigidbodyGravity>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; DebugUtils.LogInfo("Changing rigidbody gravity"); <>2__current = (object)new WaitForSecondsRealtime(0.05f); <>1__state = 1; return true; case 1: { <>1__state = -1; PhysicsExtensions.SetCustomGravityMode(rb, true); Rigidbody obj = rb; Vector3 val = ((Component)exit).transform.forward; Vector3 val2 = -((Vector3)(ref val)).normalized; val = Physics.gravity; PhysicsExtensions.SetCustomGravity(obj, val2 * ((Vector3)(ref val)).magnitude); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ITravelLock>d__20 : IEnumerator<object>, IDisposable, IEnumerato
plugins/UltraPortal/UltraPortal.Shared.dll
Decompiled 2 days agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UltraPortal.Shared")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UltraPortal.Shared")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("BF2BD752-2035-4DA4-9938-346BC0B4C942")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace UltraPortal.Shared; [RequireComponent(typeof(BoxCollider))] public class PortalExitCollider : MonoBehaviour { public UnityEvent<Collider> OnEnter; public UnityEvent<Collider> OnExit; public bool detectsPlayer; private Collider _collider; private void Start() { _collider = ((Component)this).GetComponent<Collider>(); _collider.isTrigger = true; } private void OnTriggerEnter(Collider other) { OnEnter.Invoke(other); } private void OnTriggerExit(Collider other) { OnExit.Invoke(other); } } public class PortalGunInfo : MonoBehaviour { public Animator animator; [SerializeField] private string primaryFireAnimationName; [SerializeField] private string altFireAnimationName; [SerializeField] private string closeAnimationName; public GameObject lastProjectile; public int PrimaryFireAnimation => Animator.StringToHash(primaryFireAnimationName); public int AltFireAnimation => Animator.StringToHash(altFireAnimationName); public int CloseAnimation => Animator.StringToHash(closeAnimationName); } public class PortalInfo : MonoBehaviour { public GameObject passable; public Renderer[] portalEdgeRenderers; public ParticleSystem spawnParticles; public ParticleSystem ambianceParticles; public Collider[] portalColliders; [Header("Portal Colliders")] public PortalExitCollider playerDetectorTrigger; public PortalExitCollider otherDetectorTrigger; }