Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --local co = require("coroutine")
- local world = require("component").debug.getWorld()
- local orig_x, orig_y, orig_z, height, width, height2, block_id, block_meta, filled = ...
- local a2, b2, fa2, fb2, x, y, zigma
- orig_x = tonumber(orig_x)
- orig_y = tonumber(orig_y)
- orig_z = tonumber(orig_z)
- height = tonumber(height)
- height2 = tonumber(height2)
- width = tonumber(width)
- block_id = tonumber(block_id)
- block_meta = tonumber(block_meta)
- filled = tonumber(filled)
- function setpixel(x, y, z)
- world.setBlock(x, y, z, block_id, block_meta)
- end
- function setline(x1, y1, z1, x2, y2, z2)
- world.setBlocks(x1, y1, z1, x2, y2, z2, block_id, block_meta)
- end
- a2 = width * width
- b2 = height * height
- fa2 = 4 * a2
- fb2 = 4 * b2
- z = height2 - 1
- x = 0
- y = height
- sigma = 2 * b2+a2*(1-2*height)
- print(z, height)
- -- first half
- while b2*x <= a2*y do
- -- setline(orig_x + x, orig_y, orig_z + y, orig_x - x, orig_y, orig_z - y)
- if (filled == 1) then
- setline(orig_x + x, orig_y+z, orig_z - y, orig_x + x, orig_y+z, orig_z + y)
- setline(orig_x - x, orig_y+z, orig_z - y, orig_x - x, orig_y+z, orig_z + y)
- else
- setline(orig_x + x, orig_y, orig_z + y, orig_x + x, orig_y+z, orig_z + y)
- setline(orig_x + x, orig_y, orig_z - y, orig_x + x, orig_y+z, orig_z - y)
- setline(orig_x - x, orig_y, orig_z + y, orig_x - x, orig_y+z, orig_z + y)
- setline(orig_x - x, orig_y, orig_z - y, orig_x - x, orig_y+z, orig_z - y)
- end
- if (sigma >= 0) then
- sigma = sigma + (fa2 * (1-y))
- y = y-1
- end
- sigma = sigma + (b2 * ((4 * x) + 6))
- x = x + 1
- end
- x = width
- y = 0
- sigma = 2*a2+b2*(1-2*width)
- while (a2*y <= b2*x) do
- if (filled == 1) then
- setline(orig_x + x, orig_y+z, orig_z + y, orig_x - x, orig_y+z, orig_z + y)
- setline(orig_x + x, orig_y+z, orig_z - y, orig_x - x, orig_y+z, orig_z - y)
- else
- -- setline(orig_x + x, orig_y+z, orig_z + y, orig_x - x, orig_y+z, orig_z + y)
- setline (orig_x + x, orig_y+z, orig_z + y, orig_x + x, orig_y, orig_z + y)
- setline (orig_x + x, orig_y+z, orig_z - y, orig_x + x, orig_y, orig_z - y)
- -- setline(orig_x + x, orig_y, orig_z - y, orig_x - x, orig_y, orig_z - y)
- setline (orig_x - x, orig_y+z, orig_z + y, orig_x - x, orig_y, orig_z + y)
- setline (orig_x - x, orig_y+z, orig_z - y, orig_x - x, orig_y, orig_z - y)
- end
- if (sigma >= 0) then
- sigma = sigma + (fb2 * (1 - x))
- x = x - 1
- end
- sigma = sigma + (a2 * ((4 * y) + 6))
- y = y + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement