mirror of
https://github.com/minetest-mods/craftguide.git
synced 2025-06-29 22:50:41 +02:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
d324c5f1e5 | |||
dfa45789e2 | |||
80a0d67f15 | |||
22c5c9444e | |||
97676d094e | |||
ca18ae0e3a | |||
e710fcd483 | |||
a2e4f20791 | |||
22a85f50c1 | |||
0271f61fc2 | |||
84756af3a1 | |||
9dc656d5a2 | |||
4c0371c5cc | |||
b6181ebd7a | |||
eb7292da7a | |||
9df355b899 | |||
a242f6c61c | |||
c9ebd5c069 | |||
054a7ab3af | |||
b1a67eb632 | |||
e0e57b45ea |
@ -2,6 +2,7 @@ unused_args = false
|
|||||||
allow_defined_top = true
|
allow_defined_top = true
|
||||||
|
|
||||||
read_globals = {
|
read_globals = {
|
||||||
|
"core",
|
||||||
"minetest",
|
"minetest",
|
||||||
"default",
|
"default",
|
||||||
"sfinv",
|
"sfinv",
|
||||||
|
81
API.md
81
API.md
@ -11,17 +11,35 @@ craftguide.register_craft_type("digging", {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Registering a custom crafting recipe (example)
|
#### Registering a custom crafting recipe (examples)
|
||||||
|
|
||||||
```Lua
|
```Lua
|
||||||
craftguide.register_craft({
|
craftguide.register_craft({
|
||||||
type = "digging",
|
type = "digging",
|
||||||
width = 1,
|
width = 1,
|
||||||
output = "default:cobble 2",
|
result = "default:cobble 2",
|
||||||
items = {"default:stone"},
|
items = {"default:stone"},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Recipes can also be registered in a Minecraft-like way:
|
||||||
|
|
||||||
|
```Lua
|
||||||
|
craftguide.register_craft({
|
||||||
|
grid = {
|
||||||
|
"X #",
|
||||||
|
" ## ",
|
||||||
|
"X#X#",
|
||||||
|
"X X",
|
||||||
|
},
|
||||||
|
key = {
|
||||||
|
['#'] = "default:wood",
|
||||||
|
['X'] = "default:glass",
|
||||||
|
},
|
||||||
|
result = "default:mese 3",
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Recipe filters
|
### Recipe filters
|
||||||
@ -70,10 +88,15 @@ Returns a map of recipe filters, indexed by name.
|
|||||||
Search filters are used to perform specific searches inside the search field.
|
Search filters are used to perform specific searches inside the search field.
|
||||||
They can be used like so: `<optional name>+<filter name>=<value1>,<value2>,<...>`
|
They can be used like so: `<optional name>+<filter name>=<value1>,<value2>,<...>`
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
- `+groups=cracky,crumbly`: search for groups `cracky` and `crumbly` in all items.
|
||||||
|
- `sand+groups=falling_node`: search for group `falling_node` for items which contain `sand` in their names.
|
||||||
|
|
||||||
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.
|
||||||
- Filters can be combined.
|
- Filters can be combined.
|
||||||
- The `+groups=` filter is currently implemented by default.
|
- The `groups` filter is currently implemented by default.
|
||||||
|
|
||||||
#### `craftguide.add_search_filter(name, function(item, values))`
|
#### `craftguide.add_search_filter(name, function(item, values))`
|
||||||
|
|
||||||
@ -114,49 +137,6 @@ Returns a map of search filters, indexed by name.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Custom formspec elements
|
|
||||||
|
|
||||||
#### `craftguide.add_formspec_element(name, def)`
|
|
||||||
|
|
||||||
Adds a formspec element to the current formspec.
|
|
||||||
Supported types: `box`, `label`, `image`, `button`, `tooltip`, `item_image`, `image_button`, `item_image_button`
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
craftguide.add_formspec_element("export", {
|
|
||||||
type = "button",
|
|
||||||
element = function(data)
|
|
||||||
-- Should return a table of parameters according to the formspec element type.
|
|
||||||
-- Note: for all buttons, the 'name' parameter *must not* be specified!
|
|
||||||
if data.recipes then
|
|
||||||
return {
|
|
||||||
data.iX - 3.7, -- X
|
|
||||||
sfinv_only and 7.9 or 8, -- Y
|
|
||||||
1.6, -- W
|
|
||||||
1, -- H
|
|
||||||
ESC(S("Export")) -- label
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
-- Optional.
|
|
||||||
action = function(player, data)
|
|
||||||
-- When the button is pressed.
|
|
||||||
print("Exported!")
|
|
||||||
end
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `craftguide.remove_formspec_element(name)`
|
|
||||||
|
|
||||||
Removes the formspec element with the given name.
|
|
||||||
|
|
||||||
#### `craftguide.get_formspec_elements()`
|
|
||||||
|
|
||||||
Returns a map of formspec elements, indexed by name.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Miscellaneous
|
### Miscellaneous
|
||||||
|
|
||||||
#### `craftguide.show(player_name, item, show_usages)`
|
#### `craftguide.show(player_name, item, show_usages)`
|
||||||
@ -166,3 +146,12 @@ Opens the Crafting Guide with the current filter applied.
|
|||||||
* `player_name`: string param.
|
* `player_name`: string param.
|
||||||
* `item`: optional, string param. If set, this item is pre-selected. If the item does not exist or has no recipe, use the player's previous selection. By default, player's previous selection is used
|
* `item`: optional, string param. If set, this item is pre-selected. If the item does not exist or has no recipe, use the player's previous selection. By default, player's previous selection is used
|
||||||
* `show_usages`: optional, boolean param. If true, show item usages.
|
* `show_usages`: optional, boolean param. If true, show item usages.
|
||||||
|
|
||||||
|
#### `craftguide.group_stereotypes`
|
||||||
|
|
||||||
|
This is the table indexing the item groups by stereotypes.
|
||||||
|
You can add a stereotype like so:
|
||||||
|
|
||||||
|
```Lua
|
||||||
|
craftguide.group_stereotypes.radioactive = "mod:item"
|
||||||
|
```
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Craft Guide=книга рецептов крафта
|
Craft Guide=книга рецептов крафта
|
||||||
Crafting Guide=книга рецептов крафта
|
Crafting Guide=книга рецептов крафта
|
||||||
Crafting Guide Sign=
|
Crafting Guide Sign=Знак с книгой рецептов
|
||||||
Search=Поиск
|
Search=Поиск
|
||||||
Reset=Сброс
|
Reset=Сброс
|
||||||
Previous page=Предыдущая страница
|
Previous page=Предыдущая страница
|
||||||
@ -13,13 +13,13 @@ Burning time: @1=Время горения: @1
|
|||||||
Cooking time: @1=Время преготовления: @1
|
Cooking time: @1=Время преготовления: @1
|
||||||
Any item belonging to the group(s): @1=Любой элемент из группы: @1
|
Any item belonging to the group(s): @1=Любой элемент из группы: @1
|
||||||
Recipe is too big to be displayed (@1x@2)=Рецепт слишком большой для показа (@1x@2)
|
Recipe is too big to be displayed (@1x@2)=Рецепт слишком большой для показа (@1x@2)
|
||||||
Shapeless=
|
Shapeless=Бесформенный
|
||||||
Cooking=
|
Cooking=Приготовление
|
||||||
Increase window size=Увеличить окно
|
Increase window size=Увеличить окно
|
||||||
Decrease window size=Уменьшить окно
|
Decrease window size=Уменьшить окно
|
||||||
No item to show=Нет элемента для показа
|
No item to show=Нет элемента для показа
|
||||||
Collect items to reveal more recipes=
|
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 for this node=
|
You don't know a recipe for this node=Вы не знаете рецепт для этой ноды
|
||||||
No recipe for this node=
|
No recipe for this node=Нет рецептов для этой ноды
|
||||||
|
Reference in New Issue
Block a user