diff --git a/ChatCommands.md b/ChatCommands.md index 1b290f4..9672536 100644 --- a/ChatCommands.md +++ b/ChatCommands.md @@ -123,7 +123,7 @@ Set the param2 value of all nodes in the current WorldEdit region to ``. ### `//mix [] []...` -Fill the current WorldEdit region with a random mix of ``, ``, `...`. Weightings can be optionally spsecified via a number after a node name. +Fill the current WorldEdit region with a random mix of ``, ``, `...`. Weightings can be optionally specified via a number after a node name. //mix air //mix cactus stone glass sandstone diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 84e9abc..46ff47d 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -431,11 +431,9 @@ minetest.register_chatcommand("/mix", { func = safe_region(function(name, param) local nodes = {} for nodename in param:gmatch("[^%s]+") do - if tonumber(nodename) ~= nil then + if tonumber(nodename) ~= nil and #nodes > 0 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