Decompiled source of Im Holding the Lever v1.0.1

ImHoldingTheLever.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CG.Client.Player.Input;
using CG.Client.Ship.Interactions;
using CG.Game.SpaceObjects.Controllers;
using CG.Ship.Modules;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.MPModChecks;
using VoidManager.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ImHoldingTheLever")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ImHoldingTheLever")]
[assembly: AssemblyTitle("ImHoldingTheLever")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ImHoldingTheLever
{
	[HarmonyPatch(typeof(VoidDriveModule))]
	internal class Action
	{
		internal static VoidDriveModule shipVoidDrive;

		internal static bool notified;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void FindShip(VoidDriveModule __instance)
		{
			shipVoidDrive = __instance;
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateOn")]
		public static void triggerVoidJumpOnFullLever()
		{
			if ((Object)(object)shipVoidDrive == (Object)null)
			{
				return;
			}
			Lever voidJumpLever = shipVoidDrive.VoidJumpLever;
			if ((Object)(object)voidJumpLever == (Object)null || (Object)(object)getMap.jumpSystem == (Object)null)
			{
				return;
			}
			if (shipVoidDrive.IsFullyCharged && voidJumpLever.LeverPosition >= 1f)
			{
				if (getMap.jumpSystem.IsExitVectorSet())
				{
					DebugInput.DebugImpulseJump();
				}
				else if (!notified)
				{
					Messaging.Notification("Cannot jump without having an exit vector set.", false);
					notified = true;
				}
			}
			if ((double)voidJumpLever.LeverPosition < 0.5)
			{
				notified = false;
			}
		}
	}
	[HarmonyPatch(typeof(VoidJumpSystem))]
	internal class getMap
	{
		internal static VoidJumpSystem jumpSystem;

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		internal static void getVoidSectorMap(VoidJumpSystem __instance)
		{
			jumpSystem = __instance;
		}
	}
	public class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Gruncle_Chuck.ImHoldingTheLever";

		public const string PLUGIN_NAME = "ImHoldingTheLever";

		public const string USERS_PLUGIN_NAME = " I'm Holding the Lever";

		public const string PLUGIN_VERSION = "1.0.1";

		public const string PLUGIN_DESCRIPTION = "While holding the lever down, when the drive hits 100%, activates the void drive.";

		public const string PLUGIN_ORIGINAL_AUTHOR = "Gruncle_Chuck";

		public const string PLUGIN_AUTHORS = "Gruncle Chuck";

		public const string PLUGIN_THUNDERSTORE_ID = "";
	}
	[BepInPlugin("Gruncle_Chuck.ImHoldingTheLever", " I'm Holding the Lever", "1.0.1")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource log;

		private void Awake()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Gruncle_Chuck.ImHoldingTheLever is loaded!");
		}
	}
	internal class VoidManagerPlugin : VoidPlugin
	{
		public override string Author => "Gruncle Chuck";

		public override string Description => "While holding the lever down, when the drive hits 100%, activates the void drive.";

		public override string ThunderstoreID => "";

		public override MultiplayerType MPType => (MultiplayerType)8;
	}
}