Decompiled source of NoDeathDespawn v1.0.0

plugins/NoDeathDespawn/NoDeathDespawn.dll

Decompiled a year ago
using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Camerin Figueroa")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © RaspberryProgramming 2023")]
[assembly: AssemblyDescription("Lethal Company Mod to prevent Despawning of items after all players die.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoDeathDespawn")]
[assembly: AssemblyTitle("NoDeathDespawn")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/RaspberryProgramming/NoDeathDespawn")]
[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 NoDeathDespawn
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NoDeathDespawn";

		public const string PLUGIN_NAME = "NoDeathDespawn";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace NoDeathDespawn.NoDeathDespawn
{
	[BepInPlugin("com.github.raspberryprogramming.NoDeathDespawn", "NoDeathDespawn", "1.0")]
	internal class NoDeathDespawn : BaseUnityPlugin
	{
		public const string GUID = "com.github.raspberryprogramming.NoDeathDespawn";

		public const string NAME = "NoDeathDespawn";

		public const string VERSION = "1.0";

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogMessage((object)"Starting NoDeathDespawn Patching");
			new Harmony("com.github.raspberryprogramming.NoDeathDespawn").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
}
namespace NoDeathDespawn.NoDeathDespawn.Patches
{
	[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
	internal class RoundManagerPatcher
	{
		public static void Prefix(bool despawnAllItems)
		{
			Singleton.Instance.allPlayersDead = StartOfRound.Instance.allPlayersDead;
			StartOfRound.Instance.allPlayersDead = false;
		}

		private static void Postfix(bool despawnAllItems)
		{
			StartOfRound.Instance.allPlayersDead = Singleton.Instance.allPlayersDead;
		}
	}
	public sealed class Singleton
	{
		public bool allPlayersDead;

		private static readonly Lazy<Singleton> lazy = new Lazy<Singleton>(() => new Singleton());

		public static Singleton Instance => lazy.Value;

		private Singleton()
		{
		}
	}
}