Fix issues form code review

This commit is contained in:
Starbeamrainbowlabs 2018-10-20 12:06:46 +01:00
parent bb0b2d2f71
commit 41aceb83aa
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
2 changed files with 2 additions and 4 deletions

View File

@ -123,7 +123,7 @@ Set the param2 value of all nodes in the current WorldEdit region to `<param2>`.
### `//mix <node1> [<count1>] <node2> [<count2>]...`
Fill the current WorldEdit region with a random mix of `<node1>`, `<node2>`, `...`. Weightings can be optionally spsecified via a number after a node name.
Fill the current WorldEdit region with a random mix of `<node1>`, `<node2>`, `...`. Weightings can be optionally specified via a number after a node name.
//mix air
//mix cactus stone glass sandstone

View File

@ -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