Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fuel=16
- blocksused = 0
- length = 8
- clusters = 3
- hight = 3
- spacex=4
- spacey=3 --for farm this would be 3 but its impo
- function checkFuel()
- if turtle.getFuelLevel() < 400 then
- turtle.select(Fuel)
- turtle.refuel(5)
- end
- end
- function up(i) --turtle.up() 3 times, i times
- for j=1,i,1 do
- for k=1,spacey,1 do
- turtle.up()
- end
- end
- end
- function down(i)
- for j=1,i,1 do
- for k=1,spacey,1 do
- turtle.down()
- end
- end
- end
- function left(i)
- turtle.turnLeft()
- for j=1,i,1 do
- for k=1,spacex,1 do
- turtle.forward()
- end
- end
- turtle.turnRight()
- end
- function right(i)
- turtle.turnRight()
- for j=1,i,1 do
- for k=1,spacex,1 do
- turtle.forward()
- end
- end
- turtle.turnLeft()
- end
- function placeDirt(down)
- checkFuel()
- if blocksused/64 == 15 then --this checks if empty
- print("Refill me with dirt then press enter")
- temp = io.read()
- blocksused = 0
- end
- turtle.select((blocksused/64)+1)
- if down then turtle.placeDown()
- else turtle.place() end
- blocksused = blocksused+1
- end
- function rotate(i)
- for j=1,i,1 do
- turtle.turnLeft()
- end
- end
- function buildSegment()
- if not turtle.detectDown() then
- placeDirt(true)
- end
- rotate(1)
- placeDirt()
- rotate(2)
- placeDirt()
- rotate(1)
- end
- function buildLine()
- rotate(2)
- placeDirt() --make a stopper
- rotate(2)
- turtle.forward() --prepare to start
- for i=1,length,1 do
- buildSegment()
- if i==length then
- placeDirt()
- turtle.up()
- placeDirt()
- turtle.down() --stopper for farm
- else turtle.forward() end
- end
- rotate(2)
- while not turtle.detect() do
- turtle.forward()
- end
- turtle.up()
- placeDirt()
- turtle.down()
- rotate(2)
- placeDirt()
- end
- function firstLayer()
- rotate(2)
- placeDirt()
- rotate(2)
- for i=1,length,1 do
- turtle.forward()
- turtle.digDown()
- end
- turtle.place()
- rotate(2)
- while not turtle.detect() do
- turtle.forward()
- end
- rotate(2)
- end
- function buildCluster()
- for i=1,hight-1,1 do
- buildLine()
- if i==hight-1 then down(hight-2)
- else up(1) end
- end
- end
- --SETUP
- print("how many clusters?")
- print("small ~2-3, medium ~4-5,large ~6-7")
- clusters = tonumber(io.read())
- print("how long should the farm be?")
- length = tonumber(io.read())
- print("how tall?")
- hight = tonumber(io.read())
- print("fill all slots with dirt except slot 16\n fill slot 16 with fuel")
- print("press enter to build")
- temp = io.read()
- --CODE STARTS HERE
- for i=1,clusters,1 do
- firstLayer()
- right(1)
- end
- left(clusters)
- up(1)
- turtle.down()
- for k=1,clusters,1 do
- buildCluster()
- if k==clusters then left(clusters-1)
- else right(1) end
- end
- down(1)
- print("now add water and hoe the dirt and i'll be ready to farm")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement