1. For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
    Dismiss Notice

tModLoader Durability

Discussion in 'Released' started by hamstar, Nov 28, 2016.

  1. hamstar

    hamstar Steampunker

    Note: Requires Mod Helpers

    This mod adds durability to weapons, tools, and armor. Durability (approx. number of uses) is calculated based on the following formula:
    Sell value of = x, Avg hits per second = y:
    0.71 * ( (y/4 * x^1.54) / (5 + x) ) + 50
    Value of valueless items:
    (dmg * y/4 * 1000 + def * 1000) * rarity

    Increased x2 if the item is armor or a tool.
    Tools and weapons can be repaired by reforging with the Goblin Tinkerer, and armor can be repaired with a Smithing Hammer (purchased from the goblin) at an anvil. Items degrade with repairs, and can be rendered unable to be repaired. Items that break from durability loss become disabled until repaired.

    Also, you may adjust mod settings in the configuration file found at 'Documents/My Games/Terraria/ModLoader/Mod Configs/Durability Config.json'.

    Source code available. API now available.

    Note for mod authors: Mods can freely adjust config settings via. weak reference, but they are not automatically saved to file.


    Requires tModLoader (0.10). Copy the above .tmod file to your 'Documents/My Games/Terraria/ModLoader/Mods' folder to play.

    • Updated to MH v4.2.3
    • Changed snake case to camel case
    • Added some minor error checks
    • Switched config to use mod version for settings updates
    • Updating for Mod Helpers v2.0.2
    • Restructured player code
    • Assorted updates
    • NOTE: Repairs MAY still be non-functional. I haven't checked.
    • Added mod icon
    • Added support for Hamstar Helpers v1.2.0 issue report
    • Refactored net protocol
    • Minor internal refactoring
    • Added API
    • Refactored config file to preserve modified data between versions.
    • Lowered default durability of all items to ~3/4 of its v2.3.0 amount.
    • Set items to only be disabled; not destroyed.
    • Updated for TML 0.10
    • Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
    • Numerous fixes and tweaks
    • Added 'Enabled' config setting (allows disabling mod without unloading)
    • Modified fishing durability use (catches only)
    • Set ore weapons to have higher durability (except bows/repeaters)
    • Increased durability formula's exponent value
    • Normalized some custom durability adjustments (especially meteor)
    • Armor gives low durability warnings
    • Fixed repairs not saving with item
    • Added tooltip for items with max durability loss
    • Tweaked various config settings
    • Disabled repair recipes when at full durability
    • Removed old config if present ("Durability 1.6.0.json")
    • Altered durability formula: 0.71 * ( (y/4 * x^1.54) / (5 + x) ) + 50
    • Fixed mouse item critical durability warning spam.
    • Changed durability formula to factor in use time.
    • Added simple audio + text cue for items that are about to break.
    • Improved durability display for inventory items.
    • Added new config settings.
    • Added new config presets for special-case items.
    • Fixed certain items being handled incorrectly (harpoons, projectile-casting swords, empty mana, etc.)
    • Removed meteor drop limit.
    • Config file relocated to Mod Configs subfolder.
    • Numerous bug fixes and code improvements (special thanks to Dark-Assassin's mod fork DurabilityX).
    • Repairs degrade max durability.
    • Smithing hammer rebalanced.
    • Valueless items given improved formula for value.
    • Config option to hide bar.
    • Fixed crash bug.
    • Lowered durability for Demonite, Crimtane, and Hallowed tiers.
    • Added manual durability adjustments for specific items via. config file.
    • Added numeric display of durability.
    • Meteors now limited in quantity (configurable)
    • Goblin sells Smithing Hammer
    • Tool durability increased
    • Fix multiplayer bug.
    • Improved code and fixed config loading glitch.
    • Fixed modded armor support.
    • Fixed buyback exploit.
    • Normalized rate of use for rapid fire items.
    • Improved durability formula.
    • Fixed a durability use bug making some fast-use items unbreakable.
    • (Hopefully) fixed a loading crash bug.
    • Armor may now be repaired at an anvil with purchasable Smithing Hammers from the merchant.
    • Reforges only repair in fixed chunks at a time. Let me know if this seems calibrated properly (can be configured).
    • Improved durability formula a bit.
    • Fixed a major multiplayer bug.
    • Added proper multiplayer support. You know, just 'cause.
    • Exposed classes for DLL reference use. No gameplay changes.
    • Added config option to scale the wearing rate on items. Durability can be disabled by setting this to 0, for example.


    Last edited: Mar 3, 2019
  2. Mechantera

    Mechantera Official Terrarian

    This seems great for challenge runs! Is it possible to repair the items somehow? (You could make an early-game item called slime tape or something that repairs items slightly but lowers their max durability on every use)
  3. Sportaflop

    Sportaflop Terrarian

    Or maybe a new function of the goblin tinkerer where he repairs items for money
  4. hamstar

    hamstar Steampunker

    Currently no repair function exists. I'm thinking of simply consolidating it with reforge. If you're looking for the usual workhorse, prefix-perfect equipment set, you're playing the wrong mod anyway.

    Edit: Here it is:

    Edit 2: v1.3 with added config file (My Documents\My Games\Terraria\ModLoader\Duration.json)

    Attached Files:

    Last edited: Dec 4, 2016
    Mechantera likes this.
  5. Bonvoyage284

    Bonvoyage284 Terrarian

    Hey hamster, you think you can add a option in the config file to make items useless instead of breaking. Its kinda sad to see a item you put some much work to create to just crumble into a million pieces.
  6. hamstar

    hamstar Steampunker

    It's hard to do that for certain item types. Plus it's an established convention from other games to have to repair or de-equip items when they're low on durability.

    Edit: One possible way to do this would be to forcefully eject items from any equip slots of the player's inventory, now that I think about it. Problem is, things like tools have a context use option that lets them work even when not on the hotbar...

    Edit 2: New version. Fixes to config file and small tweaks to durability formula:

    Edit 3: Updated for TML 0.9

    Attached Files:

    Last edited: Dec 12, 2016
  7. Aspartam

    Aspartam Terrarian

    Hi, do you plan to set a durability setting to pickaxes /drills so that durability bar changes faster if you dig a block which is harder/needs more pickaxe power?
  8. hamstar

    hamstar Steampunker

    Sure, but that'll take some work.
  9. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    Removing the mod breaks characters and worlds :/
  10. hamstar

    hamstar Steampunker

    Not really sure what to do about that. It seems to be an issue with the item data handling of tModLoader itself. For a stopgap solution, you can set the following parameter in the config:
    Also, here's the new version to accommodate that (with a small fix to the previous):

    Attached Files:

  11. Iara

    Iara Official Terrarian

    All right, I have been trying your mods and so far they are AMAZING.
    However there seems to be a little bug in the durability mod: Hammers don't go down in durability when they destroy walls/hammer a block. I think you should look at that.

    So far Wooden Hammer hasn't gone down in durability a single bit. It only does if I use it as a weapon. This circunvents the mod's difficulty because I can get cactus hammering sand, and that way I can remake pickaxes.
    hamstar likes this.
  12. hamstar

    hamstar Steampunker

    Unfortunately I'm aware of that, but it will require a non-trivial amount of work to fix this very specific issue. I'll probably get around to this eventually. Cactus takes time to grow, and it's much simpler to just buy more copper picks from the merchant anyway. Generally, hammering walls isn't a highly gameplay-affecting concept anyway, so it seemed low priority to fix.

    Edit: Minor tweak to expose classes for DLL use. No gameplay stuff.

    Edit Edit: Also added proper multiplayer support. You know, just 'cause.

    Attached Files:

    Last edited: Dec 19, 2016
  13. Iara

    Iara Official Terrarian

    Oh all righty then. Hope it's on the work some day.

    I will keep on playing with this mod. It seems amazing so far and I'm loving every second of it. The sad thing are Biome Chest weapons: Those really need to be able to be durability-boosted. But I need to get to that point first. I am also playing with Stamina and Injury mods.

    Can't reforging increase durability by 1 or 3 points? This way, people would have to fork in thousands of platinum to keep items. This could only be productive for exclusive, and unobtanaible items. Like Biome Chest Weapons (There is only 1 of each per world and they cannot be obtained back, so a small way of increasing their durability would be good.) I think Goblin Tinkerer reforging increasing durability by 1, 3, 5 or 10 (Your choice, honestly) would be decent and give money a meaning again. Some items are extremely hard to replace.

    Also another suggestion: Durability for accesories? They could wear down with time, when equipped on an accesory slot?

    And another suggestion I have: A warning message about armor, accesories and tools breaking soon. Something like "Wooden Greaves will break soon." or "Shackle will break soon".

    EDIT: Don't forget the hammer issue isn't only about hammering walls. It's also about hammering BLOCKS. And that IS a gameplay-affecting issue! (Making camp sites, secure fishing spots, hoiks)
    Last edited: Dec 19, 2016
    hamstar likes this.
  14. hamstar

    hamstar Steampunker

    I'll consider reducing reforging repair amounts this way. I'm also thinking of adding permanent wear and tear with each reforge. I also want a way to repair armor, but I'm still thinking about how to best approach this one.

    No word yet on accessories. There's a lot of factors to consider.
    Last edited: Dec 19, 2016
  15. Iara

    Iara Official Terrarian

    I don't think you need to repair armor.
    There is no such a thing as unique armors in Terraria. Every one of them can be obtained again. So replacing them is no big deal at all.

    Weapons are the problem.
  16. hamstar

    hamstar Steampunker

    v1.7.0 changes:
    • Armor may now be repaired at an anvil with purchasable Smithing Hammers from the merchant.
    • Reforges only repair in fixed chunks at a time. Let me know if this seems calibrated properly (can be configured).
    • Improved durability formula a bit.
    • Fixed a major multiplayer bug.

    Attached Files:

    Last edited: Dec 24, 2016
  17. Iara

    Iara Official Terrarian

    I will try this ASAP!
    What do you mean with "limited amount" tho? As in, they stop working eventually?

    That's neat and that prevents cheesing. Because I am liking your mod a lot.
    I actually have to use items I never considered using (Ore swords, gem staves, the demon/crimtane weapons). And this also makes the Space Gun not OP.
    hamstar likes this.
  18. SpyderRabbit

    SpyderRabbit Official Terrarian

    I get this every time I try to enable this mod.
    Any reason why?
    hamstar likes this.
  19. Iara

    Iara Official Terrarian

    Ok, after trying the update I can say this gives a much needed balance. Tools don't break as fast, which is pretty neat considering you have to use them a lot. No longer will I have to carry 2 or 3 pickaxes with me while spelunking.

    Low-tier weapons, like wooden swords break extremely quick. But those don't really matter and players can re-do them over and over, so I say this is a great thing! It forces people to manage their resources (wood) properly.

    imo you should do something about piercing weapons tho. Spears, for example, become somewhat fragile. Have you tried spears? The basic spear, as well as the trident, break in just 2 Expert Zombie kills. WHich is somewhat ridiculous. I think this has something to do with how the durability reduction works.

    Does it works like I think it works? Reducing durability per hit? Because weapons like spears specialize in doing TONS of hits. Shouldn't increasing the durability of weapons liek spears be in order? Increasing them by a small number like 0.5.
    hamstar likes this.
  20. hamstar

    hamstar Steampunker

    It's mainly about the value of the items. Spears are valued at 1000, AKA 10 silver coins (sells for 2 silver @ 20% of max value). Plugged into the formula, that gives them ~97 durability; 97 total 'uses' (hits). That isn't a lot.

    The only solution I can currently think of would be to manually implement a table of item values to override the default values for these cases; some items weren't well balanced according to value.

    Edit: Fixed durability formula and wear and tear errors, hopefully fixed the aforementioned loading crash.

    Attached Files:

    Last edited: Dec 24, 2016
    Aspartam likes this.