Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nx = 0
- local ny = 0
- local a = 0
- local cx = 0
- local cy = 0
- local dNeed = 0
- function checkFuel()
- turtle.select(1)
- while turtle.getFuelLevel() < 100 do
- turtle.refuel(1)
- end
- turtle.select(slotNum)
- end
- local function newPlot()
- nx = math.cos((a*(3.14/180))*r)
- if nx >= 0 then
- nx = math.floor(nx+0.5)
- else
- nx=math.ceil(nx-0.5)
- end
- ny = math.sin((a*(3.14/180))*r)
- if ny >= 0 then
- ny=math.floor(ny + 0.5)
- else
- ny=math.ceil(ny - 0.5)
- end
- end
- local function dRection()
- while dNeed ~= dIs do
- turtle.turnLeft()
- dIs = dIs + 1
- if dIs > 4 then
- dIs = 1
- end
- print("dIs = "..dIs)
- print("dNeed = "..dNeed)
- print("tempX = "..tempX)
- print("tempY = "..tempY)
- print("cx,cy = "..cx..","..cy)
- print("\n")
- end
- end
- local function xMovement()
- tempX = nx-cx
- if tempX == 1 then
- dNeed = 4
- elseif tempX == -1 then
- dNeed = 2
- end
- end
- local function yMovement()
- tempY = ny-cy
- if tempY == 1 then
- dNeed = 1
- elseif tempY == -1 then
- dNeed = 3
- end
- end
- local function forwardCheck()
- while not turtle.forward() do
- os.sleep(1)
- end
- end
- local function placeBlock()
- if turtle.getItemCount(slotNum) > 0 then
- turtle.placeDown()
- else
- if slotNum <= 15 then
- slotNum = slotNum + 1
- else
- term.clear()
- term.setCursorPos(1,1)
- print ("Out of blocks please reload then press any key to continue.")
- os.pullEvent()
- slotNum = 2
- end
- turtle.select(slotNum)
- turtle.placeDown()
- end
- end
- local function startUp()
- term.clear()
- term.setCursorPos(1,1)
- print("Place fuel in slot 1 and fill the rest of the slots with your blocks.")
- print("Make sure the area is clear of obsticals cause they will screw me up.")
- print ("What is the diameter of your circle?")
- d = tonumber(read())
- print("Hi-Ho Hi-Ho its off to work I go.")
- r = d/2
- slotNum = 2
- end
- startUp()
- checkFuel()
- turtle.up()
- for t=1,r do
- turtle.forward()
- end
- placeBlock()
- dIs = 4
- cx = r
- cy = 0
- for a = 1,360 do
- newPlot()
- xMovement()
- if tempX ~= 0 then
- dRection()
- forwardCheck()
- placeBlock()
- end
- yMovement()
- if tempY ~= 0 then
- dRection()
- forwardCheck()
- placeBlock()
- end
- checkFuel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement