• 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.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tModLoader Durability

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.


Installation

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


v2.6.1
  • Changed config ranges to not use extreme values
  • Added durability formula output as config read-only properties
  • Added possible fix for server errors upon items reaching critical states
  • Added possible crash fix from item breakage for invalid players (?)
  • Implemented FloatInputElement for config
  • Obsoleted CustomDurabilityMultipliers in favor of PerItemDurabilityMultipliers

v2.6.0
  • Added ModConfig Clone method
  • Fixed config constructor
  • Removed net code; mod config sync handled with TML
  • Updated to TML11 and MH5b (including .csproj and configs)
v2.5.3
  • 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
v2.5.2
  • Updating for Mod Helpers v2.0.2
  • Restructured player code
  • Assorted updates
  • NOTE: Repairs MAY still be non-functional. I haven't checked.
v2.5.0.1
  • Added mod icon
  • Added support for Hamstar Helpers v1.2.0 issue report
  • Refactored net protocol
  • Minor internal refactoring
  • Added API
v2.4.0
  • 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.
v2.3.2
  • Updated for TML 0.10
  • Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
  • Numerous fixes and tweaks
v2.3.1
  • Added 'Enabled' config setting (allows disabling mod without unloading)
v2.3.0
  • 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
v2.2.0.1
  • 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
v2.1.1
  • Fixed mouse item critical durability warning spam.
v2.1.0
  • 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).
v2.0.0
  • Repairs degrade max durability.
  • Smithing hammer rebalanced.
  • Valueless items given improved formula for value.
  • Config option to hide bar.
v1.9.0
  • 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.
v1.8.0
  • Meteors now limited in quantity (configurable)
  • Goblin sells Smithing Hammer
  • Tool durability increased
v1.7.7
  • Fix multiplayer bug.
v1.7.5-6
  • Improved code and fixed config loading glitch.
v1.7.4
  • Fixed modded armor support.
v1.7.3
  • Fixed buyback exploit.
v1.7.1
  • 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.
v1.7.0
  • 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.
v1.6.2-3
  • Added proper multiplayer support. You know, just 'cause.
v1.6.1
  • Exposed classes for DLL reference use. No gameplay changes.
v1.6.0
  • Added config option to scale the wearing rate on items. Durability can be disabled by setting this to 0, for example.



 
Last edited:

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)
 

Frogbirdd

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)
Or maybe a new function of the goblin tinkerer where he repairs items for money
 

hamstar

Steampunker
Or maybe a new function of the goblin tinkerer where he repairs items for money
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)
 

Attachments

Last edited:

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.
 

hamstar

Steampunker
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.
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
 

Attachments

Last edited:

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?
 

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

Steampunker
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.
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.
 

Attachments

Last edited:

Iara

Official Terrarian
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.
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:

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:

Iara

Official Terrarian
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.
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.
 

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.
 

Attachments

Last edited:

Iara

Official Terrarian
v1.7.0 changes:
  • Armor may now be repaired at an anvil with purchasable Smithing Hammers from the merchant.
  • Reforges only repair a limited amount. Let me know if this seems calibrated properly (can be configured).
  • Improved durability formula a bit.
  • Fixed a major multiplayer bug.
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.
 

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

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.
 

Attachments

Last edited:
Top Bottom