Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3861bcc6a | |||
6b76c8c10f | |||
5f68d2de11 | |||
ea12d5ca14 | |||
3d77ec58b4 | |||
83151cb394 | |||
337ac898cd | |||
cb0200a222 | |||
ae4b15a748 | |||
2fa14ae146 | |||
8b86dfc857 | |||
c468ab22fd | |||
d324c5f1e5 | |||
dfa45789e2 | |||
80a0d67f15 | |||
22c5c9444e | |||
97676d094e | |||
ca18ae0e3a | |||
e710fcd483 | |||
a2e4f20791 |
@ -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",
|
||||||
|
78
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
|
||||||
@ -55,10 +73,6 @@ end)
|
|||||||
|
|
||||||
Removes the recipe filter with the given name.
|
Removes the recipe filter with the given name.
|
||||||
|
|
||||||
#### `craftguide.set_recipe_filter(name, function(recipe, player))`
|
|
||||||
|
|
||||||
Removes all recipe filters and adds a new one.
|
|
||||||
|
|
||||||
#### `craftguide.get_recipe_filters()`
|
#### `craftguide.get_recipe_filters()`
|
||||||
|
|
||||||
Returns a map of recipe filters, indexed by name.
|
Returns a map of recipe filters, indexed by name.
|
||||||
@ -119,49 +133,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)`
|
||||||
@ -180,3 +151,12 @@ You can add a stereotype like so:
|
|||||||
```Lua
|
```Lua
|
||||||
craftguide.group_stereotypes.radioactive = "mod:item"
|
craftguide.group_stereotypes.radioactive = "mod:item"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `craftguide.background`
|
||||||
|
|
||||||
|
You can set a custom background theme by overriding this variable:
|
||||||
|
|
||||||
|
```Lua
|
||||||
|
craftguide.background = "my_custom_bg.png"
|
||||||
|
|
||||||
|
```
|
||||||
|
@ -17,5 +17,4 @@ 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).
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
sfinv?
|
|
||||||
sfinv_buttons?
|
|
2
mod.conf
@ -1 +1,3 @@
|
|||||||
name = craftguide
|
name = craftguide
|
||||||
|
optional_depends = sfinv, sfinv_buttons
|
||||||
|
description = The most comprehensive Crafting Guide on Minetest
|
||||||
|
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 68 B |
BIN
textures/craftguide_bg_full.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 894 B |
Before Width: | Height: | Size: 685 B |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.9 KiB |