Decompiled source of BetterShipDoors v1.0.0

BetterShipDoors.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BetterShipDoors")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Better ship door hydraulics")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterShipDoors")]
[assembly: AssemblyTitle("BetterShipDoors")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BetterShipDoors;

[BepInPlugin("ViViKo.BetterShipDoors", "BetterShipDoors", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(HangarShipDoor))]
	internal class HangarShipDoorPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(ref HangarShipDoor __instance)
		{
			if (!checkedOriginal)
			{
				orginalDuration = __instance.doorPowerDuration;
				checkedOriginal = true;
			}
			__instance.doorPowerDuration = orginalDuration * durationMlt;
		}
	}

	private const string modGUID = "ViViKo.BetterShipDoors";

	private const string modName = "BetterShipDoors";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("ViViKo.BetterShipDoors");

	private static Plugin Instance;

	public static float durationMlt = 5f;

	public static float orginalDuration = 30f;

	public static bool checkedOriginal;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		durationMlt = ((BaseUnityPlugin)this).Config.Bind<float>("General", "durationMultiplier", 5f, "Change the ship doors hydraulics duration").Value;
		durationMlt = Mathf.Clamp(durationMlt, 0.1f, 1000f);
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterShipDoors is loaded!");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "BetterShipDoors";

	public const string PLUGIN_NAME = "BetterShipDoors";

	public const string PLUGIN_VERSION = "1.0.0";
}