Add group-based tool filtering for node drops (#10141)

Supports both AND and OR requirements, e.g.

 * "a tool that's in any of these groups"
 * "a tool that's in all of these groups"
This commit is contained in:
Treer
2021-08-28 04:23:20 +10:00
committed by GitHub
parent d36dca3aba
commit 149d8fc8d6
2 changed files with 46 additions and 3 deletions

View File

@@ -7798,14 +7798,24 @@ Used by `minetest.register_node`.
inherit_color = true,
},
{
-- Only drop if using a item whose name contains
-- Only drop if using an item whose name contains
-- "default:shovel_" (this item filtering by string matching
-- is deprecated).
-- is deprecated, use tool_groups instead).
tools = {"~default:shovel_"},
rarity = 2,
-- The item list dropped.
items = {"default:sand", "default:desert_sand"},
},
{
-- Only drop if using an item in the "magicwand" group, or
-- an item that is in both the "pickaxe" and the "lucky"
-- groups.
tool_groups = {
"magicwand",
{"pickaxe", "lucky"}
},
items = {"default:coal_lump"},
},
},
},