diff options
| author | Uberi <azhang9@gmail.com> | 2014-07-12 16:35:59 -0400 | 
|---|---|---|
| committer | Uberi <azhang9@gmail.com> | 2014-07-12 16:35:59 -0400 | 
| commit | 58d7a7134e3884999b135e2dafdf0171abf54f5a (patch) | |
| tree | 4a80404c4f10cd6b97605af4e744e636500af293 /worldedit | |
| parent | 420655bd945d43a38ced9062b40070dded12f62d (diff) | |
Coding style updates.
Diffstat (limited to 'worldedit')
| -rw-r--r-- | worldedit/manipulations.lua | 43 | 
1 files changed, 20 insertions, 23 deletions
| diff --git a/worldedit/manipulations.lua b/worldedit/manipulations.lua index 2fa9a1e..86ae565 100644 --- a/worldedit/manipulations.lua +++ b/worldedit/manipulations.lua @@ -25,12 +25,9 @@ end  --sets a region defined by positions `pos1` and `pos2` to `nodename`, returning the number of nodes filled
  worldedit.set = function(pos1, pos2, nodenames)
 -    local oneNode
 -    if type(nodenames) == 'string' then
 -        oneNode = true
 -    else
 -        oneNode = false
 -    end
 +	if type(nodenames) == "string" then
 +		nodenames = {nodenames}
 +	end
  	local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
 @@ -48,10 +45,10 @@ worldedit.set = function(pos1, pos2, nodenames)  	--fill selected area with node
  	local node_ids = {}
 -    for i,v in ipairs(nodenames) do
 -        node_ids[i] = minetest.get_content_id(nodenames[i])
 -    end
 -	if oneNode then --only one type of node
 +	for i,v in ipairs(nodenames) do
 +		node_ids[i] = minetest.get_content_id(nodenames[i])
 +	end
 +	if #node_ids then --only one type of node
  		local id = node_ids
  		for i in area:iterp(pos1, pos2) do nodes[i] = id end --fill area with node
  	else --several types of nodes specified
 @@ -420,19 +417,19 @@ worldedit.stack = function(pos1, pos2, axis, count)  	if count < 0 then
  		count = -count
  		length = -length
 -    end
 -    local amount = 0
 -    local copy = worldedit.copy
 -    local i = 1
 -    function nextone() 
 -        if i <= count then
 -            i = i + 1
 -            amount = amount + length
 -            copy(pos1, pos2, axis, amount)
 -            minetest.after(0,nextone)
 -        end
 -    end
 -    nextone()
 +	end
 +	local amount = 0
 +	local copy = worldedit.copy
 +	local i = 1
 +	function nextone()
 +		if i <= count then
 +			i = i + 1
 +			amount = amount + length
 +			copy(pos1, pos2, axis, amount)
 +			minetest.after(0, nextone)
 +		end
 +	end
 +	nextone()
  	return worldedit.volume(pos1, pos2) * count
  end
 | 
