using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
[assembly: AssemblyCompany("LethalCompanyKeepFurniture")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5d06e91c7b369045a99a9a38a49ff9695d4145a9")]
[assembly: AssemblyProduct("LethalCompanyKeepFurniture")]
[assembly: AssemblyTitle("LethalCompanyKeepFurniture")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : System.Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class NullableAttribute : System.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]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class NullableContextAttribute : System.Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(/*Could not decode attribute arguments.*/)]
internal sealed class RefSafetyRulesAttribute : System.Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace LethalCompanyKeepFurniture
{
[BepInPlugin("PixL.KeepFurniture", "KeepFurniture", "1.0.0.0")]
public class Mod : BaseUnityPlugin
{
public const string modGUID = "PixL.KeepFurniture";
public const string modName = "KeepFurniture";
public const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("PixL.KeepFurniture");
public static ManualLogSource Log;
private void Awake()
{
Log = Logger.CreateLogSource("PixL.KeepFurniture");
harmony.PatchAll(typeof(KeepFurniture));
}
}
internal class KeepFurniture
{
[HarmonyPatch(typeof(StartOfRound), "ResetShipFurniture")]
[HarmonyPrefix]
private static bool ResetShipFurniture(ref StartOfRound __instance)
{
PlaceableShipObject[] array = Object.FindObjectsOfType<PlaceableShipObject>();
foreach (PlaceableShipObject val in array)
{
if (!((Object)(object)val.parentObject == (Object)null))
{
Collider[] componentsInChildren = ((Component)val.parentObject).GetComponentsInChildren<Collider>();
for (int j = 0; j < componentsInChildren.Length; j++)
{
componentsInChildren[j].enabled = true;
}
}
}
return false;
}
[HarmonyPatch(typeof(GameNetworkManager), "ResetUnlockablesListValues")]
[HarmonyPrefix]
private static bool ResetUnlockablesListValues()
{
return false;
}
[HarmonyPatch(typeof(ES3), "DeleteKey", new System.Type[]
{
typeof(string),
typeof(string)
})]
[HarmonyPrefix]
private static bool ES3DeleteKey(string key, string filePath)
{
if (key == "UnlockedShipObjects" || key.StartsWith("ShipUnlock"))
{
return false;
}
return true;
}
}
}