Decompiled source of ShipInventory WiderShipFix v1.0.0

BepInEx/Plugins/ShipInventoryFix.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
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.Bootstrap;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ShipInventoryFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Fixes the position with wider ship mod")]
[assembly: AssemblyTitle("ShipInventoryFix")]
[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 ShipInventoryFix
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.atomic.shipinventoryfix", "Ship Inventory Fix", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		private void Awake()
		{
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (((Scene)(ref scene)).name == "SampleSceneRelay")
			{
				GameObject val = GameObject.Find("Environment");
				val.AddComponent<Attached>();
			}
		}
	}
	public class Attached : MonoBehaviour
	{
		private bool isfound = false;

		private bool is2StoryModInstalled = false;

		private bool checkedMod = false;

		private void CheckIfWiderShipModInstalled()
		{
			checkedMod = true;
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				BepInPlugin metadata = pluginInfo.Value.Metadata;
				if (metadata.GUID.Equals("MelanieMelicious.2StoryShip"))
				{
					is2StoryModInstalled = true;
				}
			}
		}

		private void Update()
		{
			if (!checkedMod)
			{
				CheckIfWiderShipModInstalled();
			}
			if (!isfound)
			{
				MoveInventory();
				return;
			}
			GameObject val = GameObject.Find("Environment");
			Object.Destroy((Object)(object)val.GetComponent<Main>());
		}

		private void MoveInventory()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("VentChute(Clone)");
			Debug.LogError((object)"Trying to find");
			if ((Object)(object)val != (Object)null)
			{
				Debug.LogError((object)"Found");
				if (is2StoryModInstalled)
				{
					val.transform.localPosition = new Vector3(4.39f, 0.9509f, -2.09f);
					val.transform.localRotation = Quaternion.Euler(31.4869f, 307.1009f, 359.7217f);
					isfound = true;
				}
				else
				{
					val.transform.localPosition = new Vector3(3.6782f, 0.7673f, -2.2573f);
					val.transform.localRotation = Quaternion.Euler(35.0012f, 61.3801f, 0f);
					isfound = true;
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ShipInventoryFix";

		public const string PLUGIN_NAME = "Fixes the position with wider ship mod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}