Page 1 of 1

help: crafting definition type

PostPosted: Sun Oct 21, 2012 15:02
by MasterGollum
Is it possible to register a new kind of crafting definition?

I wanted to create new node crafters, for example a pottery wheel, but I saw that recipes can be registered only with a valid crafting definition type. As far as a I saw in the api the allowed types are shaped, toolrepair, shapeless, cooking and fuel. This list can be extended from a lua script? Or they are hardcoded?

Second question, what is toolrepair and shapeless :P how they are used?

ERROR[main]: Error loading mod "darkage": LuaError: Unknown crafting definition type: "pottery"

PostPosted: Sun Oct 21, 2012 17:12
by PilzAdam
You can not define new carafting types in lua.
Shapeless means that it doesnt matter where to put the items in the crafting recipe (see my farming mod for an example).
Toolrepair is when you put 2 tools of the same type wich are weared out into the crafting grid, you get a new tool (see init.lua of the default mod for an example).

PostPosted: Sun Oct 21, 2012 17:37
by MasterGollum
PilzAdam wrote:You can not define new carafting types in lua.
Shapeless means that it doesnt matter where to put the items in the crafting recipe (see my farming mod for an example).
Toolrepair is when you put 2 tools of the same type wich are weared out into the crafting grid, you get a new tool (see init.lua of the default mod for an example).


Oh it is a shame, it could be very useful for create new items able to craft things inside them.
The functions looked flexible to me, so if I want to do it I need to code my own register_craft and get_craft_result, right?

yes I saw it
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
--
-- Crafting (tool repair)
--
minetest.register_craft({
    type = "toolrepair",
    additional_wear = -0.02,
})


but I was not understanding it :P

PostPosted: Sun Oct 21, 2012 17:47
by PilzAdam
MasterGollum wrote:The functions looked flexible to me, so if I want to do it I need to code my own register_craft and get_craft_result, right?

I think RBA has something like this in his technic mod, but Im not sure.

PostPosted: Sun Oct 21, 2012 21:42
by Mito551
He does. I looked at his code making barrel for my dwarves game.

PostPosted: Sun Oct 21, 2012 23:18
by MasterGollum
Mito551 wrote:He does. I looked at his code making barrel for my dwarves game.


He has a huge code :P I had not been able to find it. Anyway I almost finished a mod that only does this, allows to define an arbitrary craft type and then use it for a specify item, for example a pottery wheel or a carpenter's worktable. So in this way it will be lesser the possibility of collision with the crafts, also it will allow to create specialized workshops :)