Skip to content

Commit 1e5f2e0

Browse files
authoredApr 9, 2019
Nodedef 'drop' documentation: Improve, add tool filtering (#8458)
1 parent 8306f7d commit 1e5f2e0

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed
 

Diff for: ‎doc/lua_api.txt

+34-7
Original file line numberDiff line numberDiff line change
@@ -6155,17 +6155,44 @@ Used by `minetest.register_node`.
61556155
},
61566156

61576157
drop = "",
6158-
-- Name of dropped node when dug. Default is the node itself.
6159-
-- Alternatively:
6158+
-- Name of dropped item when dug.
6159+
-- Default dropped item is the node itself.
6160+
-- Using a table allows multiple items, drop chances and tool filtering:
61606161
drop = {
6161-
-- Maximum number of items to drop
61626162
max_items = 1,
6163-
-- Choose max_items randomly from this list
6163+
-- Maximum number of item lists to drop.
6164+
-- The entries in 'items' are processed in order. For each:
6165+
-- Tool filtering is applied, chance of drop is applied, if both are
6166+
-- successful the entire item list is dropped.
6167+
-- Entry processing continues until the number of dropped item lists
6168+
-- equals 'max_items'.
6169+
-- Therefore, entries should progress from low to high drop chance.
61646170
items = {
6171+
-- Entry examples.
61656172
{
6166-
items = {"foo:bar", "baz:frob"}, -- Items to drop
6167-
rarity = 1, -- Probability of dropping is 1 / rarity
6168-
inherit_color = true, -- Inherit palette color from the node
6173+
-- 1 in 1000 chance of dropping a diamond.
6174+
-- Default rarity is '1'.
6175+
rarity = 1000,
6176+
items = {"default:diamond"},
6177+
},
6178+
{
6179+
-- Only drop if using a tool whose name is identical to one
6180+
-- of these.
6181+
tools = {"default:shovel_mese", "default:shovel_diamond"},
6182+
rarity = 5,
6183+
items = {"default:dirt"},
6184+
-- Whether all items in the dropped item list inherit the
6185+
-- hardware coloring palette color from the dug node.
6186+
-- Default is 'false'.
6187+
inherit_color = true,
6188+
},
6189+
{
6190+
-- Only drop if using a tool whose name contains
6191+
-- "default:shovel_".
6192+
tools = {"~default:shovel_"},
6193+
rarity = 2,
6194+
-- The item list dropped.
6195+
items = {"default:sand", "default:desert_sand"},
61696196
},
61706197
},
61716198
},

0 commit comments

Comments
 (0)
Please sign in to comment.