From 597234970a5cf25fa85b2b70bda4cbaae21d6409 Mon Sep 17 00:00:00 2001 From: flux <25628292+fluxionary@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:31:25 -0800 Subject: [PATCH] add setting to allow bags to stack, by registering as a craftitem instead of a tool. --- bags.lua | 15 +++++++++++---- settingtypes.txt | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bags.lua b/bags.lua index f6d4da6..77d2344 100644 --- a/bags.lua +++ b/bags.lua @@ -249,20 +249,27 @@ minetest.register_allow_player_inventory_action(function(player, action, invento end end) --- register bag tools -minetest.register_tool("unified_inventory:bag_small", { +local register +if minetest.settings:get_bool("unified_inventory_stackable_bags", false) then + register = minetest.register_craftitem +else + register = minetest.register_tool +end + +-- register bags +register("unified_inventory:bag_small", { description = S("Small Bag"), inventory_image = "bags_small.png", groups = {bagslots=8}, }) -minetest.register_tool("unified_inventory:bag_medium", { +register("unified_inventory:bag_medium", { description = S("Medium Bag"), inventory_image = "bags_medium.png", groups = {bagslots=16}, }) -minetest.register_tool("unified_inventory:bag_large", { +register("unified_inventory:bag_large", { description = S("Large Bag"), inventory_image = "bags_large.png", groups = {bagslots=24}, diff --git a/settingtypes.txt b/settingtypes.txt index 4fabbe5..d14e63f 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -30,3 +30,6 @@ unified_inventory_only_names (HUD item name: first line only) bool true # Crops the shown description to the specified length. # 0 disables this functionality. unified_inventory_max_item_name_length (HUD item names: character limit) int 80 + +# If true, bags will be stackable to the default stack max +unified_inventory_stackable_bags (Stackable bags) bool false