From 3532df05f3a4f956fe868b2896fb76f98a52e271 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 13 Apr 2020 10:53:10 +0200 Subject: [PATCH] Add default stack size setting (#8873) New setting "default_stack_max" to alter the default stack sizes of all items when desired. Co-authored-by: Pascal Abresch --- builtin/game/item.lua | 8 +++++--- builtin/settingtypes.txt | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 513c3a5..3aaa71e 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -675,6 +675,8 @@ end -- Item definition defaults -- +local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99 + core.nodedef_default = { -- Item properties type="node", @@ -684,7 +686,7 @@ core.nodedef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, usable = false, liquids_pointable = false, tool_capabilities = nil, @@ -748,7 +750,7 @@ core.craftitemdef_default = { inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, liquids_pointable = false, tool_capabilities = nil, @@ -786,7 +788,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items inventory_image = "", wield_image = "", wield_scale = {x=1,y=1,z=1}, - stack_max = 99, + stack_max = default_stack_max, liquids_pointable = false, tool_capabilities = nil, diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 101b32a..b9228f3 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -1079,6 +1079,10 @@ map-dir (Map directory) path # Setting it to -1 disables the feature. item_entity_ttl (Item entity TTL) int 900 +# Specifies the default stack size of nodes, items and tools. +# Note that mods or games may explicitly set a stack for certain (or all) items. +default_stack_max (Default stack size) int 99 + # Enable players getting damage and dying. enable_damage (Damage) bool false