mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-09-27 15:10:17 +02:00
//mix: Add node weighting support
This commit is contained in:
parent
f7256633c0
commit
1fde8fb1fd
|
@ -431,10 +431,20 @@ minetest.register_chatcommand("/mix", {
|
|||
func = safe_region(function(name, param)
|
||||
local nodes = {}
|
||||
for nodename in param:gmatch("[^%s]+") do
|
||||
if tonumber(nodename) ~= nil then
|
||||
local last_node = nodes[#nodes]
|
||||
local node_count = tonumber(nodename)
|
||||
minetest.log("action", "last node: " .. last_node .. ", count: " .. node_count)
|
||||
|
||||
for i=1,node_count do
|
||||
nodes[#nodes + 1] = last_node
|
||||
end
|
||||
else
|
||||
local node = get_node(name, nodename)
|
||||
if not node then return end
|
||||
nodes[#nodes + 1] = node
|
||||
end
|
||||
end
|
||||
|
||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||
local count = worldedit.set(pos1, pos2, nodes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user