Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- height = 16
- width = 14
- pos = {}
- pos.x = 0
- pos.y = 1
- endp = {}
- endp.x = width
- move = "+"
- if (width % 2 == 0) then
- endp.y = 1
- direction = "toward"
- else
- endp.y = height
- direction = "away"
- end
- function restock (turtle)
- end
- function forwardCheck (turtle, pos, move)
- turtle.forward()
- if (move == "+") then
- pos.y = pos.y + 1
- else
- pos.y = pos.y - 1
- end
- crop = turtle.inspectDown()
- if (crop. --wheat-- and crop. --stage--) then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- function leftTurnCheck (turtle, pos, move)
- turtle.turnLeft()
- turtle.forward()
- pos.x = pos.x + 1
- turtle.turnLeft()
- move = "-"
- crop = turtle.inspectDown()
- if (crop. --wheat-- and crop. --stage--) then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- function rightTurnCheck (turtle, pos, move)
- turtle.turnRight()
- turtle.forward()
- pos.x = pos.x + 1
- turtle.turnRight()
- move = "+"
- local suc, crop = turtle.inspectDown()
- if (crop.name == 'minecraft:wheat' and crop.metadata == 7 then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- while true do
- print(pos.x, pos.y)
- if (pos.x == endp.x and pos.y == endp.y) then
- if (direction == "away") then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- while (pos.x > 1) do
- turtle.forward()
- pos.x = pos.x - 1
- end
- turtle.turnLeft()
- while (pos.y > 1) do
- turtle.forward()
- pos.x = pos.x - 1
- end
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- restock(turtle)
- sleep(15 * 60)
- else
- if (pos.x == 0 and pos.y == 1) then
- forwardCheck(turtle, pos, move)
- forwardCheck(turtle, pos, move)
- else if (pos.y == 1) then
- rightTurnCheck(turtle, pos, move)
- else if (pos.y == height) then
- leftTurnCheck(turtle, pos, move)
- else
- forwardCheck(turtle, pos, move)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement