Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DeathPenaltyNoEquippable v1.0.1
IronLabs.DeathPenaltyNoEquippable.dll
Decompiled 9 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("IronLabs.DeathPenaltyNoEquippable")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IronLabs.DeathPenaltyNoEquippable")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("CAA46083-A0C5-4FFC-9180-99BE40D8CAA1")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.1.0")] namespace IronLabs.DeathPenaltyNoEquippable; internal static class DeathInventory { internal static void CreateTombstone(Player player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory.NrOfItems() != 0) { GameObject obj = Object.Instantiate<GameObject>(player.m_tombstone, ((Character)player).GetCenterPoint(), ((Component)player).transform.rotation); Inventory inventory2 = obj.GetComponent<Container>().GetInventory(); int num = MoveNonEquippableItems(inventory, inventory2); SetupTombstone(obj); ModLog.LogInfo($"Death inventory split: kept={inventory.NrOfItems()}, " + $"movedToTombstone={num}."); } } private static int MoveNonEquippableItems(Inventory playerInventory, Inventory graveInventory) { List<ItemData> list = new List<ItemData>(playerInventory.GetAllItems()); int num = 0; foreach (ItemData item in list) { if (!item.IsEquipable() && MoveItem(playerInventory, graveInventory, item)) { num++; } } return num; } private static bool MoveItem(Inventory playerInventory, Inventory graveInventory, ItemData item) { if (!graveInventory.AddItem(item)) { ModLog.LogWarning("The tombstone had no room for " + item.m_shared.m_name + "; the item was kept by the player."); return false; } return playerInventory.RemoveItem(item); } private static void SetupTombstone(GameObject tombstone) { PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); tombstone.GetComponent<TombStone>().Setup(playerProfile.GetName(), playerProfile.GetPlayerID()); } } [BepInPlugin("IronLabs.DeathPenaltyNoEquippable", "IronLabs.DeathPenaltyNoEquippable", "1.0.1")] public sealed class DeathPenaltyNoEquippablePlugin : BaseUnityPlugin { private const string PluginGuid = "IronLabs.DeathPenaltyNoEquippable"; private const string PluginName = "IronLabs.DeathPenaltyNoEquippable"; private const string PluginVersion = "1.0.1"; private readonly Harmony _harmony = new Harmony("IronLabs.DeathPenaltyNoEquippable"); private static bool _patchesApplied; private void Awake() { ModLog.Initialize(((BaseUnityPlugin)this).Logger, "IronLabs.DeathPenaltyNoEquippable"); PatchOwnNamespace(); ModLog.LogInfo("IronLabs.DeathPenaltyNoEquippable 1.0.1 is loaded."); } private void PatchOwnNamespace() { if (_patchesApplied) { ModLog.LogDebug("Harmony patches are already active; skipping registration."); return; } string text = typeof(DeathPenaltyNoEquippablePlugin).Namespace; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { if (type.Namespace == text) { _harmony.CreateClassProcessor(type).Patch(); } } _patchesApplied = true; ModLog.LogDebug("Harmony patches were applied for the plugin namespace."); } private void OnDestroy() { if (_patchesApplied) { _harmony.UnpatchSelf(); _patchesApplied = false; } ModLog.Clear(); } } internal static class ModLog { private static ManualLogSource _logger; private static string _pluginName; internal static void Initialize(ManualLogSource logger, string pluginName) { _logger = logger; _pluginName = pluginName; } internal static void Clear() { _logger = null; _pluginName = null; } internal static void LogDebug(object message) { Write((LogLevel)32, message); } internal static void LogInfo(object message) { Write((LogLevel)16, message); } internal static void LogWarning(object message) { Write((LogLevel)4, message); } private static void Write(LogLevel level, object message) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource logger = _logger; if (logger != null) { logger.Log(level, message); } } } [HarmonyPatch(typeof(Player), "CreateTombStone")] internal static class CreateTombstonePatch { private static bool Prefix(Player __instance) { DeathInventory.CreateTombstone(__instance); return false; } }