NetherEran 7f724d4767 fixed german translation for 'Item' | 5 anni fa | |
---|---|---|
.. | ||
locale | 5 anni fa | |
tests | 5 anni fa | |
textures | 5 anni fa | |
utils | 5 anni fa | |
.gitignore | 5 anni fa | |
.luacheckrc | 5 anni fa | |
.travis.yml | 5 anni fa | |
LICENSE.txt | 5 anni fa | |
README.md | 5 anni fa | |
api.lua | 5 anni fa | |
async_craft.lua | 5 anni fa | |
depends.txt | 5 anni fa | |
gui.lua | 5 anni fa | |
init.lua | 5 anni fa | |
mod.conf | 5 anni fa | |
screenshot.png | 5 anni fa | |
stations.lua | 5 anni fa |
Adds semi-realistic crafting with unlockable recipes to Minetest, and removes the craft grid.
By rubenwardy, adapted for The End by NetherEran License: LGPLv2.1+
rubenwardy (CC BY-SA 3.0): craftingslot*.png
Neuromancer (CC BY-SA 3.0): craftingfurnace*.png
BlockMen (CC BY-SA 3.0): gui_*.png
paramat (CC BY-SA 3.0) creative_trash_icon.png (derived from a texture by kilbith, same license)
Any recipes must be designed such that any particular item can only be used as one of the ingredients.
For example, you can't have the following recipe as default:wood
could
be used twice: default:wood, group:wood
.
crafting.register_type(name)
type
used when searching for recipescrafting.register_recipe(def)
def
a table with the following fields:
type
- one of the registered types.output
- the result of the craft, eg: default:stone 3
.items
- A list of ingredients, eg: {"stone", "wood 3"}
.level
- level of station required.always_known
- If true, this recipe will never need to be unlocked.crafting.get_recipe(id)
crafting.get_unlocked(name)
name
is the player's namecrafting.unlock(name, v)
name
is the player's namev
is a single output or list of outputscrafting.get_all_for_player(player, type, level)
items
- a key-value table, key being item name and value being a table:
have
- how many the player hasneed
- how many of this item neededrecipe
- the recipecraftable
- is craftable?craftable
is a table of the items the player can craft with the items they have.uncraftable
is a table of items the player knows about, but is missing items for.crafting.get_all(type, level, item_hash, unlocked)
item_hash
- a table with keys being item names or group names (eg: group:wood
)
and the value being the number required.unlocked
- a list of outputs the player has unlocked.crafting.set_item_hashes_from_list(inv, listname, item_hash)
crafting.find_required_items(inv, listname, recipe)
crafting.has_required_items(inv, listname, recipe)
"main"
list in inv
contains the required items.crafting.perform_craft(name, inv, listname, outlistname, recipe)
listname
and put output in the outlistname
list in inv
.crafting.make_result_selector(player, type, level, size, context)
type
- craft type.size
- how many slots to show on a page.context
- server-side storage between show and submit, can be {}
.
crafting_page
- page to showcrafting.result_select_on_receive_results(player, type, level, context, fields)
crafting.make_on_rightclick(type, level, inv_size)
crafting.create_async_station(name, type, level, def_inactive, def_active)
Installation:
# Dependencies for linter and test framework
sudo apt install luarocks
sudo luarocks install luacheck
sudo luarocks install busted
# Set up git hook to disallow commiting when linter or tests fail
./utils/setup.sh