Renzott

Turtle Minecraft ComputerCraft

Jan 15th, 2021
1,570
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Start with Redstone Signal
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. print("Recuerda Poner un EnderChest en el primer casillero del turtle")
  6. term.setCursorPos(1,6)
  7. print("Para encender el turtle, tienes que darle un tick de redstone")
  8. os.pullEvent("redstone")
  9.  
  10.  
  11. ----------------------------
  12.  
  13. x = 0
  14. y = 0
  15. z = 0
  16.  
  17. a = 30
  18. b = 30
  19. c = 30
  20.  
  21. isRunning = true
  22. isLeft = true
  23. isFinishCycle = false
  24.  
  25. function turnRight()
  26.     turtle.turnRight()
  27.     turtle.dig()
  28.     turtle.forward()
  29.     turtle.turnRight()
  30. end
  31.  
  32. function turnLeft()
  33.     turtle.turnLeft()
  34.     turtle.dig()
  35.     turtle.forward()
  36.     turtle.turnLeft()
  37. end
  38.  
  39. function digDown()
  40.     turtle.digDown()
  41.     turtle.down()
  42.     turtle.turnLeft()
  43.     turtle.turnLeft()
  44. end
  45.  
  46. function ivFull()
  47.     if turtle.getItemCount(16) ~= 1 then
  48.         return false
  49.     end
  50.     return true
  51. end
  52.  
  53. function transferBase()
  54.     turtle.digUp()
  55.     turtle.select(1)
  56.     turtle.placeUp()
  57.  
  58.     for i = 2,16 do
  59.         turtle.select(i)
  60.         turtle.dropUp()
  61.     end
  62.    
  63.     turtle.select(1)
  64.     turtle.digUp()
  65. end
  66.  
  67. while isRunning do
  68.  
  69.     if ivFull() then
  70.         transferBase()
  71.     end
  72.  
  73.     if x == a and z == b then
  74.         isFinishCycle = true
  75.     end
  76.  
  77.     if x == a then
  78.         if isFinishCycle then
  79.             if y ~= c then
  80.                 digDown()
  81.                 isFinishCycle = false
  82.                 isLeft = not isLeft
  83.                 z = 0
  84.                 y = y + 1
  85.             else
  86.                 break
  87.             end
  88.         else
  89.             if isLeft then
  90.                 turnRight()
  91.             else
  92.                 turnLeft()
  93.             end
  94.             z = z + 1
  95.         end
  96.  
  97.         isLeft = not isLeft
  98.         x = 0
  99.        
  100.     else
  101.         turtle.dig()
  102.         turtle.forward()
  103.  
  104.         x = x + 1
  105.     end
  106. end
RAW Paste Data