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

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

If someone can send a pull request I'd be happy to accept it. Unfortunately I don't have time to code and test at the moment.

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by deivan » Post

I already coded it in my version Cornernote, copy and past... ;)

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

Hey devian,

I looked at the source of your version. It's not in english and my lua skills are somewhat neglected, so it wasn't easy to follow.

It also seems you took a different approach to collecting the recipes. You use minetest.get_craft_recipe and minetest.get_all_craft_recipes, whereas I override the function that registered the recipes.

Perhaps I'm missing something, but it does not seem like a copy and paste solution.

Feel free to do a pull request, just click the pencil (edit) icon here:
https://github.com/cornernote/minetest- ... _guide.lua

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Post

cornernote wrote:[…] but it does not seem like a copy and paste solution.
Copy&Paste solutions are always the least desirable solutions of all possible solutions (so is coding in different languages than English, but that’s another topic *g*) :)

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by deivan » Post

Don't be a cry baby.... Is a function, you give the group and the function return a item from the group... Easy and clear...

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Post

deivan wrote:Don't be a cry baby.... Is a function, you give the group and the function return a item from the group... Easy and clear...
Yeah, fuck it, why be polite?

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by deivan » Post

Well, I am focused in the question. But sorry.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

deivan wrote:Don't be a cry baby.... Is a function, you give the group and the function return a item from the group... Easy and clear...
Instead of telling us all how easy it is, you could just do the pull request. Unless it actually isn't that easy.

deivan
Member
Posts: 452
Joined: Fri Feb 15, 2013 10:16
Location: Brazil. :D

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by deivan » Post

I don't working with LUA a some months... Seeking in my code the core portion of the routine is some like:

1) When loading the module you need add a list into a matrix to use it for the recipient. Well, if a item exist then
have a group, I catch every group and created this variable, "groups"... The item who make the group, the first one, become the example.

2) When you found a group in the recipient then you use this variable, and the example, the first item found with the group and added for example inside the list.

In my code this implementation have many comments and don't have more than 30 lines.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

Yes, the code looks clean and commented, but unfortunately I only speak english so I cannot read it. I did find the part that converts a group into an item, however I havent coded minetest or lua in almost a year, and I dont have time to test the change.

I guess you aren't going to do a pull request, but if anyone else would like to then I'd be happy to pull it.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

I pushed a fix for this, based on the same way deivan handled it in his code.

Ideally you could click "Alternate" and it will show the other items in the group, but its a bit of extra work to do it that way. At least now you get a recipe.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

Did an improvement where it sends the player a message explaining the item was used instead of the group, and lists all the items in the group they can use.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Post

I can confirm this. Works as expected! No more “unknown item” for item groups! Thanks!

User avatar
arcturian_vagabond
Member
Posts: 15
Joined: Thu Dec 11, 2014 01:58
In-game: posipil
Location: United States
Contact:

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by arcturian_vagabond » Post

Don wrote: This is the bug that is discussed above. Glass is made by cooking group:sand. Hopefully someone will fix this soon.
I'll wait for a fix then. Thanks for the confirmation.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

arcturian_vagabond wrote:I'll wait for a fix then. Thanks for the confirmation.
It was fixed today.

Miner59
Member
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Post

Hi,
I reworked your mod and added some nice features.

I hope this is ok and license allows this.
If you don't like to post this in your thread maybe I can make a own thread.

What I changed:

-no unknown items shown when recipes have "group:..." inside, there is then instead a button displayed which shows all items in this group when you press it.

-added a new feature to show the complete list of items you need for a item. For example: output: default:bookshelf,
then it shows: 6 "group:wood", 27 "papyrus". This feature was the most work. I hope it works, but no guarantee.(It could lead to huge for loops which it doesn't exit when recipes are very compex. Also needs to be tested which more mods.)

-you can direct change from last page to first page and from first page to last page now

-added a button to exit the formspec

-crafting recipe for craft guide changed to use group:stick

-crafting recipe for craft guide pc changed to use just the recipe with stone slabs

Maybe more which I forgot.

Screenshot:
Image

Download: see attachment
Attachments
guide.zip
Craft guide - modified by Miner59
(15.39 KiB) Downloaded 94 times

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

That is very cool. It's a much nicer way of showing the group than what I did today.

Wish you had have posted a few hours ago, would have saved me some effort! =)

The terms of the license allow you to use the code for anything you like, so long as the same license applies and my copyright is left. You can add yourself to the copyright line. As for posting in this thread, any improvement or suggestion is very welcome. I think there are too many copies of some mods, and if everyone worked together we would have one superior mod instead of 20 independent ones.

Do you want to do a pull request with your changes? I'd be happy to accept it. If you do that you will appear in the contributors on the documentation page (http://cornernote.github.io/minetest-craft_guide/). I'll also add you to the credits section.

My only concern is your code standards. You need to at least tab your indents so the code is readable. Your variable names are also very short making them hard to understand without reading a lot of code, but that is secondary to the tab indents.

I did a diff on the code, and it seems you have added a lot of lines of code, as well as modified a lot. I would be happy to lose the changes I made today and merge with your code as your solution is far superior to mine, and you also have a lot of other nice features.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

I like the "You Need" thing...

When I do "Bookshelf", it tells me I need wood and papyrus. It gets the papyrus by looping the ingredients of the book (then the paper)

When I do "Wooden Pickaxe", it tells me I need wood and sticks. I get that it cant go deeper than this because they are group items (and there are multiple ways to build them, so impossible to show the source).

But then this raises the question... Why loop back to the ingredients of the book/paper? The user can find out how to make the book by dragging it into the output.

Anyway, I guess the lookback loop works (as far as can be expected considering groups are an issue), so it would be best left in there as it saves some clicks.

Miner59
Member
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Miner59 » Post

Hi cornernote,
nice that you like my modifications.
I will try to make the code with the buttons for groups nicer. Sorry for that mess I dared to post here... XD

The code for the "You need" feature is very hacky :-( , I will try to improve this later.
I think the example with the bookshelf is too simple, but it's more informative maybe for machines from technic mod.
Do you think I can name this feature "Purchase list"? Is this a good English term for this?

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

Awesome! Looking forward to seeing the pull request with your mods.

"Items Required" would be a better term. But "You Need" and "Purchase List" are both fine too.

How on earth did you code it with no tab indentation!? My brain can't even think about the code unless I indent it.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Linuxdirk » Post

Miner59 wrote:The code for the "You need" feature is very hacky :-(
And it replaces the bookmarks :(
Miner59 wrote:but it's more informative maybe for machines from technic mod.
Or some of the extremely complicated Home Decor ones :)
Miner59 wrote:Do you think I can name this feature "Purchase list"?
What’s wrong with “You need …”? It’s very descriptive.
cornernote wrote:How on earth did you code it with no tab indentation!? My brain can't even think about the code unless I indent it.
Hooray for using Vim. g, g, =, G … And BAM, everything is indented properly :)

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

Linuxdirk wrote:
Miner59 wrote:The code for the "You need" feature is very hacky :-(
And it replaces the bookmarks :(
No, you click the ">>" button and it toggles between bookmarks and you need.

User avatar
Napiophelios
Member
Posts: 1035
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Napiophelios » Post

This is nice for standard recipes;

Workbench mod recipes that use a larger craft grid
only shows part of recipe.

cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by cornernote » Post

I thought about that a lot. I think if it gets a bigger recipe it needs to have a different formspec, because there is no room left on the current one.

User avatar
Napiophelios
Member
Posts: 1035
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Craft Guide [craft_guide] - Shows crafts for all l

by Napiophelios » Post

there is room if you ditch to chitchat about "Learn to craft...",
it would probably look very cramped and ugly though

would it be possible to maybe disable the usage note when an advanced recipe is given
and use the space temporarily?

Post Reply

Who is online

Users browsing this forum: No registered users and 22 guests