Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add setting to allow bags to stack #241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
3 changes: 3 additions & 0 deletions settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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