25
25
26
26
-- sets a region defined by positions `pos1` and `pos2` to `nodename`, returning the number of nodes filled
27
27
worldedit .set = function (pos1 , pos2 , nodenames )
28
- local oneNode
29
- if type (nodenames ) == ' string' then
30
- oneNode = true
31
- else
32
- oneNode = false
33
- end
28
+ if type (nodenames ) == " string" then
29
+ nodenames = {nodenames }
30
+ end
34
31
35
32
local pos1 , pos2 = worldedit .sort_pos (pos1 , pos2 )
36
33
@@ -48,10 +45,10 @@ worldedit.set = function(pos1, pos2, nodenames)
48
45
49
46
-- fill selected area with node
50
47
local node_ids = {}
51
- for i ,v in ipairs (nodenames ) do
52
- node_ids [i ] = minetest .get_content_id (nodenames [i ])
53
- end
54
- if oneNode then -- only one type of node
48
+ for i ,v in ipairs (nodenames ) do
49
+ node_ids [i ] = minetest .get_content_id (nodenames [i ])
50
+ end
51
+ if # node_ids then -- only one type of node
Has conversations. Original line has conversations. 55
52
local id = node_ids
56
53
for i in area :iterp (pos1 , pos2 ) do nodes [i ] = id end -- fill area with node
57
54
else -- several types of nodes specified
@@ -420,19 +417,19 @@ worldedit.stack = function(pos1, pos2, axis, count)
420
417
if count < 0 then
421
418
count = - count
422
419
length = - length
423
- end
424
- local amount = 0
425
- local copy = worldedit .copy
426
- local i = 1
427
- function nextone ()
428
- if i <= count then
429
- i = i + 1
430
- amount = amount + length
431
- copy (pos1 , pos2 , axis , amount )
432
- minetest .after (0 ,nextone )
433
- end
434
- end
435
- nextone ()
420
+ end
421
+ local amount = 0
422
+ local copy = worldedit .copy
423
+ local i = 1
424
+ function nextone ()
425
+ if i <= count then
426
+ i = i + 1
427
+ amount = amount + length
428
+ copy (pos1 , pos2 , axis , amount )
429
+ minetest .after (0 , nextone )
430
+ end
431
+ end
432
+ nextone ()
436
433
return worldedit .volume (pos1 , pos2 ) * count
437
434
end
438
435