using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using TeleporterCooldown.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("TeleporterCooldown")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TeleporterCooldown")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ba89487f-55bc-4517-ad14-5579b224c8bd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TeleporterCooldown
{
[BepInPlugin("SpiralMods.EditTeleporterCooldown", "EditTeleporterCooldown", "1.0.3")]
public class TeleporterCooldownBase : BaseUnityPlugin
{
private const string modGUID = "SpiralMods.EditTeleporterCooldown";
private const string modName = "EditTeleporterCooldown";
private const string modVersion = "1.0.3";
public static ConfigEntry<float> TeleporterCooldown;
public static ConfigEntry<float> InverseTeleporterCooldown;
private readonly Harmony harmony = new Harmony("SpiralMods.EditTeleporterCooldown");
private static TeleporterCooldownBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("SpiralMods.EditTeleporterCooldown");
mls.LogInfo((object)"EditTeleporterCooldown has loaded (ModVersion: 1.0.3, ModGUID: SpiralMods.EditTeleporterCooldown)!");
SetBindings();
harmony.PatchAll(typeof(TeleporterPatch));
}
private void SetBindings()
{
TeleporterCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Settings (Restart Required)", "Teleporter Cooldown", 10f, "This is the amount of time the teleporter will be disable for.");
InverseTeleporterCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Settings (Restart Required)", "Inverse Teleporter Cooldown", 210f, "This is the amount of time the inverse teleporter will be disable for.");
}
}
}
namespace TeleporterCooldown.Patches
{
[HarmonyPatch(typeof(ShipTeleporter))]
internal class TeleporterPatch
{
[HarmonyPatch("PressTeleportButtonClientRpc")]
[HarmonyPostfix]
private static void PressTeleportButtonClientRpc(ref float ___cooldownTime, ref bool ___isInverseTeleporter)
{
if (!___isInverseTeleporter)
{
___cooldownTime = TeleporterCooldownBase.TeleporterCooldown.Value;
}
if (___isInverseTeleporter)
{
___cooldownTime = TeleporterCooldownBase.InverseTeleporterCooldown.Value;
}
}
}
}