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 RetainTPItemsMod.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("HeldItemsWhileTPMOD1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HeldItemsWhileTPMOD1")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("096a4ad4-e26d-426b-af6b-25382daa9b87")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RetainTPItemsMod
{
[BepInPlugin("Shadow.RetainTPItemsMod", "Retain Items After Teleporting Mod", "1.1.0")]
public class RetainTPItemsModBase : BaseUnityPlugin
{
private const string modGUID = "Shadow.RetainTPItemsMod";
private const string modName = "Retain Items After Teleporting Mod";
private const string modVersion = "1.1.0";
private readonly Harmony harmony = new Harmony("Shadow.RetainTPItemsMod");
private static RetainTPItemsModBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Shadow.RetainTPItemsMod");
mls.LogInfo((object)"The Held Items While Teleporting Mod Is Awake");
harmony.PatchAll(typeof(RetainTPItemsModBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(ShipTeleporterAwakePatch));
}
}
}
namespace RetainTPItemsMod.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("DropAllHeldItems")]
internal class PlayerControllerBPatch
{
private static bool Prefix(PlayerControllerB __instance, bool itemsFall, bool disconnecting)
{
if (__instance.isPlayerDead)
{
return true;
}
if (__instance.teleportedLastFrame)
{
return false;
}
for (int i = 0; i < __instance.ItemSlots.Length; i++)
{
}
return true;
}
}
[HarmonyPatch(typeof(ShipTeleporter))]
internal class ShipTeleporterAwakePatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void AwakePatch(ref float ___cooldownAmount, ref float ___cooldownTime)
{
___cooldownAmount = 3f;
___cooldownTime = 3f;
}
}
}