File tree 2 files changed +15
-6
lines changed
2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -121,14 +121,16 @@ Set the current WorldEdit region to `<node>`.
121
121
122
122
Set the param2 value of all nodes in the current WorldEdit region to ` <param2> ` .
123
123
124
- ### ` //mix <node1> ... `
124
+ ### ` //mix <node1> [<count1>] <node2> [<count2>] ... `
125
125
126
- Fill the current WorldEdit region with a random mix of ` <node1> ` , ` ... ` .
126
+ Fill the current WorldEdit region with a random mix of ` <node1> ` , ` <node2> ` , ` ... ` . Weightings can be optionally specified via a number after a node name .
127
127
128
128
//mix air
129
129
//mix cactus stone glass sandstone
130
130
//mix Bronze
131
131
//mix default:cobble air
132
+ //mix stone 3 dirt 2
133
+ //mix cobblestone 8 stoneblock 2 stonebrick
132
134
133
135
### ` //replace <search node> <replace node> `
134
136
Original file line number Diff line number Diff line change @@ -425,15 +425,22 @@ minetest.register_chatcommand("/param2", {
425
425
})
426
426
427
427
minetest .register_chatcommand (" /mix" , {
428
- params = " <node1> ..." ,
428
+ params = " <node1> [<weighting1>] [<node2> [<weighting2>]] ..." ,
429
429
description = " Fill the current WorldEdit region with a random mix of <node1>, ..." ,
430
430
privs = {worldedit = true },
431
431
func = safe_region (function (name , param )
432
432
local nodes = {}
433
433
for nodename in param :gmatch (" [^%s]+" ) do
434
- local node = get_node (name , nodename )
435
- if not node then return end
436
- nodes [# nodes + 1 ] = node
434
+ if tonumber (nodename ) ~= nil and # nodes > 0 then
435
+ local last_node = nodes [# nodes ]
436
+ for i = 1 , tonumber (nodename ) do
437
+ nodes [# nodes + 1 ] = last_node
438
+ end
439
+ else
440
+ local node = get_node (name , nodename )
441
+ if not node then return end
442
+ nodes [# nodes + 1 ] = node
443
+ end
437
444
end
438
445
439
446
local pos1 , pos2 = worldedit .pos1 [name ], worldedit .pos2 [name ]
You can’t perform that action at this time.
0 commit comments