You are viewing a potentially older version of this package. View all versions.
dotcom-DestroyedEquipments-1.1.0 icon

DestroyedEquipments

Destroys equipment at 0 durability and refunds part of the crafting materials (base recipe + upgrades). Works on weapons, tools, armor. AzuEPI compatible, configurable, ServerSync.

Date uploaded 3 weeks ago
Version 1.1.0
Download link dotcom-DestroyedEquipments-1.1.0.zip
Downloads 79
Dependency string dotcom-DestroyedEquipments-1.1.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2333 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2333

README

DestroyedEquipments

A Valheim BepInEx mod.

When an item's durability reaches 0, instead of just sitting broken in your inventory, the item is destroyed and a configurable share (default 50%) of the materials used to craft and upgrade it are refunded, as long as the item is craftable.

Features

  • Works on any item that uses durability: weapons, tools, armor, bows, shields.
  • Refund accounts for all upgrade levels the item reached, not just the base recipe.
  • Uncraftable broken items are still destroyed (no refund), or can be left alone (Destroy only craftable items).
  • Refunded materials that don't fit are dropped at your feet (configurable).
  • AzuExtendedPlayerInventory (AzuEPI) compatible: items in AzuEPI's extra equipment/quick slots live in the same player inventory, so they are covered automatically.
  • ServerSync: on a dedicated server the settings are pushed to all clients.

Configuration

Config file dotcom.DestroyedEquipments.cfg (generated on first run):

Setting Default Description
Enabled true Master switch.
Exclude shields false If on, shields are never destroyed when they break (they stay broken like in vanilla).
Refund rate 0.5 Fraction of invested materials returned (0 to 1).
Include upgrade materials true Include every upgrade level up to current quality.
Refund at least one false Return at least 1 of each resource even if rounding gives 0.
Drop overflow on ground true Drop refunds that don't fit instead of losing them.
Destroy only craftable items false If on, uncraftable broken items are left alone.
Notify on destroy true Centered HUD message when an item is destroyed.
Scan interval (seconds) 0.5 How often the inventory is scanned for broken items.

How it works

Valheim fires no event when an item breaks; a 0-durability item simply stays in the inventory, greyed out. The mod therefore polls the local player's inventory on a throttled timer (Player.Update postfix, default every 0.5 s) and, for each broken item, computes the refund from its recipe (ObjectDB.GetRecipe), returns the materials, then removes the item.

Building

Requires the .NET SDK. Dependencies are restored from NuGet, no game install needed to compile:

dotnet build -c Release

Output: bin/Release/DestroyedEquipments.dll (ServerSync is compiled in, single self-contained DLL). Copy it into BepInEx/plugins/.

Credits

License

Released under The Unlicense — public domain. Do whatever you want with this code: copy it, modify it, sell it, ship it in your own mod, claim it as your own. No credit or permission needed. idc.