Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell = require("shell")
- comp = require("component")
- w = comp.debug.getWorld()
- a = shell.parse(...)
- function quit(msg)
- print(msg)
- a = 0 / 0
- end
- requirements = (#a > 6 and #a % 2 == 0)
- if not requirements then quit("Usage: <x> <y> <z> <x> <y> <z> <id1> <data1> [<id2> <data2>...]") end
- x1 = tonumber(a[1])
- y1 = tonumber(a[2])
- z1 = tonumber(a[3])
- x2 = tonumber(a[4])
- y2 = tonumber(a[5])
- z2 = tonumber(a[6])
- if not (x1 and y1 and z1 and x2 and y2 and z2) then quit("All coords must be numeric") end
- blocks = {}
- for b = 7, #a, 2 do
- block = {id = tonumber(a[b]), data = tonumber(a[b+1])}
- if not block.data then block.data = 0 end
- if not block.id then quit("All numbers required") end
- blocks[#blocks+1] = block
- print("{id=" .. block.id .. ", data=" .. block.data .. "}")
- end
- if x2 < x1 then x1, x2 = x2, x1 print(x1 .. " " .. x2) end
- if y2 < y1 then y1, y2 = y2, y1 print(y1 .. " " .. y2) end
- if z2 < z1 then z1, z2 = z2, z1 print(z1 .. " " .. z2) end
- blockN = -1
- for x = x1, x2 do
- for z = z1, z2 do
- for y = y1, y2 do
- os.sleep(0)
- blockN = (blockN + 1) % #blocks
- block = blocks[blockN + 1]
- w.setBlock(x, y, z, block.id, block.data)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement