Decompiled source of InverseTeleporterReshMod v1.0.0

InverseTeleporterReshMod.dll

Decompiled 6 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using InverseTeleporterReshMod.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("InverseTeleporterReshMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("InverseTeleporterReshMod")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cc3a5e7f-4825-4764-8d99-b9ac398f52ef")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InverseTeleporterReshMod
{
	[BepInPlugin("Resh.InverseTeleporterReshMod", "Inverse Teleporter Resh Mod", "1.0.0.0")]
	public class InverseTeleporterReshModBase : BaseUnityPlugin
	{
		private const string modGUID = "Resh.InverseTeleporterReshMod";

		private const string modName = "Inverse Teleporter Resh Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Resh.InverseTeleporterReshMod");

		private static InverseTeleporterReshModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Resh.InverseTeleporterReshMod");
			mls.LogInfo((object)"InverseTeleporter mod has awaken");
			harmony.PatchAll(typeof(InverseTeleporterReshModBase));
			harmony.PatchAll(typeof(ShipTeleporterPatch));
			harmony.PatchAll(typeof(ShipTeleporterPatch2));
		}
	}
}
namespace InverseTeleporterReshMod.Patches
{
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporterPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void setCooldownAmount(ref float ___cooldownAmount)
		{
			___cooldownAmount = 10f;
		}
	}
	[HarmonyPatch(typeof(ShipTeleporter))]
	internal class ShipTeleporterPatch2
	{
		[HarmonyPatch("TeleportPlayerOutWithInverseTeleporter")]
		[HarmonyPrefix]
		private static bool TeleportPlayerOutWithInverseTeleporter(ShipTeleporter __instance, ref int playerObj, ref Vector3 teleportPos)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			if (StartOfRound.Instance.allPlayerScripts[playerObj].isPlayerDead)
			{
				StartCoroutine(teleportBodyOut(playerObj, teleportPos));
				return false;
			}
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerObj];
			SetPlayerTeleporterId(val, -1);
			if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(val);
			}
			val.isInElevator = false;
			val.isInHangarShipRoom = false;
			val.isInsideFactory = true;
			val.averageVelocity = 0f;
			val.velocityLastFrame = Vector3.zero;
			StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(teleportPos, false, 0f, false, true);
			StartOfRound.Instance.allPlayerScripts[playerObj].beamOutParticle.Play();
			__instance.shipTeleporterAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
			StartOfRound.Instance.allPlayerScripts[playerObj].movementAudio.PlayOneShot(__instance.teleporterBeamUpSFX);
			if ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				Debug.Log((object)"Teleporter shaking camera");
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			return false;
		}

		private static IEnumerator teleportBodyOut(int playerObj, Vector3 teleportPosition)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return null;
		}

		private static Coroutine StartCoroutine(IEnumerator routine)
		{
			return null;
		}

		private static void SetPlayerTeleporterId(PlayerControllerB playerScript, int teleporterId)
		{
		}
	}
}