Decompiled source of LC NoOneLeftBehind v1.0.0

BepInEx/plugins/LC_NoOneLeftBehind.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LC_NoOneLeftBehind.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LC_NoOneLeftBehind")]
[assembly: AssemblyDescription("LC_NoOneLeftBehind")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("STAR-B")]
[assembly: AssemblyProduct("LC_NoOneLeftBehind")]
[assembly: AssemblyCopyright("Copyright © STAR-B 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ead29cd0-c983-4f41-a6b7-909db5d694e9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_NoOneLeftBehind
{
	[BepInPlugin("STAR-B.LC_NoOneLeftBehind", "LC No One Left Behind", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource obj = Logger.CreateLogSource("STAR-B.LC_NoOneLeftBehind");
			MoveToShipPatch.Init(obj);
			new Harmony("STAR-B.LC_NoOneLeftBehind").PatchAll(typeof(MoveToShipPatch));
			obj.LogInfo((object)string.Format("{0} has loaded!", "LC No One Left Behind"));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "STAR-B.LC_NoOneLeftBehind";

		public const string PLUGIN_NAME = "LC No One Left Behind";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LC_NoOneLeftBehind.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal static class MoveToShipPatch
	{
		private static readonly MethodInfo tpPlayer = typeof(StartOfRound).GetMethod("TeleportPlayerInShipIfOutOfRoomBounds", BindingFlags.Instance | BindingFlags.NonPublic);

		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		[HarmonyPatch("ShipLeave")]
		[HarmonyPrefix]
		public static void TpOnShipLeave(StartOfRound __instance)
		{
			Logger.LogInfo((object)"Teleporting player back to the ship...");
			tpPlayer?.Invoke(__instance, null);
		}
	}
}