minetest-mods / craftguide

:book: The most comprehensive Crafting Guide on Minetest
Other
43 stars 20 forks source link

Show replacements and repairing recipes #48

Closed kilbith closed 5 years ago

kilbith commented 5 years ago

In order to make the wiki table fully green on the craftguide row, this is now possible to show the replacements and repairing recipes. These "recipes" need to be collected manually and registered as custom recipes.

BTW, @Wuzzy2, this wiki page needs an update (sfinv integration, /craft command, custom recipes API).

p-ouellette commented 5 years ago

Recipes with replacements are already shown, the replacement is just not indicated. This can be done by adding an "R" label to the item that gets replaced and indicating in the tooltip what the replacement is. For example for the lava bucket fuel recipe, the tooltip would say "Replaced with Empty Bucket on crafting".

As for toolrepair recipes, I think the solution is for Wuzzy to drop that column from the table :) A game has only one toolrepair recipe, usually defined minetest.register_craft({type="toolrepair", additional_wear=-0.02,}), which applies to all tools. So this is more of a game feature than a recipe. The recipe does not apply to tools with the disable_repair group, but this group will most likely be used for tools that it wouldn't make sense to repair. It wouldn't make sense to show a tooltip saying "this item cannot be repaired" for those items, since this the expectation.

Wuzzy2 commented 5 years ago

Repairing is still a recipe, as you use the crafting grid for this. The toolrepair thing is just a weird notation which actually registers multiple shapeless recipes (one per tool). So it is completely reasonable to have it in a crafting guide. The column will not be removed. MineClone 2 actually supports repairing recipes. MineClone 2 is using a craftguide fork (as mcl_craftguide), by the way. I was just too lazy to backport it.

The implementation is simple: Those recipes just show up as ordinary shapeless recipes in the crafting guide (one per tool), and the output item has a little note / tooltip on it. Items with disable_repair=1 are simply skipped (not in repository yet).

By the way: I am not the only one who can edit the wiki … Just saying. Just get yourselves an account, already! :P

kilbith commented 5 years ago

MineClone 2 actually supports repairing recipes

Actually it is using mcl_core as dependency for this, right?

Just get yourselves an account, already!

This is preferable that authors do not edit the wiki page so there's no accusation of partiality. And btw it is still missing "Inventory menu" in the Access column ;)

Wuzzy2 commented 5 years ago

Oh right, I totally forgot that this was basically just an ugly hack which I did … Now I also remember why I didn't propose this before. :D Sadly get_all_craft_recipes doesn't return toolrepair. Nevermind.

The Minetest Wiki is not Wikipedia, it does not have to be perfectly neutral all the time. As long you're not bullshitting the wiki, it should be fine, I guess.

p-ouellette commented 5 years ago

Replacements are also currently impossible or difficult due to this engine bug: https://github.com/minetest/minetest/issues/4901.

kilbith commented 5 years ago

Victory: https://github.com/minetest-mods/craftguide/commit/5a3d05f0d637cc7d39b813d112ec3d5bd2ceae49

kilbith commented 5 years ago

And win: https://github.com/minetest-mods/craftguide/commit/1d1560f6a580ec94336702e3078673eda771d9cc

Wuzzy2 commented 5 years ago

Replacements: Mostly OK.

Repair: No, this is now how it is supposed to work. Repairable tools don't get any special UI changes. Only the unrepairable tools do. But just looking at disable_repair is wrong, too. If the game does not have the repairing recipe, then all tools are unrepairable, but the mod will only show those with the group.

The requirements for fulfilling Repair is as follows:

Since it is impossible to detect whether the special repair recipe has been registered so far, it's impossible to implement right now. Simply guessing the setting will lead to an incorrect result. Needs engine change. :(

And yes, I totally think it's a bug that we can't get the repair recipe right now. :(

kilbith commented 5 years ago

OK I will do it the other way around for repairable tools and display the repair %. I'm against adding a shapeless recipe for each tool, though.

Since it is impossible to detect whether the special repair recipe has been registered so far

It is possible actually.

Wuzzy2 commented 5 years ago

Lol, by overwriting minetest.registercraft, right? >>

kilbith commented 5 years ago

https://github.com/minetest-mods/craftguide/commit/dee585c7de8b406ac5a84e4be7c268ca296934d3

overwriting minetest.register_craft, right?

Yes, that's the only way.

Wuzzy2 commented 5 years ago

How about adding a single shapeless recipe that has a “generic” tool icon and the tooltip “A repairable tool” and the result saying “Repaired tool (X%)?

kilbith commented 5 years ago

That's also a good idea but the user may not notice this recipe at first in the crowd of items, whilst he has more chances to notice this property per tool, IMO.

I guess the wiki row can be turned back full green now? :)

Wuzzy2 commented 5 years ago

That tooltip is not really discoverable either.

But your mod now technically fulfils the requirement. Not really in a good way, but it does.

Why not use both? Tooltip and new item entry?

kilbith commented 5 years ago

If I get a nice icon representing a generic tool, maybe ;)