Decompiled source of BetterDecorPlacement v1.2.1

BetterDecorPlacement.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("BetterDecorPlacement")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Removes restrictions when placing/moving ship objects")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
[assembly: AssemblyProduct("BetterDecorPlacement")]
[assembly: AssemblyTitle("BetterDecorPlacement")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BetterDecorPlacement
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("viviko.BetterDecorPlacement", "BetterDecorPlacement", "1.2.1")]
	public class BetterDecorPlacement : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StartOfRound))]
		internal class StartOfRoundPatch
		{
			[HarmonyPatch("Awake")]
			[HarmonyPostfix]
			private static void AwakePatch(ref StartOfRound __instance)
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>();
				for (int i = 0; i < array.Length; i++)
				{
					if (!defaultTransforms.ContainsKey(array[i].unlockableID) && !__instance.unlockablesList.unlockables[array[i].unlockableID].spawnPrefab)
					{
						defaultTransforms.Add(array[i].unlockableID, new List<Vector3>(2)
						{
							((Component)array[i].placeObjectCollider).transform.position,
							((Component)array[i].mainMesh).transform.eulerAngles
						});
					}
				}
			}
		}

		[HarmonyPatch(typeof(ShipBuildModeManager))]
		internal class ShipBuildModeManagerPatch
		{
			[HarmonyPatch("PlayerMeetsConditionsToBuild")]
			[HarmonyPrefix]
			private static bool PlayerMeetsConditionsToBuildPrePatch(ref ShipBuildModeManager __instance, ref bool __result)
			{
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.InBuildMode && ((Object)(object)__instance.placingObject == (Object)null || __instance.placingObject.inUse || StartOfRound.Instance.unlockablesList.unlockables[__instance.placingObject.unlockableID].inStorage))
				{
					__result = false;
					return false;
				}
				if (GameNetworkManager.Instance.localPlayerController.isTypingChat)
				{
					__result = false;
					return false;
				}
				if (__instance.player.isPlayerDead || __instance.player.inSpecialInteractAnimation || __instance.player.activatingItem)
				{
					__result = false;
					return false;
				}
				if (__instance.player.disablingJetpackControls || __instance.player.jetpackControls)
				{
					__result = false;
					return false;
				}
				if (bypassAllRestritions.Value)
				{
					__result = true;
					return false;
				}
				if (!__instance.player.isInHangarShipRoom && !buildOutside.Value)
				{
					__result = false;
					return false;
				}
				AnimatorStateInfo currentAnimatorStateInfo = StartOfRound.Instance.shipAnimator.GetCurrentAnimatorStateInfo(0);
				if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).tagHash != Animator.StringToHash("ShipIdle") && !buildWhileMoving.Value)
				{
					__result = false;
					return false;
				}
				__result = true;
				return false;
			}

			[HarmonyPatch("ConfirmBuildMode_performed")]
			[HarmonyPrefix]
			private static void ConfirmBuildMode_performedPrePatch(ref ShipBuildModeManager __instance)
			{
				if (bypassAllRestritions.Value || buildOutside.Value)
				{
					__instance.CanConfirmPosition = true;
				}
			}

			[HarmonyPatch("EnterBuildMode")]
			[HarmonyPrefix]
			private static void EnterBuildModePrePatch(ref ShipBuildModeManager __instance)
			{
				if (bypassAllRestritions.Value || buildOutside.Value)
				{
					__instance.CanConfirmPosition = true;
				}
			}

			[HarmonyPatch("EnterBuildMode")]
			[HarmonyPostfix]
			private static void EnterBuildModePostPatch(ref ShipBuildModeManager __instance)
			{
				if (bypassAllRestritions.Value && !((Object)(object)__instance.placingObject == (Object)null))
				{
					__instance.placingObject.AllowPlacementOnCounters = true;
					__instance.placingObject.AllowPlacementOnWalls = true;
				}
			}

			[HarmonyPatch("Update")]
			[HarmonyPostfix]
			private static void UpdatePatch(ref ShipBuildModeManager __instance)
			{
				if (__instance.InBuildMode && Object.op_Implicit((Object)(object)__instance.ghostObjectRenderer) && (bypassAllRestritions.Value || buildOutside.Value))
				{
					((Renderer)__instance.ghostObjectRenderer).sharedMaterial = __instance.ghostObjectGreen;
				}
			}

			[HarmonyPatch("Update")]
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Expected O, but got Unknown
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				for (int i = 0; i < list.Count; i++)
				{
					CodeInstruction val = list[i];
					if (val.opcode == OpCodes.Ldc_R4)
					{
						if ((float)val.operand == 20f)
						{
							list[i] = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BetterDecorPlacement), "GetPlacementRange", (Type[])null, (Type[])null));
						}
						else if ((float)val.operand == 4f)
						{
							list[i] = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BetterDecorPlacement), "GetPlacementRange", (Type[])null, (Type[])null));
						}
					}
				}
				return list.AsEnumerable();
			}

			[HarmonyPatch("PlaceShipObject")]
			[HarmonyPrefix]
			private static bool PlaceShipObjectPatch(Vector3 placementPosition, Vector3 placementRotation, PlaceableShipObject placeableObject, bool placementSFX = true)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: 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)
				//IL_0164: Unknown result type (might be due to invalid IL or missing references)
				//IL_0169: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_018b: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_01da: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: Unknown result type (might be due to invalid IL or missing references)
				//IL_0219: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				StartOfRound.Instance.suckingFurnitureOutOfShip = false;
				StartOfRound.Instance.unlockablesList.unlockables[placeableObject.unlockableID].placedPosition = placementPosition;
				StartOfRound.Instance.unlockablesList.unlockables[placeableObject.unlockableID].placedRotation = placementRotation;
				Debug.Log((object)$"Saving placed position as: {placementPosition}");
				StartOfRound.Instance.unlockablesList.unlockables[placeableObject.unlockableID].hasBeenMoved = true;
				if ((Object)(object)placeableObject.parentObjectSecondary != (Object)null)
				{
					Quaternion val = Quaternion.Euler(placementRotation) * Quaternion.Inverse(((Component)placeableObject.mainMesh).transform.rotation);
					((Component)placeableObject.parentObjectSecondary).transform.rotation = val * ((Component)placeableObject.parentObjectSecondary).transform.rotation;
					placeableObject.parentObjectSecondary.position = placementPosition + (((Component)placeableObject.parentObjectSecondary).transform.position - ((Component)placeableObject.mainMesh).transform.position) + (((Component)placeableObject.mainMesh).transform.position - ((Component)placeableObject.placeObjectCollider).transform.position);
				}
				else if ((Object)(object)placeableObject.parentObject != (Object)null)
				{
					Quaternion val2 = Quaternion.Euler(placementRotation) * Quaternion.Inverse(((Component)placeableObject.mainMesh).transform.rotation);
					AutoParentToShip parentObject = placeableObject.parentObject;
					Quaternion val3 = val2 * ((Component)placeableObject.parentObject).transform.rotation;
					parentObject.rotationOffset = ((Quaternion)(ref val3)).eulerAngles;
					((Component)placeableObject.parentObject).transform.rotation = val2 * ((Component)placeableObject.parentObject).transform.rotation;
					placeableObject.parentObject.positionOffset = StartOfRound.Instance.elevatorTransform.InverseTransformPoint(placementPosition + (((Component)placeableObject.parentObject).transform.position - ((Component)placeableObject.mainMesh).transform.position) + (((Component)placeableObject.mainMesh).transform.position - ((Component)placeableObject.placeObjectCollider).transform.position));
				}
				if (placementSFX)
				{
					((Component)placeableObject).GetComponent<AudioSource>().PlayOneShot(placeableObject.placeObjectSFX);
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(ShipBuildModeManager))]
		internal class ShipBuildModeManagerPatch2
		{
			[HarmonyPatch("EnterBuildMode")]
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Expected O, but got Unknown
				List<CodeInstruction> list = new List<CodeInstruction>(instructions);
				for (int i = 0; i < list.Count; i++)
				{
					CodeInstruction val = list[i];
					if (val.opcode == OpCodes.Ldc_R4)
					{
						if ((float)val.operand == 5f)
						{
							list[i] = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BetterDecorPlacement), "GetUpInteractRange", (Type[])null, (Type[])null));
						}
						else if ((float)val.operand == 4f)
						{
							list[i] = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BetterDecorPlacement), "GetForwardInteractRange", (Type[])null, (Type[])null));
						}
					}
				}
				return list.AsEnumerable();
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		internal class PlayerControllerBPatch
		{
			[HarmonyPatch("Interact_performed")]
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Expected O, but got Unknown
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected O, but got Unknown
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Expected O, but got Unknown
				CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[3]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Call), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldc_I4_1), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, typeof(ShipBuildModeManager).GetMethod("CancelBuildMode", BindingFlags.Instance | BindingFlags.Public))), (string)null)
				};
				CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
				val.Start();
				val.MatchForward(false, array);
				val.SetAndAdvance(OpCodes.Call, (object)AccessTools.Method(typeof(BetterDecorPlacement), "CancelBuildModeOnInteract", (Type[])null, (Type[])null));
				val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Nop, (object)null));
				val.SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null));
				return val.Instructions();
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static GenericButtonHandler <>9__19_0;

			internal void <CreateConfigs>b__19_0()
			{
				FixShipObjects();
			}
		}

		private const string modGUID = "viviko.BetterDecorPlacement";

		private const string modName = "BetterDecorPlacement";

		private const string modVersion = "1.2.1";

		public static ConfigEntry<float> placementRange;

		public static ConfigEntry<float> interactRange;

		public static ConfigEntry<bool> bypassAllRestritions;

		public static ConfigEntry<bool> buildOutside;

		public static ConfigEntry<bool> buildInside;

		public static ConfigEntry<bool> buildWhileMoving;

		private readonly Harmony harmony = new Harmony("viviko.BetterDecorPlacement");

		private static BetterDecorPlacement Instance;

		public static ManualLogSource mls;

		public static Dictionary<int, List<Vector3>> defaultTransforms = new Dictionary<int, List<Vector3>>();

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("BetterDecorPlacement");
			CreateConfigs();
			harmony.PatchAll();
			mls.LogInfo((object)"Plugin BetterDecorPlacement is loaded!");
		}

		public static float GetPlacementRange()
		{
			return placementRange.Value;
		}

		public static float GetUpInteractRange()
		{
			return interactRange.Value;
		}

		public static float GetForwardInteractRange()
		{
			return interactRange.Value - 1f;
		}

		public static void CancelBuildModeOnInteract()
		{
			if (!buildInside.Value)
			{
				ShipBuildModeManager.Instance.CancelBuildMode(true);
			}
		}

		public static void FixShipObjects()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (!StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID].inStorage && !StartOfRound.Instance.unlockablesList.unlockables[array[i].unlockableID].spawnPrefab && defaultTransforms.TryGetValue(array[i].unlockableID, out List<Vector3> value))
				{
					ShipBuildModeManager.Instance.PlaceShipObject(value[0], value[1], array[i], true);
					ShipBuildModeManager.Instance.PlaceShipObjectServerRpc(value[0], value[1], NetworkObjectReference.op_Implicit(((Component)array[i].parentObject).GetComponent<NetworkObject>()), (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
				}
			}
		}

		public static void CreateConfigs()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Expected O, but got Unknown
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Expected O, but got Unknown
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Expected O, but got Unknown
			((BaseUnityPlugin)Instance).Config.SaveOnConfigSet = true;
			LethalConfigManager.SetModDescription("Various Building tweaks");
			bypassAllRestritions = ((BaseUnityPlugin)Instance).Config.Bind<bool>("General", "BypassRestrictions", true, new ConfigDescription("Bypass all building restrictions", (AcceptableValueBase)null, Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(bypassAllRestritions, new BoolCheckBoxOptions
			{
				Name = "Bypass All Restrictions",
				RequiresRestart = false
			}));
			buildOutside = ((BaseUnityPlugin)Instance).Config.Bind<bool>("General", "BuildOutside", true, new ConfigDescription("Allow placement/building outside the ship", (AcceptableValueBase)null, Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(buildOutside, new BoolCheckBoxOptions
			{
				Name = ((ConfigEntryBase)buildOutside).Description.Description,
				RequiresRestart = false
			}));
			buildInside = ((BaseUnityPlugin)Instance).Config.Bind<bool>("General", "BuildInside", false, new ConfigDescription("Allow placement/building inside the facility", (AcceptableValueBase)null, Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(buildInside, new BoolCheckBoxOptions
			{
				Name = ((ConfigEntryBase)buildInside).Description.Description,
				RequiresRestart = false
			}));
			buildWhileMoving = ((BaseUnityPlugin)Instance).Config.Bind<bool>("General", "BuildWhileMoving", true, new ConfigDescription("Allow placement/building even if the ship is moving", (AcceptableValueBase)null, Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(buildWhileMoving, new BoolCheckBoxOptions
			{
				Name = ((ConfigEntryBase)buildWhileMoving).Description.Description,
				RequiresRestart = false
			}));
			placementRange = ((BaseUnityPlugin)Instance).Config.Bind<float>("General", "PlacementRange", 50f, new ConfigDescription("Adjust the placement range", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(placementRange, new FloatSliderOptions
			{
				Name = "Placement Range",
				Min = 1f,
				Max = 1000f,
				RequiresRestart = false
			}));
			interactRange = ((BaseUnityPlugin)Instance).Config.Bind<float>("General", "InteractRange", 20f, new ConfigDescription("Adjust the interact range", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>()));
			LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(interactRange, new FloatSliderOptions
			{
				Name = "Interact Range",
				Min = 1f,
				Max = 1000f,
				RequiresRestart = false
			}));
			object obj = <>c.<>9__19_0;
			if (obj == null)
			{
				GenericButtonHandler val = delegate
				{
					FixShipObjects();
				};
				<>c.<>9__19_0 = val;
				obj = (object)val;
			}
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem("Help", "Reset Ship Objects", "Resets ship objects to default position in case they become unreachable", "Reset", (GenericButtonHandler)obj));
		}
	}
	internal static class GeneratedPluginInfo
	{
		public const string Identifier = "viviko.BetterDecorPlacement";

		public const string Name = "BetterDecorPlacement";

		public const string Version = "1.2.1";
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}