Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Circle for GPS controller
- --NAPTlME
- diameter,input = {...}
- circle = {4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,
- 42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
- 77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96}
- circle[4] = {2}
- circle[5] = {3}
- circle[6] = {4}
- circle[7] = {3,2}
- circle[8] = {4,2}
- circle[9] = {5,2}
- circle[10] = {4,3,1}
- circle[11] = {5,2,2}
- circle[12] = {4,3,2,1}
- circle[13] = {5,3,2,1}
- circle[14] = {6,2,2,2}
- circle[15] = {5,3,2,2,1}
- circle[16] = {6,3,2,2,1}
- circle[17] = {5,3,3,1,2,1}
- circle[18] = {6,3,2,2,2,1}
- circle[19] = {7,3,2,2,2,1}
- circle[20] = {6,3,3,2,1,2,1}
- circle[21] = {7,3,2,2,2,2,1}
- circle[22] = {6,4,2,2,2,2,1,1}
- circle[23] = {7,3,3,2,2,1,2,1}
- circle[24] = {6,4,2,2,2,2,2,1,1}
- circle[25] = {7,3,3,2,2,2,1,2,1}
- circle[26] = {8,3,3,2,2,2,1,2,1}
- circle[27] = {7,4,2,3,2,1,2,2,1,1}
- circle[28] = {8,3,3,2,2,2,2,1,2,1}
- circle[29] = {7,4,3,2,2,2,2,1,2,1,1}
- circle[30] = {8,4,2,3,2,2,1,2,2,1,1}
- circle[31] = {7,4,3,2,2,2,2,2,1,2,1,1}
- circle[32] = {8,4,3,2,2,2,2,2,1,2,1,1}
- circle[33] = {9,3,3,3,2,2,2,1,2,1,2,1}
- circle[34] = {8,4,3,2,3,2,1,2,2,1,2,1,1}
- circle[35] = {9,4,3,2,2,2,2,2,2,1,2,1,1}
- circle[36] = {8,4,3,3,2,2,2,2,1,2,1,2,1,1}
- circle[37] = {9,4,3,3,2,2,2,2,2,1,2,1,2,1,1}
- circle[38] = {8,4,3,3,2,2,2,2,2,1,2,1,2,1,1}
- circle[39] = {9,4,3,3,2,2,2,2,2,1,2,1,2,1,1}
- circle[40] = {8,5,3,2,3,2,2,2,1,2,2,1,2,1,1,1}
- circle[41] = {9,4,3,3,2,2,2,2,2,2,1,2,1,2,1,1}
- circle[42] = {10,4,3,3,2,2,2,2,2,2,1,2,1,2,1,1}
- circle[43] = {9,4,4,2,3,2,2,2,2,1,2,2,1,1,2,1,1}
- circle[44] = {10,4,3,3,2,3,2,2,1,2,2,1,2,1,2,1,1}
- circle[45] = {9,5,3,3,2,2,2,2,2,2,2,1,2,1,2,1,1,1}
- circle[46] = {10,4,3,3,3,2,2,2,2,2,1,2,1,2,1,2,1,1}
- circle[47] = {9,5,3,3,2,3,2,2,2,1,2,2,1,2,1,2,1,1,1}
- circle[48] = {10,4,4,2,3,2,2,2,2,2,2,1,2,2,1,1,2,1,1}
- circle[49] = {9,5,3,3,3,2,2,2,2,2,2,1,2,1,2,1,2,1,1,1}
- circle[50] = {10,5,3,3,2,3,2,2,2,2,1,2,2,1,2,1,2,1,1,1}
- circle[51] = {11,4,4,2,3,2,3,2,2,1,2,2,1,2,2,1,1,2,1,1}
- circle[52] = {10,5,3,3,3,2,2,2,2,2,2,2,1,2,1,2,1,2,1,1,1}
- circle[53] = {11,4,4,3,2,3,2,2,2,2,2,1,2,2,1,2,1,1,2,1,1}
- circle[54] = {10,5,3,3,3,2,3,2,2,2,1,2,2,1,2,1,2,1,2,1,1,1}
- circle[55] = {11,4,4,3,3,2,2,2,2,2,2,2,2,1,2,1,2,1,1,2,1,1}
- circle[56] = {10,5,4,3,2,3,2,2,2,2,2,2,1,2,2,1,2,1,1,2,1,1,1}
- circle[57] = {11,5,3,3,3,2,3,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,1}
- circle[58] = {10,5,4,3,3,2,2,2,3,1,2,2,2,2,1,2,1,2,1,1,2,1,1,1}
- circle[59] = {11,5,3,3,3,3,2,2,2,2,2,2,2,1,2,1,2,1,2,1,2,1,1,1}
- circle[60] = {10,5,4,3,3,2,3,2,2,2,2,2,1,2,2,1,2,1,2,1,1,2,1,1,1}
- circle[61] = {11,5,4,3,2,3,2,3,2,2,2,1,2,2,1,2,2,1,2,1,1,2,1,1,1}
- circle[62] = {12,5,3,3,3,3,2,2,2,2,2,2,2,2,1,2,1,2,1,2,1,2,1,1,1}
- circle[63] = {11,5,4,3,3,2,3,2,2,2,2,2,2,1,2,2,1,2,1,2,1,1,2,1,1,1}
- circle[64] = {12,5,3,4,2,3,2,3,2,2,2,2,1,2,2,1,2,2,1,1,2,1,2,1,1,1}
- circle[65] = {11,5,4,3,3,3,2,2,2,2,2,2,2,2,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[66] = {12,5,4,3,3,2,3,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,1,2,1,1,1}
- circle[67] = {11,5,4,3,3,3,2,3,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[68] = {12,5,4,3,3,3,2,2,2,3,2,1,2,2,2,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[69] = {11,6,3,4,3,2,3,2,2,2,2,2,2,2,2,1,2,2,1,2,1,1,2,1,2,1,1,1,1}
- circle[70] = {12,5,4,3,3,3,2,3,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[71] = {11,6,4,3,3,2,3,2,3,2,2,2,2,1,2,2,1,2,2,1,2,1,2,1,1,2,1,1,1,1}
- circle[72] = {12,5,4,3,3,3,3,2,2,2,2,2,2,2,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[73] = {13,5,4,3,3,3,2,3,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[74] = {12,5,4,4,3,2,3,2,3,2,2,2,2,2,1,2,2,1,2,2,1,2,1,1,2,1,1,2,1,1,1}
- circle[75] = {13,5,4,3,3,3,3,2,2,2,3,2,1,2,2,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,1}
- circle[76] = {12,6,4,3,3,3,2,3,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1,1}
- circle[77] = {13,5,4,4,3,2,3,2,3,2,2,2,2,2,2,1,2,2,1,2,2,1,2,1,1,2,1,1,2,1,1,1}
- circle[78] = {12,6,4,3,3,3,3,2,2,3,2,2,2,2,1,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,1,1}
- circle[79] = {13,5,4,4,3,3,2,3,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,1,2,1,1,2,1,1,1}
- circle[80] = {12,6,4,3,3,3,3,2,3,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,1,1}
- circle[81] = {13,5,5,3,3,3,3,2,2,3,2,2,2,2,2,1,2,2,2,1,2,1,2,1,2,1,2,1,1,1,2,1,1,1}
- circle[82] = {12,6,4,4,3,3,2,3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[83] = {13,6,4,3,3,3,3,2,3,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,1,1}
- circle[84] = {12,6,4,4,3,3,2,3,2,3,2,2,2,2,2,2,1,2,2,1,2,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[85] = {13,6,4,3,4,2,3,3,2,2,2,3,2,2,1,2,2,2,2,1,2,1,2,2,1,1,2,1,2,1,1,2,1,1,1,1}
- circle[86] = {14,5,4,4,3,3,3,2,3,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1}
- circle[87] = {13,6,4,4,3,3,2,3,2,3,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[88] = {14,5,5,3,3,3,3,3,2,2,3,2,2,2,2,2,1,2,2,2,1,2,1,2,1,2,1,2,1,2,1,1,1,2,1,1,1}
- circle[89] = {13,6,4,4,3,3,3,2,3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[90] = {14,6,4,3,4,3,2,3,2,3,2,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,1,1,2,1,2,1,1,2,1,1,1,1}
- circle[91] = {13,6,4,4,3,3,3,3,2,2,3,2,2,2,2,2,2,1,2,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[92] = {14,6,4,4,3,3,3,2,3,2,2,2,3,2,2,1,2,2,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[93] = {13,6,5,3,3,3,3,3,2,3,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,2,1,2,1,1,1,2,1,1,1,1}
- circle[94] = {14,6,4,4,3,3,3,2,3,2,3,2,2,2,2,2,2,2,1,2,2,1,2,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- circle[95] = {13,6,5,3,4,3,2,3,3,2,2,2,3,2,2,2,1,2,2,2,2,1,2,1,2,2,1,2,1,1,2,1,2,1,1,1,2,1,1,1,1}
- circle[96] = {14,6,4,4,3,3,3,3,2,3,2,2,2,2,2,2,2,2,2,2,1,2,2,1,2,1,2,1,2,1,2,1,1,2,1,1,2,1,1,1,1}
- function invTotal()
- inv = 0
- for i = 1,16 do
- indInv = turtle.getItemCount(i)
- inv = inv+indInv
- end
- local total = 1
- for k = 1,#circle[diameter] do
- total = total+circle[diameter][k]
- end
- maximum = math.floor(inv/total)
- end
- function isOdd(n)
- if n%2==1 then
- return true
- else
- return false
- end
- end
- function up()
- while not turtle.up() do
- turtle.digUp()
- end
- end
- function forward(num)
- for i = 1,num do
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- end
- end
- end
- function placeDown()
- for j = 1,16 do
- turtle.select(j)
- if turtle.compareTo(16) then
- break
- end
- end
- turtle.digDown()
- turtle.placeDown()
- end
- function placeMove(num)
- for k = 1,num do
- placeDown()
- if k ~= num then
- forward(1)
- end
- end
- turtle.turnRight()
- forward(1)
- turtle.turnLeft()
- end
- function cylinder(height)
- for i = 1,tonumber(height) do
- for j = 1,#circle[diameter] do
- placeMove(circle[diameter][j])
- end
- placeDown()
- forward(1)
- turtle.turnRight()
- up()
- end
- end
- function main()
- radius = math.floor(diameter/2)
- invTotal()
- if maximum == 0 then
- repeat
- rednet.broadcast('empty')
- read()
- invTotal()
- until maximum>0
- rednet.broadcast('Ready')
- end
- id,msg = rednet.receive(5)
- if msg then
- repeat
- id,msg = rednet.receive(3)
- until msg = 'Ready'
- id,msg = rednet.receive(5)
- end
- if diameter > 15 then
- forward(radius-8)
- turtle.turnRight()
- else
- turtle.turnRight()
- turtle.turnRight()
- forward(8-radius)
- turtle.turnLeft()
- end
- forward(8-math.ceil(circle[diameter][1]/2))
- cylinder(input)
- turtle.turnLeft()
- turtle.turnLeft()
- forward(8-math.ceil(circle[diameter][1]/2))
- if diameter>15 then
- turtle.turnLeft()
- forward(radius-8)
- turtle.turnRight()
- turtle.turnRight()
- else
- turtle.turnRight()
- forward(8-radius)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement