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;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_NoOneLeftBehindAlt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_NoOneLeftBehindAlt")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b631fdc7-8be2-4219-a5b4-a523459032c6")]
[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 LC_NoOneLeftBehindAlt;
[BepInPlugin("Snowlance.LC_NoOneLeftBehindAlt", "LC_NoOneLeftBehindAlt", "1.0.0")]
public class JammedControlsBase : BaseUnityPlugin
{
private const string modGUID = "Snowlance.LC_NoOneLeftBehindAlt";
private const string modName = "LC_NoOneLeftBehindAlt";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Snowlance.LC_NoOneLeftBehindAlt");
private static JammedControlsBase Instance;
public static ManualLogSource LoggerInstance { get; private set; }
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
LoggerInstance = ((BaseUnityPlugin)this).Logger;
LoggerInstance.LogInfo((object)"Plugin LC_NoOneLeftBehindAlt loaded successfully.");
MoveToShipPatch.Init(LoggerInstance);
harmony.PatchAll();
}
}
[HarmonyPatch]
internal static class MoveToShipPatch
{
private static readonly MethodInfo tpPlayer = typeof(StartOfRound).GetMethod("TeleportPlayerInShipIfOutOfRoomBounds", BindingFlags.Instance | BindingFlags.NonPublic);
private static bool aparatusTaken = false;
private static ManualLogSource Logger { get; set; }
public static void Init(ManualLogSource logger)
{
Logger = logger;
}
[HarmonyPatch(typeof(LungProp), "EquipItem")]
[HarmonyPrefix]
public static void ApparatusTaken(StartOfRound __instance)
{
aparatusTaken = true;
}
[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
[HarmonyPrefix]
public static void TpOnShipLeave(StartOfRound __instance)
{
if (!aparatusTaken)
{
Logger.LogInfo((object)"Teleporting player back to the ship...");
tpPlayer?.Invoke(__instance, null);
}
aparatusTaken = false;
}
}