daily pastebin goal
52%
SHARE
TWEET

Untitled

Mister_2 Jan 12th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local width = 3;
  2. local depth = 5;
  3. local refuelSlot = 1;
  4. local staircaseSlot = 2;
  5. local right = true;
  6.  
  7. function checkFuel()
  8.     if turtle.getFuelLevel() > 0 then
  9.         return;
  10.     end
  11.  
  12.     print("Refuelling!");
  13.     turtle.select(refuelSlot);
  14.     if turtle.getItemCount() == 0 then
  15.         print("Please refill fuel!");
  16.         while turtle.getItemCount() == 0 do end;
  17.     end
  18.  
  19.     turtle.refuel(1);
  20. end
  21.  
  22. function mineForward(count)
  23.     for i = 1, count do
  24.         while turtle.detect() do
  25.             turtle.dig();
  26.         end
  27.  
  28.         checkFuel();
  29.         turtle.forward();
  30.     end
  31. end
  32.  
  33. function turn()
  34.     if right then
  35.         turtle.turnRight();
  36.     else
  37.         turtle.turnLeft();
  38.     end
  39.  
  40.     while turtle.detect() do
  41.         turtle.dig();
  42.     end
  43.  
  44.     checkFuel();
  45.     turtle.forward();
  46.  
  47.     if right then
  48.         turtle.turnRight();
  49.     else
  50.         turtle.turnLeft();
  51.     end
  52.  
  53.     right = not right;
  54. end
  55.  
  56. function mineLevel()
  57.     for i = 1, width do
  58.         mineForward(depth - 1);
  59.         if i == width then break end;
  60.  
  61.         turn();
  62.     end
  63. end
  64.  
  65. function placeStairs()
  66.     if not ((width % 2) == 0) then
  67.         turtle.turnRight();
  68.         turtle.turnRight();
  69.  
  70.         for i = 1, (depth - 2) do
  71.             checkFuel();
  72.             turtle.forward();
  73.         end
  74.     else
  75.         checkFuel();
  76.         turtle.back();
  77.     end
  78.  
  79.     for i = 1, width do
  80.         turtle.select(staircaseSlot);
  81.         if turtle.getItemCount() <= 1 then
  82.             print("Please refill stairs!");
  83.             while turtle.getItemCount() == 0 do end;
  84.         end
  85.  
  86.         checkFuel();
  87.         turtle.place();
  88.         if i == width then break end;
  89.  
  90.         turtle.turnRight();
  91.  
  92.         checkFuel();
  93.         turtle.forward();
  94.  
  95.         turtle.turnLeft();
  96.     end
  97. end
  98.  
  99. function down()
  100.     if turtle.detectDown() then
  101.         turtle.digDown();
  102.     end
  103.  
  104.     checkFuel();
  105.     turtle.down();
  106.  
  107.     turtle.turnLeft();
  108.     turtle.turnLeft();
  109. end
  110.  
  111. while true do
  112.     mineLevel();
  113.     placeStairs();
  114.     down();
  115. 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