Jump to content

Modding Tool Durability

Recommended Posts

So since, as He-Man would say, "I HAVE THE POWER!!!" (mostly because the developers have made this game so stupid-easy to mod even a complete brainlet like me can do simple stuff, yay!), I've decided to try to make my tools indestructible.

My first thought was set the tool's durability to 0 in the JSON.  Interestingly, that both did and didn't work.  I have two hammers in the survival save I've been playing, one is damaged, ones is not.  The undamaged one breaks in one strike.  The damaged one *seems* to be indestructible.  The undamaged one, obviously, has no durability bar.  The damaged one's durability bar goes from <20% full to completely black.

Since I didn't want to have to delete my save and restore the back up every time I test, I moved into a creative save.

My second thought was "well, maybe set the durability to -1".  That makes a pristine one break on one strike, too.

My third thought is to adjust the durability cost of actions and set that to zero, but...  I have no idea where that would even be, can someone point me to the right file?  Or is that hard-coded into the game?

My last-ditch thought, which I'd rather avoid, is to just set the durability to whatever the maximum value would be?  Probably 2^32, or 2^64?

Link to comment
Share on other sites

How unfortunate.  I was hoping to completely get rid of the durability bar just for aesthetics.  Oh well.  Better a sub-optimal solution than no solution.


So I've been playing around with different values.  2^64 doesn't cause a crash, but it clearly causes some kind of overflow issue, as the tool will break after one use.

(2^31) - 1 makes the durability on the tool tip disappear and makes the durability bar look almost broken.

999,999,999 for some strange reason makes the tooltip read 1,000,000,000. (commas added for readability)

In fact, there's some really weird - I assume rounding - shennanagins going on with very large values.  1,000,000,001 becomes 1,000,000,00; 1,000,111,222 becomes 1,000,111,232.

The maximum display seems to be 2^31, but with the rounding weirdness, it's not as simple as just setting the durability to that.

Seems that
2147483500 gives the best result, so Imma do that, I guess.

It's a shame the "DamagedBy" property doesn't exist for all tools, and doesn't have arguments for everything that degrades them.  That would by far be the easiest thing to mess with to achieve my desired result.  Oh well.  As above, better a sub-optimal solution than no solution at all.

Edited by PhotriusPyrelus
Link to comment
Share on other sites

  • 2 weeks later...
On 10/17/2021 at 7:30 AM, Vintagebob said:

i think there is though a way: in the jsons of the tools there is a parameter called DamagedBy. If you remove it by a patch, it should work :) (i think)

This only exists for certain tools, and doesn't cover some things (e.g. using a smything hammer to work metal ingots, using a tool in the crafting interface).

Link to comment
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.