Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- leafDecayTime = 10
- function forward(dist)
- refuelTo(dist)
- for i = 1, dist do
- while turtle.forward() == false do
- if turtle.dig() == false then
- turtle.attack()
- end
- end
- end
- end
- function up(dist)
- refuelTo(dist)
- for i = 1, dist do
- while turtle.up() == false do
- if turtle.digUp() == false then
- turtle.attackUp()
- end
- end
- end
- end
- function down(dist)
- refuelTo(dist)
- for i = 1, dist do
- while turtle.down() == false do
- if turtle.digDown() == false then
- turtle.attackDown()
- end
- end
- end
- end
- function refuelTo(level)
- turtle.select(1)
- while turtle.getFuelLevel() < level do
- if turtle.refuel(1) == false then
- print("No Fuel! Add more to continue.")
- while turtle.refuel(1) == false do
- os.sleep(5)
- end
- end
- end
- end
- function digForward(dist)
- for i = 1, dist do
- forward(1)
- turtle.digUp()
- turtle.digDown()
- end
- end
- function buildFarm()
- placeSetupArea()
- forward(1)
- turtle.turnLeft()
- forward(4)
- turtle.turnRight()
- down(2)
- turtle.digDown()
- digFarm()
- turtle.turnRight()
- forward(4)
- turtle.turnRight()
- forward(4)
- down(1)
- placeWater()
- turtle.turnRight()
- forward(4)
- turtle.turnRight()
- forward(4)
- placeDirt()
- forward(4)
- up(2)
- forward(1)
- dropExtraItems()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function drawFarmTop()
- print("############")
- print("#W W#")
- print("# #")
- print("# #")
- print("# #")
- print("# DD #")
- print("# DD #")
- print("# #")
- print("# #")
- print("# #")
- print("#W W#")
- print("####CTC#####")
- print("#####C######")
- end
- function drawFarmSide()
- print(" #### ")
- print(" ###### ")
- print(" ######## ")
- print(" ######## ")
- print(" || ")
- print(" || ")
- print(" C| ")
- print(" CTC ")
- print("# CD #")
- print("# #")
- print("#W W#")
- print("############")
- end
- function placeSetupArea()
- turtle.select(2)
- turtle.digDown()
- turtle.placeDown()
- turtle.digUp()
- turtle.placeUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.place()
- turtle.turnRight()
- turtle.dig()
- turtle.select(3)
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- end
- function digFarm()
- for i = 1, 10 do
- digForward(9)
- if i == 10 then
- break
- elseif i % 2 == 1 then
- turtle.turnRight()
- digForward(1)
- turtle.turnRight()
- else
- turtle.turnLeft()
- digForward(1)
- turtle.turnLeft()
- end
- end
- end
- function placeWater()
- turtle.digDown()
- forward(1)
- turtle.digDown()
- turtle.select(5)
- turtle.placeDown()
- turtle.turnLeft()
- forward(1)
- turtle.digDown()
- turtle.turnLeft()
- forward(1)
- turtle.digDown()
- turtle.select(6)
- turtle.placeDown()
- os.sleep(1)
- turtle.select(6)
- turtle.placeDown()
- os.sleep(1)
- turtle.select(5)
- turtle.placeDown()
- up(1)
- forward(4)
- turtle.turnRight()
- forward(4)
- turtle.select(5)
- turtle.placeDown()
- turtle.select(6)
- turtle.turnRight()
- forward(9)
- turtle.select(6)
- turtle.placeDown()
- turtle.turnRight()
- forward(5)
- turtle.turnRight()
- forward(4)
- down(1)
- turtle.turnLeft()
- turtle.turnLeft()
- os.sleep(1)
- turtle.select(6)
- turtle.placeDown()
- os.sleep(1)
- turtle.select(5)
- turtle.placeDown()
- up(1)
- forward(4)
- turtle.turnRight()
- forward(4)
- turtle.select(5)
- turtle.placeDown()
- turtle.select(6)
- turtle.turnRight()
- forward(9)
- turtle.select(6)
- turtle.placeDown()
- end
- function placeDirt()
- turtle.select(4)
- turtle.placeUp()
- forward(1)
- turtle.select(4)
- turtle.placeUp()
- turtle.turnLeft()
- forward(1)
- turtle.turnLeft()
- turtle.select(4)
- turtle.placeUp()
- forward(1)
- turtle.select(4)
- turtle.placeUp()
- end
- function dropExtraItems()
- for i = 2, 16 do
- turtle.select(i)
- turtle.drop()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement