[Mod] Crafter [0.2] [crafter]
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
[Mod] Crafter [0.2] [crafter]
This is an utility MOD, itself does nothing. Crafter MODE clones the crafting definition system to allow new MOD developers to create their own craft systems. For example a pottery wheel to do items with clay, a mill to produce flour from cereals, etc.
How it works?
It give you 2 functions crafter.register_craft(craft) and crafter.get_craft_result(data). The main difference with the default ones is that they are not restricted for the method name, you can use whatever name you want and create a new family of crafts. They are used exactly as the default ones are used, with the exception that register_craft requires the method property.
crafter.get_craft_result returns the original table stored, so if it has specific properties they can be accessed.
Possible crafting methods
If it works fine (normally it does ) and it has acceptance it could be cool create new families of crafts. In this case it would be required to specify a fixed number of slots for the new craft items, in the same way all the furnaces has 1 slot as input.
For example: food (as cooking is already used), pottery, carpentry, jewelry, forge, ...
We can post here the different crafting types (aka methods).
Images:
Don't apply, it is just a couple of functions
License: WTFPL.
Depends: default
Download: https://github.com/MasterGollum/crafter/zipball/master
Releases:
Version 0.2: debugged
Version 0.1 Initial release
New crafts types
smelting
Grid 2x2
Mods using it: smelter
How it works?
It give you 2 functions crafter.register_craft(craft) and crafter.get_craft_result(data). The main difference with the default ones is that they are not restricted for the method name, you can use whatever name you want and create a new family of crafts. They are used exactly as the default ones are used, with the exception that register_craft requires the method property.
crafter.get_craft_result returns the original table stored, so if it has specific properties they can be accessed.
Possible crafting methods
If it works fine (normally it does ) and it has acceptance it could be cool create new families of crafts. In this case it would be required to specify a fixed number of slots for the new craft items, in the same way all the furnaces has 1 slot as input.
For example: food (as cooking is already used), pottery, carpentry, jewelry, forge, ...
We can post here the different crafting types (aka methods).
Images:
Don't apply, it is just a couple of functions
License: WTFPL.
Depends: default
Download: https://github.com/MasterGollum/crafter/zipball/master
Releases:
Version 0.2: debugged
Version 0.1 Initial release
New crafts types
smelting
Grid 2x2
Mods using it: smelter
Last edited by MasterGollum on Mon Oct 29, 2012 10:40, edited 1 time in total.
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
Maybe it is but I did not find the wayPilzAdam wrote:And this is not possible with the current API?
The register craft provided by the default is not versatile, it gives an error as I reported the last time. It's really a shame, because it is restricted only to the standard craft types and it doesn't allow to create new craft types.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Can you rewrite your code into c++ and pull request it to the engine repo?MasterGollum wrote:Maybe it is but I did not find the wayPilzAdam wrote:And this is not possible with the current API?
The register craft provided by the default is not versatile, it gives an error as I reported the last time. It's really a shame, because it is restricted only to the standard craft types and it doesn't allow to create new craft types.
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
I can't, I don't know c++, neither I have development ide for do it. I think it is only remove the restriction, somewhere in the definition of this function it is validating that only known types of craft can be stored, it is remove this restriction. I feel it needlessly restricting. If an additional level of integrity want to be added it can be provide a register_craft_type function, but I don't think it is necessary.PilzAdam wrote:Can you rewrite your code into c++ and pull request it to the engine repo?MasterGollum wrote:Maybe it is but I did not find the wayPilzAdam wrote:And this is not possible with the current API?
The register craft provided by the default is not versatile, it gives an error as I reported the last time. It's really a shame, because it is restricted only to the standard craft types and it doesn't allow to create new craft types.
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
Glad you like itrubenwardy wrote:This would be usefull on my mod if i did cookers and frying pans etc... food_realcraft here we come...
I suggest if you will use this mod, let's decide a size for the food cooker grid, so if other people wants to do more crafts they have ever the same definition and the recipes are compatible as well as the new possible cookers. For example I think for food a 2x2 grid can be fine. Unless you want to be very realistic four ingredients is enough for prepare tons of cooking recipes Otherwise a 3x3 grid will be needed.
My proposal is:
* craft type: food
* grid size: 2x2
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
First you register the node as a craft, just you give it the type you want.InfinityProject wrote:Could you put up an example of what you could do?
Code: Select all
-- In the list of definitions
crafter.register_craft({
type = 'pottery',
output = 'potter:awasome_jar',
recipe = {
{'default:clay_lump','default:clay_lump'},
{'default:clay_lump','default:clay_lump'},
}
})
Code: Select all
-- Inside your the abm of your crafter node
local shape = inv:get_list("shape")
crafter.get_craft_result({method = "pottery", width = 4, items = shape})
Last edited by MasterGollum on Mon Oct 22, 2012 15:53, edited 1 time in total.
- InfinityProject
- Member
- Posts: 1009
- Joined: Sat Mar 17, 2012 00:52
- Location: World of Infinity, US
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
- MasterGollum
- Member
- Posts: 79
- Joined: Thu Sep 27, 2012 14:48
Debugged and created the first MOD that uses it.
New craft type smelting grid 2x2,
For examples see smelter (http://minetest.net/forum/viewtopic.php?id=3546)
New craft type smelting grid 2x2,
For examples see smelter (http://minetest.net/forum/viewtopic.php?id=3546)
- SegFault22
- Member
- Posts: 872
- Joined: Mon May 21, 2012 03:17
- Location: NaN
Can you make the table for crafting types Tridimensional, the third dimension being "burntime" (for fuels)? This would allow us to register fuels as crafting types, just like minetest default, as that currently is the simplest method to doing that, which does not require horrible hackwork.
Thank you for making this mod, without it I would not be able to release MoreStuff2 ahead of schedule.
Thank you for making this mod, without it I would not be able to release MoreStuff2 ahead of schedule.
"All we need it the right major crisis and the nations will accept the new world order."
It seems that the "replace" part, just like taking the bucket back after using a lava bucket as fuel, was not implemented.
Minetest can be better if
*better data structure for players and unstackable items like JSON
*multi sqlite files so that multi dimension can be easily implemented
*more convenient mob developing interface
*better data structure for players and unstackable items like JSON
*multi sqlite files so that multi dimension can be easily implemented
*more convenient mob developing interface
Re: [Mod] Crafter [0.2] [crafter]
Is this still working?
Who is online
Users browsing this forum: No registered users and 42 guests