Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --ComputerCraft/CommandComputer/ConstructionResizer
- local function findBlock(x, y, z)
- for i = 0, 200 do
- st, block = commands.exec('testforblock ~'..x..' ~'..y..' ~'..z..' '..i)
- if string.sub(block[1], 1, 12) == 'Successfully' then
- return i
- end
- end
- end
- local function builder(size, name, cx, cy, cz)
- for x = 1, size do
- for y = 1, size do
- for z = 1, size do
- commands.exec('setblock ~'..x-size+(size*cx)..' ~'..y-size+(size*cy)..' ~'..z-1+(size*cz)..' '..name)
- end
- end
- end
- end
- local function resize(region, scale)
- for x = 1, region do
- for y = 1, region do
- for z = 1, region do
- builder(scale, findBlock(x, y, z), x, y, 0-z)
- end
- end
- end
- end
- function printUsage()
- print('Usage: resize <size of scanning region> <new size of blocks>')
- return
- end
- local tArgs = {...}
- if #tArgs == 2 then
- resize(tArgs[1], tArgs[2])
- else printUsage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement