\r
Set the param2 value of all nodes in the current WorldEdit region to `<param2>`.\r
\r
-### `//mix <node1> ...`\r
+### `//mix <node1> [<count1>] <node2> [<count2>]...`\r
\r
-Fill the current WorldEdit region with a random mix of `<node1>`, `...`.\r
+Fill the current WorldEdit region with a random mix of `<node1>`, `<node2>`, `...`. Weightings can be optionally specified via a number after a node name.\r
\r
//mix air\r
//mix cactus stone glass sandstone\r
//mix Bronze\r
//mix default:cobble air\r
+ //mix stone 3 dirt 2\r
+ //mix cobblestone 8 stoneblock 2 stonebrick\r
\r
### `//replace <search node> <replace node>`\r
\r
})\r
\r
minetest.register_chatcommand("/mix", {\r
- params = "<node1> ...",\r
+ params = "<node1> [<weighting1>] [<node2> [<weighting2>]] ...",\r
description = "Fill the current WorldEdit region with a random mix of <node1>, ...",\r
privs = {worldedit=true},\r
func = safe_region(function(name, param)\r
local nodes = {}\r
for nodename in param:gmatch("[^%s]+") do\r
- local node = get_node(name, nodename)\r
- if not node then return end\r
- nodes[#nodes + 1] = node\r
+ if tonumber(nodename) ~= nil and #nodes > 0 then\r
+ local last_node = nodes[#nodes]\r
+ for i = 1, tonumber(nodename) do\r
+ nodes[#nodes + 1] = last_node\r
+ end\r
+ else\r
+ local node = get_node(name, nodename)\r
+ if not node then return end\r
+ nodes[#nodes + 1] = node\r
+ end\r
end\r
\r
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]\r