RE: Durability of Crafting Item?

Misadventure
New member
 
Posts: 5
Joined: Tue Mar 01, 2016 21:36
In-game: Misadventure

RE: Durability of Crafting Item?

by Misadventure » Tue Mar 01, 2016 22:24

*** 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?
 

User avatar
everamzah
Member
 
Posts: 490
Joined: Thu Jan 29, 2015 00:47
GitHub: everamzah
IRC: everamzah
In-game: everamzah

Re: RE: Durability of Crafting Item?

by everamzah » Wed Mar 02, 2016 11:20

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()
 

User avatar
oleastre
Member
 
Posts: 81
Joined: Wed Aug 13, 2014 21:39
GitHub: oleastre
In-game: oleastre

Re: RE: Durability of Crafting Item?

by oleastre » Wed Mar 02, 2016 12:40

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
 

User avatar
Christian9
Member
 
Posts: 273
Joined: Fri Sep 19, 2014 20:29
In-game: Christian9

Re: RE: Durability of Crafting Item?

by Christian9 » Sun Mar 06, 2016 23:57

try add_wear =, if that fails additional_wear =.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron