Page 1 of 1

RE: Durability of Crafting Item?

PostPosted: Tue Mar 01, 2016 22:24
by Misadventure
*** Posted in wrong forum, using this to elaborate ***
Original post:
``````````````````````````````````````````````
So i'm fairly new, I have general knowledge with minetest by now however i still run into issues on occasion. such as my problem now.

I have a crafting item (Unsure if it should be made a tool).
This item is called "forge_hammer".
and its intended use is to have an ingot, and the hammer placed shapelessly in the crafting table, to produce a plate of that ingots type. However, I want when they craft a plate, for it to take a durability away from the item. I tried googling but i cant seem to figure out how i would go about applying a durability count to this item and how to degrade it based on number of uses in crafting recipes.
````````````````````````````````````````````````````

the reply i got on my previous post was, I should make the item a tool for it to have durability. Which I need to now elaborate on. If I make it a tool, how may I go about making its uses go down according to the times used in a crafting recipe? More-so, how may I go about achieving it so that the forge hammer does not get completely consumed in the final output?

Re: RE: Durability of Crafting Item?

PostPosted: Wed Mar 02, 2016 11:20
by everamzah
There's also this thread which is used a lot for modding help.

I'm not sure, but my first thought is add_wear (dev wiki article).

The second thought is registering either on craft, or on craft predict:
minetest.register_on_craft()
minetest.register_craft_predict()

Re: RE: Durability of Crafting Item?

PostPosted: Wed Mar 02, 2016 12:40
by oleastre
The xdecor mod have a similar approach with it's hammer that you can use on a workbench to repair other tools.
When you repair stuff, your hammer loose some "durability".

The hammer definition as a tool:
https://github.com/kilbith/xdecor/blob/ ... ms.lua#L44

And it's use (the important line being the add_wear one)
https://github.com/kilbith/xdecor/blob/ ... h.lua#L126

Re: RE: Durability of Crafting Item?

PostPosted: Sun Mar 06, 2016 23:57
by Christian9
try add_wear =, if that fails additional_wear =.