Skip to content

Commit 27d611f

Browse files
SmallJokerPascal Abresch
and
Pascal Abresch
authoredApr 13, 2020
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 <nep@packageloss.eu>
1 parent 0ac999d commit 27d611f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
 

‎builtin/game/item.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ end
675675
-- Item definition defaults
676676
--
677677

678+
local default_stack_max = tonumber(minetest.settings:get("default_stack_max")) or 99
679+
678680
core.nodedef_default = {
679681
-- Item properties
680682
type="node",
@@ -684,7 +686,7 @@ core.nodedef_default = {
684686
inventory_image = "",
685687
wield_image = "",
686688
wield_scale = {x=1,y=1,z=1},
687-
stack_max = 99,
689+
stack_max = default_stack_max,
688690
usable = false,
689691
liquids_pointable = false,
690692
tool_capabilities = nil,
@@ -748,7 +750,7 @@ core.craftitemdef_default = {
748750
inventory_image = "",
749751
wield_image = "",
750752
wield_scale = {x=1,y=1,z=1},
751-
stack_max = 99,
753+
stack_max = default_stack_max,
752754
liquids_pointable = false,
753755
tool_capabilities = nil,
754756

@@ -786,7 +788,7 @@ core.noneitemdef_default = { -- This is used for the hand and unknown items
786788
inventory_image = "",
787789
wield_image = "",
788790
wield_scale = {x=1,y=1,z=1},
789-
stack_max = 99,
791+
stack_max = default_stack_max,
790792
liquids_pointable = false,
791793
tool_capabilities = nil,
792794

‎builtin/settingtypes.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,10 @@ map-dir (Map directory) path
10791079
# Setting it to -1 disables the feature.
10801080
item_entity_ttl (Item entity TTL) int 900
10811081

1082+
# Specifies the default stack size of nodes, items and tools.
1083+
# Note that mods or games may explicitly set a stack for certain (or all) items.
1084+
default_stack_max (Default stack size) int 99
1085+
10821086
# Enable players getting damage and dying.
10831087
enable_damage (Damage) bool false
10841088

‎doc/lua_api.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6735,6 +6735,8 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and
67356735

67366736
wield_scale = {x = 1, y = 1, z = 1},
67376737

6738+
-- The default value of 99 may be configured by
6739+
-- users using the setting "default_stack_max"
67386740
stack_max = 99,
67396741

67406742
range = 4.0,

0 commit comments

Comments
 (0)
Please sign in to comment.