Decompiled source of SmallSuitRack v1.0.1

Plugins/SmallSuitRack/SmallSuitRack.dll

Decompiled 7 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using SmallSuitRack.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: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("SmallSuitRack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SmallSuitRack")]
[assembly: AssemblyTitle("SmallSuitRack")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SmallSuitRack
{
	[BepInPlugin("Mills.SmallSuitRack", "Small Suits and Rack", "1.0.0.0")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "Mills.SmallSuitRack";

		private const string modName = "Small Suits and Rack";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Mills.SmallSuitRack");

		internal ManualLogSource nls;

		private static ModBase instance;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			nls = Logger.CreateLogSource("Mills.SmallSuitRack");
			harmony.PatchAll(typeof(ModBase));
			harmony.PatchAll(typeof(SmallSuitRackPatch));
		}
	}
}
namespace SmallSuitRack.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class SmallSuitRackPatch
	{
		public static int calls;

		[HarmonyPatch("PositionSuitsOnRack")]
		[HarmonyPostfix]
		private static void PositionSuitsOnRackPatch(ref StartOfRound __instance)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			List<UnlockableSuit> source = Object.FindObjectsOfType<UnlockableSuit>().ToList();
			source = source.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList();
			int num = 0;
			float num2 = 0.5f;
			float num3 = 0.18f;
			num3 *= num2 / 1.75f;
			foreach (UnlockableSuit item in source)
			{
				AutoParentToShip component = ((Component)item).gameObject.GetComponent<AutoParentToShip>();
				component.overrideOffset = true;
				component.positionOffset = new Vector3(-4f, 4f, -8.41f) + __instance.rightmostSuitPosition.forward * num3 * (float)num;
				component.rotationOffset = new Vector3(0f, 90f, 0f);
				num++;
			}
			if (calls < source.Count)
			{
				UnlockableSuit val = source[calls];
				if ((Object)(object)val != (Object)null)
				{
					Vector3 localScale = ((Component)val).transform.localScale;
					localScale.x *= num2;
					localScale.y *= num2;
					localScale.z *= num2 / 1.75f;
					((Component)val).transform.localScale = localScale;
				}
			}
			calls++;
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void LightHeightPatch(ref StartOfRound __instance)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			ShipLights shipRoomLights = __instance.shipRoomLights;
			Vector3 position = ((Component)shipRoomLights).transform.position;
			position.y += 0.5f;
			((Component)shipRoomLights).transform.position = position;
		}
	}
}