From b6d36e59b0a82f75692789610f5c7a7cffbdc349 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Mon, 18 Oct 2021 21:11:07 +0200 Subject: [PATCH] Add missing doc --- API.md | 5 +++++ init.lua | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/API.md b/API.md index 8bd10db..9216d22 100644 --- a/API.md +++ b/API.md @@ -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 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`. diff --git a/init.lua b/init.lua index c5480e3..613e366 100644 --- a/init.lua +++ b/init.lua @@ -2964,7 +2964,7 @@ local function init_backpack(player) data.bag = create_inventory(fmt("%s_backpack", name), { allow_put = function(_inv, listname, _, stack) 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 return 1 @@ -2978,7 +2978,7 @@ local function init_backpack(player) on_put = function(_, _, _, stack) local stackname = stack:get_name() 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]) set_fs(player) @@ -3423,7 +3423,7 @@ for size, item in pairs(bag_recipes) do description = fmt("%s Backpack", size:gsub("^%l", upper)), inventory_image = fmt("i3_bag_%s.png", size), stack_max = 1, - groups = {i3_bag = item.size} + groups = {bag = item.size} }) core.register_craft {output = bagname, recipe = item.rcp}