Guest User

Untitled

a guest
Nov 16th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. local B_x = 0
  2. local B_z = 0
  3. local B_y = 0
  4.  
  5. local orient = 0
  6.  
  7. local depth = 3
  8. local width = 2
  9.  
  10. function dig(f)
  11. print("starting")
  12.  for i=1,depth do
  13.  turtle.dig()
  14.  turtle.forward()
  15.  turtle.digUp()
  16.  turtle.digDown()
  17.  B_x=B_x+(f*1)
  18.  end
  19.  
  20.  if (orient==0) do
  21.   turnright()
  22.  else if(orient==2) do
  23.   turnleft()
  24.  end
  25.  
  26. end
  27.  
  28. function turnright()
  29.  
  30.  if width >1 then
  31.   turtle.turnRight()
  32.   turtle.dig()
  33.   turtle.forward()
  34.   turtle.turnRight()
  35.   B_z=B_z+1
  36.   width = width -1
  37.   orient = orient +2
  38.   dig(-1)
  39.  else
  40.   comeback()
  41.  end
  42.  
  43. end
  44.  
  45. function comeback()
  46. print("returning")
  47.  
  48.  while orient >4 do
  49.   orient = orient -4
  50.  end
  51.  
  52.  
  53.  for i=1, B_x do
  54.   turtle.back()
  55.  end
  56.  
  57.  if orient == 2 do
  58.   turtle.turnRight()
  59.   orient = 3
  60.  end
  61.  
  62.  for i=1 B_y do
  63.   turtle.forward()
  64.  end
  65.  
  66.   turtle.drop()
  67. end
  68.  
  69.  
  70. dig(1)
  71. comeback()
Add Comment
Please, Sign In to add comment