add setting to allow bags to stack, by registering as a craftitem instead of a tool.

This commit is contained in:
flux 2023-12-27 12:31:25 -08:00
parent e7d03626b4
commit 597234970a
No known key found for this signature in database
GPG Key ID: 9333B27816848A15
2 changed files with 14 additions and 4 deletions

View File

@ -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},

View File

@ -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