Add missing doc

This commit is contained in:
Jean-Patrick Guerrero 2021-10-18 21:11:07 +02:00
parent 744c9d5b02
commit b6d36e59b0
2 changed files with 8 additions and 3 deletions

5
API.md
View File

@ -246,6 +246,11 @@ Returns a map of search filters, indexed by name.
If set, the mod will export all the cached recipes and usages in a JSON format If set, the mod will export all the cached recipes and usages in a JSON format
to the given URL (HTTP support is required¹). to the given URL (HTTP support is required¹).
#### `groups = {bag = <1-3>}`
The `bag` group in the item definition allows to extend the player inventory size
according to a number between 1 and 3.
--- ---
**¹** Add `i3` to the `secure.http_mods` or `secure.trusted_mods` setting in `minetest.conf`. **¹** Add `i3` to the `secure.http_mods` or `secure.trusted_mods` setting in `minetest.conf`.

View File

@ -2964,7 +2964,7 @@ local function init_backpack(player)
data.bag = create_inventory(fmt("%s_backpack", name), { data.bag = create_inventory(fmt("%s_backpack", name), {
allow_put = function(_inv, listname, _, stack) allow_put = function(_inv, listname, _, stack)
local empty = _inv:get_stack(listname, 1):is_empty() local empty = _inv:get_stack(listname, 1):is_empty()
local item_group = minetest.get_item_group(stack:get_name(), "i3_bag") local item_group = minetest.get_item_group(stack:get_name(), "bag")
if empty and item_group > 0 and item_group < 4 then if empty and item_group > 0 and item_group < 4 then
return 1 return 1
@ -2978,7 +2978,7 @@ local function init_backpack(player)
on_put = function(_, _, _, stack) on_put = function(_, _, _, stack)
local stackname = stack:get_name() local stackname = stack:get_name()
data.bag_item = stackname data.bag_item = stackname
data.bag_size = minetest.get_item_group(stackname, "i3_bag") data.bag_size = minetest.get_item_group(stackname, "bag")
inv:set_size("main", BAG_SIZES[data.bag_size]) inv:set_size("main", BAG_SIZES[data.bag_size])
set_fs(player) set_fs(player)
@ -3423,7 +3423,7 @@ for size, item in pairs(bag_recipes) do
description = fmt("%s Backpack", size:gsub("^%l", upper)), description = fmt("%s Backpack", size:gsub("^%l", upper)),
inventory_image = fmt("i3_bag_%s.png", size), inventory_image = fmt("i3_bag_%s.png", size),
stack_max = 1, stack_max = 1,
groups = {i3_bag = item.size} groups = {bag = item.size}
}) })
core.register_craft {output = bagname, recipe = item.rcp} core.register_craft {output = bagname, recipe = item.rcp}