Coding style updates.

This commit is contained in:
Uberi 2014-07-12 16:35:59 -04:00
parent 420655bd94
commit 58d7a7134e
1 changed files with 20 additions and 23 deletions

View File

@ -25,11 +25,8 @@ end
--sets a region defined by positions `pos1` and `pos2` to `nodename`, returning the number of nodes filled --sets a region defined by positions `pos1` and `pos2` to `nodename`, returning the number of nodes filled
worldedit.set = function(pos1, pos2, nodenames) worldedit.set = function(pos1, pos2, nodenames)
local oneNode if type(nodenames) == "string" then
if type(nodenames) == 'string' then nodenames = {nodenames}
oneNode = true
else
oneNode = false
end end
local pos1, pos2 = worldedit.sort_pos(pos1, pos2) local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
@ -51,7 +48,7 @@ worldedit.set = function(pos1, pos2, nodenames)
for i,v in ipairs(nodenames) do for i,v in ipairs(nodenames) do
node_ids[i] = minetest.get_content_id(nodenames[i]) node_ids[i] = minetest.get_content_id(nodenames[i])
end end
if oneNode then --only one type of node if #node_ids then --only one type of node
local id = node_ids local id = node_ids
for i in area:iterp(pos1, pos2) do nodes[i] = id end --fill area with node for i in area:iterp(pos1, pos2) do nodes[i] = id end --fill area with node
else --several types of nodes specified else --several types of nodes specified
@ -429,7 +426,7 @@ worldedit.stack = function(pos1, pos2, axis, count)
i = i + 1 i = i + 1
amount = amount + length amount = amount + length
copy(pos1, pos2, axis, amount) copy(pos1, pos2, axis, amount)
minetest.after(0,nextone) minetest.after(0, nextone)
end end
end end
nextone() nextone()