Page 1 of 11

[Mod] Craft Guide [craft_guide] - Shows crafts for all loade

Posted: Wed Jul 11, 2012 15:17
by cornernote
Craft Guide for Minetest

Shows crafts for all loaded mods.

Documentation | GitHub Project

Image

About

This module is open source, so it's distributed freely. If you find it useful then I ask not for your wealth, but simply to spare your time to consider the world we share by watching Earthlings, a multi-award winning film available to watch online for free. A must-see for anyone who wishes to make the world a better place.

Crafting

You can create a craft guide using the recipe in the image above, or give yourself one using:

Code: Select all

/giveme craft_guide:sign_wall
Credits

darkrose - updated minetest core to support craft lookup using the output
ashenk69 - code was originality adapted from his creative inventory mod

License

BSD-3-Clause, Copyright © 2014 Brett O'Donnell

Posted: Wed Jul 11, 2012 19:25
by lkjoel
Screenshots?

Posted: Wed Jul 11, 2012 20:12
by Topywo
I had to think about it for a while (without screenshot), Now I read it again and saw the screenshot. I now think this is a very good help for all kind of players.

Posted: Wed Jul 11, 2012 22:46
by SegFault22
Great idea! With minecraft there is no way to read recipes in-game, but with this mod in Minetest we can view recipes in-game, making Minetest better than Minecraft a little bit more :D

Posted: Wed Jul 11, 2012 23:07
by ashenk69
Looks like someone found my code to be useful. It looks to be a little modified but I can definitely tell some of my code is in there. Not accusing you of anything. I was actually wanting to put a crafting output system into my inventory mod but can't find a simpler idea than what you have.

Posted: Thu Jul 12, 2012 01:51
by cornernote
ashenk69, some of the code was copied from the creative_inventory module (i will add credit into my code). Without your code I would not have been able to achieve this. Thanks so much!

One note, I found that the pagination needed a little tweaking. I basically made it so the item is not removed from the stack when you goto next/prev page. I think I twiddled with the pagination logic a little too.

Brilliant idea of yours to use an inventory slot to paginate.

Also thanks to everyone who helped and to everyone who made other modules which also helped me understand the code.

Posted: Thu Jul 12, 2012 05:27
by Stef
where is the dowload?

Posted: Thu Jul 12, 2012 07:00
by Jordach
Stef wrote:where is the dowload?
you have to make the files yourself.

Posted: Thu Jul 12, 2012 07:09
by Stef
what files do i need? .lua and depends?

Posted: Thu Jul 12, 2012 07:18
by LolManKuba
SegFault22 wrote:Great idea! With minecraft there is no way to read recipes in-game, but with this mod in Minetest we can view recipes in-game, making Minetest better than Minecraft a little bit more :D
Wrong you can but it is also a mod.

Posted: Thu Jul 12, 2012 07:23
by cornernote
The code goes into init.lua, depends.txt can be empty, or have the word "default" (without the quotes) inside it. Put all that in a folder called craft_sign and you are good to go!

I really recommending changing the default.lua aswell so you get to see all the crafts, not just the ones that load after this mod.

Posted: Thu Jul 12, 2012 07:47
by Stef
some of the recipes are with unknow items, is this normal it's by mods only i think

Posted: Thu Jul 12, 2012 07:49
by cornernote
I tested it with a few mods and it seemed to work. Perhaps the mods you have can also use other mods that you don't have. Which mods are you running?

Posted: Thu Jul 12, 2012 07:50
by Stef
a lot, but by the ironstone or stone bricks of moreblocks mod it won't work

Posted: Thu Jul 12, 2012 08:57
by sfan5
Looks nice!

Posted: Thu Jul 12, 2012 14:52
by ashenk69
I think I was able to get it to register all the crafts that are in the game. By moving the craft recording code into a separate mod folder. I set depends.txt file to depend on nothing and the crafts variable was already a global variable so you can access it in any other mod folder no problem. So now it stores all the mod crafts and it still stores the default crafts even though it doesn't print anything out for them in the debug file. I also put in a check so it didn't crash every time you would try and put in an object that didn't have a recipe.

Posted: Thu Jul 12, 2012 15:58
by InfinityProject
Dude................................................... This is awesome!

Posted: Fri Jul 13, 2012 03:45
by InfinityProject
Was working in one world, now this comes up when I try to place the sign:

Code: Select all

ServerError: LuaError: error:
...bin\..\games\minetest_game\mods\craft_guide\init.lua:259:attempt to index
global 'crafts' (a nil value)
stack traceback:
[C]:in function 'add_node'
...4.dev-20120606-c57e508-win32\bin\..\builtin/item.lua:159:in function

Posted: Fri Jul 13, 2012 04:11
by cornernote
InfinityProject wrote:Was working in one world, now this comes up when I try to place the sign:

Code: Select all

ServerError: LuaError: error:
...bin\..\games\minetest_game\mods\craft_guide\init.lua:259:attempt to index
global 'crafts' (a nil value)
stack traceback:
[C]:in function 'add_node'
...4.dev-20120606-c57e508-win32\bin\..\builtin/item.lua:159:in function
in register_craft.lua (in your default module, if you copied it there)

make sure this line:
crafts = {}

is before this line:
local minetest_register_craft = minetest.register_craft

it should be that way in 0.0.2, let me know if you still have issues

Posted: Mon Jul 16, 2012 10:20
by RandomBot
in mine it is, but it still crashes me, same error message as infinity posted.


06:12:52: VERBOSE[main]: error_message = ServerError: LuaError: error: ...e508-win32\bin\..\mods\minetest\craft_guide\init.lua:259: attempt to index global 'crafts' (a nil value)
06:12:52: VERBOSE[main]: stack traceback:
06:12:52: VERBOSE[main]: [C]: in function 'add_node'
06:12:52: VERBOSE[main]: ...4.dev-20120606-c57e508-win32\bin\..\builtin/item.lua:159: in function <...4.dev-20120606-c57e508-win32\bin\..\builtin/item.lua:124>

Posted: Mon Jul 16, 2012 11:02
by cornernote
in init.lua there is a NOTES section. At step 3 I forgot to remove the comment.

Line 47:
--dofile(minetest.get_modpath("craft_guide").."/register_craft.lua") -- comment out this line

Should be:
dofile(minetest.get_modpath("craft_guide").."/register_craft.lua") -- comment out this line

Or, better still, follow the 3 steps to include all craftable items.

Posted: Mon Jul 16, 2012 13:23
by VanessaE
Can you please indicate in the first post to which parts the license applies? Thanks.

Posted: Mon Jul 16, 2012 13:27
by cornernote
It applies to all the files in the download. What else would it apply to?

Posted: Mon Jul 16, 2012 13:41
by VanessaE
It is possible to have different licenses for code vs. textures, and you're supposed to indicate it in the post. Anyway, noted and moved! :-)

Posted: Mon Jul 16, 2012 13:42
by cornernote
ahh ok, i have no textures. I just used the plain old sign. I should do that in next version.

Thanks VanessaE!