Decompiled source of ERB InverseOutsidePatch v0.0.1

ERB_InverseOutsidePatch.dll

Decompiled 2 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using ERB_InverseOutsidePatch.NetcodePatcher;
using EnhancedRadarBooster;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ERB_InverseOutsidePatch")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ERB_InverseOutsidePatch")]
[assembly: AssemblyTitle("ERB_InverseOutsidePatch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ERB_InverseOutsidePatch
{
	[BepInPlugin("ZetaArcade.ERB_InverseOutsidePatch", "ERB_InverseOutsidePatch", "0.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ERB_InverseOutsidePatch : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ShipTeleporter))]
		internal static class RadarBoosterTeleportPatch
		{
			private static AudioReverbPresets cachedPresets;

			[HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")]
			[HarmonyPostfix]
			[HarmonyPriority(0)]
			private static void FixBlackScreenTeleport(int playerObj, Vector3 teleportPos)
			{
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				if (!Config.itpToRBEnabledValue)
				{
					return;
				}
				ManualCameraRenderer mapScreen = StartOfRound.Instance.mapScreen;
				if ((Object)(object)mapScreen == (Object)null || mapScreen.targetTransformIndex < 0 || mapScreen.targetTransformIndex >= mapScreen.radarTargets.Count)
				{
					return;
				}
				TransformAndName val = mapScreen.radarTargets[mapScreen.targetTransformIndex];
				if (!val.isNonPlayer || (Object)(object)val.transform == (Object)null)
				{
					return;
				}
				RadarBoosterItem component = ((Component)val.transform).GetComponent<RadarBoosterItem>();
				if ((Object)(object)component == (Object)null || ((GrabbableObject)component).isInFactory || Vector3.Distance(teleportPos, ((Component)component).transform.position) > 1f)
				{
					return;
				}
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[playerObj];
				if (val2.isPlayerDead)
				{
					return;
				}
				val2.isInsideFactory = false;
				val2.isInElevator = ((GrabbableObject)component).isInElevator;
				val2.isInHangarShipRoom = ((GrabbableObject)component).isInShipRoom;
				if (!val2.isInElevator)
				{
					if ((Object)(object)cachedPresets == (Object)null)
					{
						cachedPresets = Object.FindObjectOfType<AudioReverbPresets>();
					}
					if ((Object)(object)cachedPresets != (Object)null && cachedPresets.audioPresets.Length > 3)
					{
						cachedPresets.audioPresets[3].ChangeAudioReverbForPlayer(val2);
					}
				}
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if ((Object)(object)val2 == (Object)(object)localPlayerController || ((Object)(object)localPlayerController != (Object)null && localPlayerController.isPlayerDead && (Object)(object)localPlayerController.spectatedPlayerScript == (Object)(object)val2))
				{
					TimeOfDay.Instance.insideLighting = val2.isInHangarShipRoom;
					TimeOfDay.Instance.SetInsideLightingDimness(true, val2.isInHangarShipRoom);
				}
			}
		}

		private Harmony harmony = new Harmony("ZetaArcade.ERB_InverseOutsidePatch");

		public static ManualLogSource Logger;

		public static ERB_InverseOutsidePatch Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin is loaded!");
		}
	}
	internal class PluginInfo
	{
		public const string modGUID = "ZetaArcade.ERB_InverseOutsidePatch";

		public const string modName = "ERB_InverseOutsidePatch";

		public const string modVersion = "0.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace ERB_InverseOutsidePatch.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}