help: crafting definition type

User avatar
MasterGollum
Member
 
Posts: 79
Joined: Thu Sep 27, 2012 14:48

help: crafting definition type

by MasterGollum » Sun Oct 21, 2012 15:02

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"
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Oct 21, 2012 17:12

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

User avatar
MasterGollum
Member
 
Posts: 79
Joined: Thu Sep 27, 2012 14:48

by MasterGollum » Sun Oct 21, 2012 17:37

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
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Oct 21, 2012 17:47

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.
 

User avatar
Mito551
Member
 
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Sun Oct 21, 2012 21:42

He does. I looked at his code making barrel for my dwarves game.
 

User avatar
MasterGollum
Member
 
Posts: 79
Joined: Thu Sep 27, 2012 14:48

by MasterGollum » Sun Oct 21, 2012 23:18

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


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 14 guests

cron