Decompiled source of RotateBackwards v1.0.0

Coltrain.RotateBackwards.dll

Decompiled a year 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Coltrain.RotateBackwards")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rotate ship objects backwards")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e5ecebc8c508e4b14a160eb31125c58c58991187")]
[assembly: AssemblyProduct("Rotate Backwards")]
[assembly: AssemblyTitle("Coltrain.RotateBackwards")]
[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 LCRotateBackwards
{
	[BepInPlugin("Coltrain.RotateBackwards", "Rotate Backwards", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("Coltrain.RotateBackwards");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Coltrain.RotateBackwards is loaded!");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	[HarmonyPatch]
	internal class RotationPatch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(ShipBuildModeManager), "Update", (Type[])null, (Type[])null);
		}

		private static void Postfix(ref ShipBuildModeManager __instance)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.InBuildMode || !IngamePlayerSettings.Instance.playerInput.actions.FindAction("Sprint", false).IsPressed())
			{
				return;
			}
			if (!IngamePlayerSettings.Instance.playerInput.actions.FindAction("ReloadBatteries", false).IsPressed())
			{
				if (!StartOfRound.Instance.localPlayerUsingController)
				{
					return;
				}
				MovementActions movement = __instance.playerActions.Movement;
				if (!((MovementActions)(ref movement)).InspectItem.IsPressed())
				{
					return;
				}
			}
			Vector3 eulerAngles = __instance.ghostObject.eulerAngles;
			__instance.ghostObject.eulerAngles = new Vector3(eulerAngles.x, eulerAngles.y - Time.deltaTime * 2f * 155f, eulerAngles.z);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Coltrain.RotateBackwards";

		public const string PLUGIN_NAME = "Rotate Backwards";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}