Compare commits

..

1 Commits
2.0 ... 1.13

Author SHA1 Message Date
103624bc28 Fix item positioning for large recipes 2020-04-16 18:39:39 +02:00
43 changed files with 919 additions and 1372 deletions

View File

@ -1,8 +1,11 @@
unused_args = false
allow_defined_top = true allow_defined_top = true
read_globals = { read_globals = {
"minetest", "minetest",
"default", "default",
"sfinv",
"sfinv_buttons",
"vector", "vector",
"string", "string",
"table", "table",

49
API.md
View File

@ -97,7 +97,7 @@ mode is implemented as a recipe filter.
#### `craftguide.add_recipe_filter(name, function(recipes, player))` #### `craftguide.add_recipe_filter(name, function(recipes, player))`
Adds a recipe filter with the given `name`. The filter function returns the Adds a recipe filter with the given name. The filter function should return the
recipes to be displayed, given the available recipes and an `ObjectRef` to the recipes to be displayed, given the available recipes and an `ObjectRef` to the
user. Each recipe is a table of the form returned by user. Each recipe is a table of the form returned by
`minetest.get_craft_recipe`. `minetest.get_craft_recipe`.
@ -123,7 +123,7 @@ Removes all recipe filters and adds a new one.
#### `craftguide.remove_recipe_filter(name)` #### `craftguide.remove_recipe_filter(name)`
Removes the recipe filter with the given `name`. Removes the recipe filter with the given name.
#### `craftguide.get_recipe_filters()` #### `craftguide.get_recipe_filters()`
@ -134,41 +134,50 @@ Returns a map of recipe filters, indexed by name.
### Search filters ### Search filters
Search filters are used to perform specific searches inside the search field. Search filters are used to perform specific searches inside the search field.
You can cumulate several filters to perform a specific search. They can be used like so: `<optional name>+<filter name>=<value1>,<value2>,<...>`
They can be used like so: `<optional_name> +<filter name>=<value1>,<value2>,<...>`
Example usages: Examples:
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items. - `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
- `wood +groups=flammable +type=node`: search for group `flammable` amongst items which contain - `sand+groups=falling_node`: search for group `falling_node` for items which contain `sand` in their names.
`wood` in their names AND have a `node` drawtype.
Notes: Notes:
- If `optional_name` is omitted, the search filter will apply to all items, without pre-filtering. - If `optional name` is omitted, the search filter will apply to all items, without pre-filtering.
- The `groups` and `type` filters are currently implemented by default. - Filters can be combined.
- The `groups` filter is currently implemented by default.
#### `craftguide.add_search_filter(name, function(item, values))` #### `craftguide.add_search_filter(name, function(item, values))`
Adds a search filter with the given `name`. Adds a search filter with the given name.
The search function must return a boolean value (whether the given item should be listed or not). The search function should return a boolean value (whether the given item should be listed or not).
Example function sorting items by drawtype: Example function to show items which contain at least a recipe of given width(s):
```lua ```lua
craftguide.add_search_filter("type", function(item, drawtype) craftguide.add_search_filter("widths", function(item, widths)
if drawtype == "node" then local has_width
return reg_nodes[item] local recipes = recipes_cache[item]
elseif drawtype == "item" then
return reg_craftitems[item] if recipes then
elseif drawtype == "tool" then for i = 1, #recipes do
return reg_tools[item] local recipe_width = recipes[i].width
for j = 1, #widths do
local width = tonumber(widths[j])
if width == recipe_width then
has_width = true
break
end end
end
end
end
return has_width
end) end)
``` ```
#### `craftguide.remove_search_filter(name)` #### `craftguide.remove_search_filter(name)`
Removes the search filter with the given `name`. Removes the search filter with the given name.
#### `craftguide.get_search_filters()` #### `craftguide.get_search_filters()`

View File

@ -1,7 +1,5 @@
# ![Preview1](http://i.imgur.com/fIPNYkb.png) Crafting Guide # ![Preview1](http://i.imgur.com/fIPNYkb.png) Crafting Guide
[![ContentDB](https://content.minetest.net/packages/jp/craftguide/shields/title/)](https://content.minetest.net/packages/jp/craftguide/) [![ContentDB](https://content.minetest.net/packages/jp/craftguide/shields/downloads/)](https://content.minetest.net/packages/jp/craftguide/)
#### `craftguide` is the most comprehensive crafting guide on Minetest. #### `craftguide` is the most comprehensive crafting guide on Minetest.
#### Consult the [Minetest Wiki](http://wiki.minetest.net/Crafting_guide) for more details. #### Consult the [Minetest Wiki](http://wiki.minetest.net/Crafting_guide) for more details.
@ -11,6 +9,9 @@ This crafting guide features a **progressive mode**.
This mode is a Terraria-like system that shows recipes you can craft This mode is a Terraria-like system that shows recipes you can craft
from items you ever had in your inventory. To enable it: `craftguide_progressive_mode = true` in `minetest.conf`. from items you ever had in your inventory. To enable it: `craftguide_progressive_mode = true` in `minetest.conf`.
`craftguide` is also integrated in `sfinv` (Minetest Game inventory). To enable it:
`craftguide_sfinv_only = true` in `minetest.conf`.
Use the command `/craft` to show the recipe(s) of the pointed node. Use the command `/craft` to show the recipe(s) of the pointed node.
For developers, `craftguide` also has a [modding API](https://github.com/minetest-mods/craftguide/blob/master/API.md). For developers, `craftguide` also has a [modding API](https://github.com/minetest-mods/craftguide/blob/master/API.md).
@ -18,4 +19,4 @@ For developers, `craftguide` also has a [modding API](https://github.com/minetes
Love this mod? Donations are appreciated: https://www.paypal.me/jpg84240 Love this mod? Donations are appreciated: https://www.paypal.me/jpg84240
![Preview2](https://user-images.githubusercontent.com/7883281/103141399-113b5e00-46f4-11eb-96cd-0167972ca1cf.png) ![Preview2](https://content.minetest.net/uploads/wAGr5rE3fI.png)

1938
init.lua

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ License of source code
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015-present Jean-Patrick Guerrero and contributors. Copyright (c) 2015-2020 Jean-Patrick Guerrero and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -27,8 +27,7 @@ THE SOFTWARE.
Licenses of media (textures) Licenses of media (textures)
---------------------------- ----------------------------
paramat (CC BY-SA 3.0): Copyright © Diego Martínez (kaeza): craftguide_*_icon.png (CC BY-SA 3.0)
craftguide_arrow.png - derived from a texture by BlockMen (CC BY-SA 3.0)
You are free to: You are free to:
Share — copy and redistribute the material in any medium or format. Share — copy and redistribute the material in any medium or format.

View File

@ -4,8 +4,8 @@ Craft Guide=Guide de recettes
Crafting Guide=Guide de recettes Crafting Guide=Guide de recettes
Crafting Guide Sign=Guide de recettes Crafting Guide Sign=Guide de recettes
Bookmarks=Favoris Bookmarks=Favoris
Usage @1 of @2=Usage @1 sur @2 Usage @1 of @2=Usage @1 de @2
Recipe @1 of @2=Recette @1 sur @2 Recipe @1 of @2=Recette @1 de @2
No recipes=Pas de recettes No recipes=Pas de recettes
No usages=Pas d'usages No usages=Pas d'usages
Burning time: @1=Temps de combustion : @1 Burning time: @1=Temps de combustion : @1
@ -46,24 +46,15 @@ Any wood planks=Quelconques planches de bois
Any wool=Quelconque laine Any wool=Quelconque laine
Any yellow dye=Quelconque colorant jaune Any yellow dye=Quelconque colorant jaune
Any yellow flower=Quelconque fleur jaune Any yellow flower=Quelconque fleur jaune
Recipe's too big to be displayed (@1x@2)=La recette est trop grande pour être affichée (@1x@2)
Shapeless=Sans forme Shapeless=Sans forme
Cooking=Cuisson Cooking=Cuisson
No item to show=Aucun item à afficher No item to show=Aucun item à afficher
Collect items to reveal more recipes=Collecte des items pour révéler plus de recettes Collect items to reveal more recipes=Collecte des items pour révéler plus de recettes
Show recipe(s) of the pointed node=Affiche les recettes du bloc visé Show recipe(s) of the pointed node=Affiche les recettes du bloc visé
No node pointed=Aucun bloc visé No node pointed=Aucun bloc visé
You don't know a recipe or usage for this item=Vous ne connaissez aucune recette pour ce bloc You don't know a recipe or usage for this item=Tu ne connais aucune recette pour ce bloc
No recipe or usage for this node=Aucune recette pour ce bloc No recipe or usage for this item=Aucune recette pour ce bloc
Digging=Destruction Digging=Destruction
Digging (by chance)=Destruction (par chance) Digging Chance=Destruction chanceuse
@1 of chance to drop=@1 de chance de tomber @1 of chance to drop=@1 de chance de tomber
Mark this item=Mettre en favori.
Unmark this item=Enlever des favoris.
Cannot mark this item. Limit of bookmarks reached.=Impossible de mettre cet item en favori. Limite des favoris atteinte.
Only drop if using one of these tools: @1=Tombe seulement si détruit avec un de ces outils : @1
Only drop if using this tool: @1=Tombe seulement si détruit avec cet outil : @1
Craft @1 stack=Fabriquer @1 objet
Craft @1 stacks=Fabriquer @1 objets
@1 added in your inventory=@1 mis dans votre inventaire
@1 crafted=@1 fabriqué(s)
Quick crafting=Fabrication rapide

View File

@ -1,40 +0,0 @@
# textdomain: craftguide
Any black dye=任何黑染料
Any black flower=任何黑花
Any blue dye=任何蓝染料
Any blue flower=任何蓝花
Any brown dye=任何棕染料
Any coal=任何煤炭
Any cyan dye=任何青染料
Any dark green dye=任何暗绿染料
Any dark grey dye=任何暗灰染料
Any green dye=任何绿染料
Any green flower=任何绿花
Any grey dye=任何灰染料
Any item belonging to the group(s): @1=任何属于以下组别的物品:@1
Any kind of stone block=任何石方块
Any magenta dye=任何品红染料
Any orange dye=任何橙染料
Any orange flower=任何橙花
Any pink dye=任何粉红染料
Any red dye=任何红染料
Any red flower=任何红花
Any sand=任何沙
Any stick=任何棒
Any vessel=任何容器
Any violet dye=任何紫染料
Any violet flower=任何紫花
Any white dye=任何白染料
Any white flower=任何白花
Any wood planks=任何木板
Any wool=任何羊毛
Any yellow dye=任何黄染料
Any yellow flower=任何黄花
Cooking time: @1=熔炼时间为:@1
No items to show=没有可显示的项目。
Recipe @1 of @2=第@1个配方共@2个
Usage @1 of @2=第@1个用法共@2个
Recipe is too big to be displayed=配方太大,无法显示。
Shapeless=无序配方
Unknown Item=不明物品

View File

@ -27,7 +27,7 @@ Any dark grey dye=
Any green dye= Any green dye=
Any green flower= Any green flower=
Any grey dye= Any grey dye=
Any stone= Any kind of stone block=
Any magenta dye= Any magenta dye=
Any orange dye= Any orange dye=
Any orange flower= Any orange flower=
@ -46,6 +46,7 @@ Any wood planks=
Any wool= Any wool=
Any yellow dye= Any yellow dye=
Any yellow flower= Any yellow flower=
Recipe's too big to be displayed (@1x@2)=
Shapeless= Shapeless=
Cooking= Cooking=
No item to show= No item to show=
@ -53,17 +54,7 @@ Collect items to reveal more recipes=
Show recipe(s) of the pointed node= Show recipe(s) of the pointed node=
No node pointed= No node pointed=
You don't know a recipe or usage for this item= You don't know a recipe or usage for this item=
No recipe or usage for this node= No recipe or usage for this item=
Digging= Digging=
Digging (by chance)= Digging Chance=
@1 of chance to drop= @1 of chance to drop=
Mark this item=
Unmark this item=
Cannot mark this item. Limit of bookmarks reached.=
Only drop if using one of these tools: @1=
Only drop if using this tool: @1=
Craft @1 stack=
Craft @1 stacks=
@1 added in your inventory=
@1 crafted=
Quick crafting=

View File

@ -1,2 +1,3 @@
name = craftguide name = craftguide
optional_depends = sfinv, sfinv_buttons
description = The most comprehensive Crafting Guide on Minetest description = The most comprehensive Crafting Guide on Minetest

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,2 +1,12 @@
# The progressive mode shows recipes you can craft from items you ever had in your inventory. # The progressive mode shows recipes you can craft from items you ever had in your inventory.
craftguide_progressive_mode (Learn crafting recipes progressively) bool false craftguide_progressive_mode (Learn crafting recipes progressively) bool false
# Integration in the default Minetest Game inventory.
craftguide_sfinv_only (Crafting Guide in inventory only) bool false
# Enable pre-caching of item recipes.
# Do NOT disable the first time the mod loads.
# Disabling the auto-caching will result in faster mod loading.
# If you enable or disable mods, or edit the current mod recipes in your setup, you SHOULD re-enable this setting until the next caching at least.
# Usage at your own risk.
craftguide_autocache (Auto-caching of recipes) bool true

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
textures/craftguide_no.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB