Advertisement
k2green

Miner

Jul 31st, 2024
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | Software | 0 0
  1. local args = { ... }
  2.  
  3. local function turn(direction, inverted)
  4.     if direction == "left" then
  5.         if inverted then
  6.             turtle.turnRight()
  7.         else
  8.             turtle.turnLeft()
  9.         end
  10.     elseif direction == "right" then
  11.         if inverted then
  12.             turtle.turnLeft()
  13.         else
  14.             turtle.turnRight()
  15.         end
  16.     end
  17. end
  18.  
  19. while true do
  20.     local exists, details = turtle.inspect()
  21.    
  22.     if exists and details.name == args[1] then
  23.         break
  24.     end
  25.    
  26.     turtle.turnLeft()
  27. end
  28.  
  29. for i=1, 16 do
  30.     turtle.select(i)
  31.     turtle.drop()
  32. end
  33.  
  34. turtle.select(1)
  35. turn(args[3], true)
  36.  
  37. while true do
  38.     local exists, details = turtle.inspect()
  39.    
  40.     if exists and details.name == args[2] then
  41.         turtle.dig()
  42.         turn(args[3], false)
  43.         turtle.drop()
  44.         turn(args[3], true)
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement