SHARE
TWEET

Untitled

xmann110 Feb 14th, 2020 (edited) 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function refuel()
  2.     if turtle.getFuelLevel() < 10 then
  3.         turtle.select(1)
  4.         turtle.refuel(1)
  5.     end
  6. end
  7.  
  8. function squareMine(size)
  9.     for x=1, size do
  10.         for y=1, size-1 do
  11.             refuel()
  12.  
  13.             turtle.dig()
  14.             forward()
  15.         end
  16.  
  17.         if not (x == size) then
  18.             if (x % 2 == 0) then
  19.                 turtle.turnRight()
  20.                 turtle.dig()
  21.                 forward()
  22.                 turtle.turnRight()
  23.             else
  24.                 turtle.turnLeft()
  25.                 turtle.dig()
  26.                 forward()
  27.                 turtle.turnLeft()
  28.             end
  29.         end
  30.     end
  31. end
  32.  
  33. function forward()
  34.     while not turtle.forward() do
  35.         turtle.dig()
  36.         turtle.attack()
  37.         print("Forward movement obstructed")
  38.     end
  39. end
  40.  
  41. function down()
  42.     while not turtle.down() do
  43.         turtle.digDown()
  44.         print("Down movement obstructed")
  45.     end
  46. end
  47.  
  48. args = {...}
  49. triangleSize = args[1]
  50.  
  51. for v=1, triangleSize-1 do
  52.     size = ((triangleSize - v) * 2) + 1
  53.     squareMine(size)
  54.     refuel()
  55.     if size % 2 == 0 then
  56.         turtle.turnLeft()
  57.         forward()
  58.         turtle.turnLeft()
  59.         forward()
  60.         turtle.digDown()
  61.         down()
  62.     else
  63.         turtle.turnRight()
  64.         forward()
  65.         turtle.turnRight()
  66.         forward()
  67.         turtle.digDown()
  68.         down()
  69.     end
  70. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top