Advertisement
Guest User

island

a guest
Aug 28th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. a = 0
  2.  
  3. function detect()
  4.  if turtle.detect() == true then
  5.   turtle.turnRight()
  6.   if turtle.detect() == true then
  7.    turtle.turnRight()
  8.    turtle.dig()
  9.    turtle.forward()
  10.    turtle.turnRight()
  11.    turtle.turnRight()
  12.    turtle.place()
  13.    turtle.turnRight()
  14.   end
  15.   turtle.forward()
  16.   turtle.turnLeft()
  17.   turtle.turnLeft()
  18.   turtle.place()
  19.   turtle.turnRight()
  20.   if turtle.detect() == true then
  21.    turtle.turnRight()
  22.   end
  23.  end
  24. end
  25.  
  26. function detectIsland()
  27.  if turtle.detect() == false then
  28.   turtle.forward()
  29.   a = a + 1
  30.   if turtle.detect() == true then
  31.    turtle.turnRight()
  32.    if turtle.detect() == true then
  33.     turtle.turnLeft()
  34.     turtle.back()
  35.     a = a - 1
  36.     turtle.place()
  37.     turtle.turnRight()
  38.    else
  39.     turtle.turnRight()
  40.     turtle.place()
  41.     turtle.turnLeft()
  42.     turtle.forward()
  43.     a = a + 1
  44.     turtle.turnLeft()
  45.     turtle.turnLeft()
  46.     turtle.place()
  47.     turtle.turnRight()
  48.     turtle.turnRight()
  49.    end
  50.   else
  51.    turtle.turnRight()
  52.    if turtle.detect() == true then
  53.     turtle.turnLeft()
  54.     while turtle.detect() == false do
  55.      turtle.forward()
  56.      a = a + 1
  57.     end
  58.    end
  59.    turtle.turnLeft()
  60.    
  61.    turtle.turnRight()
  62.    if turtle.detect() == true then
  63.     turtle.turnLeft()
  64.     for i = 1,a do
  65.      turtle.back()
  66.      turtle.place()
  67.     end
  68.     turtle.turnRight()
  69.    end
  70.    turtle.turnLeft()
  71.   end
  72.   turtle.turnLeft()
  73.   turtle.turnLeft()
  74.   turtle.place()
  75.   turtle.turnRight()
  76.   turtle.turnRight()
  77.  end
  78. end
  79.  
  80. if turtle.getItemCount(1) ~= 0 then
  81.  while turtle.getItemCount(1) ~= 0 do
  82.   detect()
  83.   detect()
  84.   turtle.turnLeft()
  85.   detectIsland()
  86.   if turtle.detect() == true then
  87.    turtle.turnLeft()
  88.    turtle.back()
  89.    turtle.place()
  90.    turtle.turnRight()
  91.    turtle.turnRight()
  92.   end
  93.  end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement