using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using HostFurnitureReset.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("LethalCompanyModding")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes furniture for the game host")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+75c48d5b3f65138fd1c009b36d2a9e086f6614f3")]
[assembly: AssemblyProduct("HostFurnitureReset")]
[assembly: AssemblyTitle("dev.mamallama.lcm.hostfurniturereset")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/LethalCompanyModding/HostFurnitureReset")]
[assembly: AssemblyVersion("1.0.2.0")]
[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;
}
}
}
internal static class LCMPluginInfo
{
public const string PLUGIN_GUID = "dev.mamallama.lcm.hostfurniturereset";
public const string PLUGIN_NAME = "HostFurnitureReset";
public const string PLUGIN_VERSION = "1.0.2";
}
namespace HostFurnitureReset
{
[BepInPlugin("dev.mamallama.lcm.hostfurniturereset", "HostFurnitureReset", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("dev.mamallama.lcm.hostfurniturereset");
public static ManualLogSource Log;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin dev.mamallama.lcm.hostfurniturereset is loaded!");
Log = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll(typeof(StartOfRoundPatch));
}
}
}
namespace HostFurnitureReset.Patches
{
public class StartOfRoundPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "Start")]
public static void StartOfRunResetAllItems()
{
Plugin.Log.LogMessage((object)"Reset all furniture now");
if (!NetworkManager.Singleton.IsHost)
{
Plugin.Log.LogMessage((object)"Player is not host, exit");
return;
}
ShipBuildModeManager component = GameObject.Find("Systems/GameSystems/ShipBuildMode").GetComponent<ShipBuildModeManager>();
PlaceableShipObject[] array = Object.FindObjectsByType<PlaceableShipObject>((FindObjectsSortMode)0);
PlaceableShipObject[] array2 = array;
foreach (PlaceableShipObject val in array2)
{
component.ResetShipObjectToDefaultPosition(val);
}
Plugin.Log.LogMessage((object)"Reset all furniture done");
}
}
}