Compare commits

...

33 Commits
1.3.1b ... 1.4

Author SHA1 Message Date
6e744b44b1 Few minor optimizations 2019-02-07 16:08:50 +01:00
3498cf3f86 Update license file 2019-02-07 15:54:15 +01:00
7757eb72fd Merge pull request #57 from pauloue/fixes
Misc. fixes and refactors
2019-02-07 14:19:58 +01:00
a7dd13994f remove shapeless, minor refactors 2019-02-06 22:59:38 -05:00
85ece2c8b9 filter /craft recipes, fix crash, fix sfinv form 2019-02-06 15:05:33 -05:00
65a8707a69 Repair the /craft command 2019-02-06 02:02:41 +01:00
3e9e16b661 Minor cleaning 2019-02-06 01:26:32 +01:00
4289dea108 Separate recipe filters and progressive mode 2019-02-03 16:17:02 +01:00
5625a0cb1c Remove superfluous call 2019-01-31 01:10:09 +01:00
5e8079b2e8 Saving p_items not necessary 2019-01-30 02:14:11 +01:00
fd375c92b3 Init data when player joins 2019-01-30 02:02:09 +01:00
7fc2d3a96a Ensure sfinv is loaded 2019-01-27 16:32:48 +01:00
c1b1bef263 Progressive mode: Remember discovered recipes 2019-01-25 02:43:33 +01:00
e6268a395f Empty data when player leaves 2019-01-22 02:03:01 +01:00
5d73794096 Localize formspec string formats 2019-01-22 01:59:54 +01:00
8a9f857204 Fix API doc 2019-01-22 01:51:17 +01:00
d950c71dbc Refactors, optimizations and fixes 2019-01-22 01:45:21 +01:00
5ee1bea4ce Progressive mode: Add a name to filters 2019-01-20 02:13:30 +01:00
61ae85a09c Progressive mode: Add functions in API to add/set/get filters 2019-01-18 17:39:10 +01:00
c4fe467e6f Remove wood group 2019-01-18 15:56:52 +01:00
ed11bf3281 Fix tooltip 2019-01-15 14:38:15 +01:00
18affcb00e Allow searching same string again in progressive mode 2019-01-13 18:30:21 +01:00
fa8d602a64 Fix sfinv mode bg 2019-01-13 02:40:18 +01:00
0959eaef0b Update License 2019-01-13 01:50:26 +01:00
157c6e5004 get_formspec -> make_formspec 2019-01-13 01:48:14 +01:00
50317cc20e Progressive: refactor, fix some bugs, add API function 2019-01-13 01:37:23 +01:00
1def071029 Fix background 2019-01-13 01:18:41 +01:00
134fbf382d Do not search again for same string 2019-01-11 01:54:17 +01:00
70682b230b Hardset button size to 1.1 2019-01-09 21:11:06 +01:00
a07c8bc48e Merge pull request #43 from pauloue/playerdata
Separate player data
2019-01-09 00:20:10 +01:00
e0db5834b3 Separate player data 2019-01-08 14:28:53 -05:00
7f6dd430ce Various fixes
- Include recipes with matching groups in usages
- Fix group_to_item()
- Fix custom recipes not showing in usages
2019-01-08 01:28:52 +01:00
d1ee125a1a Remove erroneous quotation marks 2019-01-04 02:19:29 +01:00
4 changed files with 680 additions and 558 deletions

View File

@ -1,23 +1,29 @@
## ![Preview1](http://i.imgur.com/fIPNYkb.png) Crafting Guide ##
# ![Preview1](http://i.imgur.com/fIPNYkb.png) Crafting Guide
#### `craftguide` is the most comprehensive crafting guide on Minetest. ####
#### Consult the [Minetest Wiki](http://wiki.minetest.net/Crafting_guide) for more details. ####
#### `craftguide` is the most comprehensive crafting guide on Minetest.
#### Consult the [Minetest Wiki](http://wiki.minetest.net/Crafting_guide) for more details.
This crafting guide is a blue book named *"Crafting Guide"* or a wooden sign.
This crafting guide features a **progressive mode**.
The progressive mode is a Terraria-like system that only shows recipes you can craft from items in inventory.
The progressive mode can be enabled with `craftguide_progressive_mode = true` in `minetest.conf`.
The progressive mode is a Terraria-like system that only shows recipes you can craft
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) when you enable it with
`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.
![Preview2](https://i.imgur.com/bToFH38.png)
---
`craftguide` has an API to register **custom recipes**. Demos:
#### Registering a custom crafting type ####
## API
### Custom recipes
#### Registering a custom crafting type
```Lua
craftguide.register_craft_type("digging", {
description = "Digging",
@ -25,7 +31,8 @@ craftguide.register_craft_type("digging", {
})
```
#### Registering a custom crafting recipe ####
#### Registering a custom crafting recipe
```Lua
craftguide.register_craft({
type = "digging",
@ -35,4 +42,41 @@ craftguide.register_craft({
})
```
![Preview2](https://i.imgur.com/bToFH38.png)
### Recipe filters
Recipe filters can be used to filter the recipes shown to players. Progressive
mode is implemented as a recipe filter.
#### `craftguide.add_recipe_filter(name, function(recipes, player))`
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
user. Each recipe is a table of the form returned by
`minetest.get_craft_recipe`.
Example function to hide recipes for items from a mod called "secretstuff":
```lua
craftguide.add_recipe_filter("Hide secretstuff", function(recipes)
local filtered = {}
for _, recipe in ipairs(recipes) do
if recipe.output:sub(1,12) ~= "secretstuff:" then
filtered[#filtered + 1] = recipe
end
end
return filtered
end)
```
#### `craftguide.remove_recipe_filter(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()`
Returns a map of recipe filters, indexed by name.

View File

@ -1,3 +1,3 @@
sfinv?
sfinv_buttons?
intllib?
intllib?

1149
init.lua

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,28 @@
License of source code
----------------------
« Copyright © 2015-2018, Jean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com>
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Copyright (c) 2015-2019 Jean-Patrick Guerrero and contributors.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The Software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders X be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Except as contained in this notice, the name of the <copyright holders> shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the <copyright holders>. »
Licenses of media (textures)
----------------------------