ScoutMaester

Untitled

Jan 14th, 2021 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.58 KB | None | 0 0
  1. local success, block = turtle.inspectUp()
  2. local success, bottom = turtle.inspectDown()
  3. halt = 0
  4. wait = 0
  5. up = 0
  6. local modem = peripheral.wrap("left")
  7.  
  8. function imMaster()
  9.     t = peripheral.wrap("front")
  10.     for i = 1,15 do
  11.         turtle.suckUp(1)
  12.         turtle.place()
  13.         peripheral.call("front", "turnOn")
  14.         print("Turtle", i, " deployed!")
  15.         if turtle.place() == false then
  16.             wait = 1
  17.             while wait == 1 do
  18.                 sleep(1)
  19.                 turtle.detect()
  20.                 if turtle.detect() == false then
  21.                     wait = 0
  22.                 end
  23.             end
  24.             turtle.place()
  25.         end
  26.     end
  27.     turtle.forward()
  28.     turtle.digDown()
  29. end
  30.  
  31. function position()
  32.     while halt == 0 do
  33.         turtle.forward()
  34.         if turtle.detect() == true then
  35.             halt = 1
  36.         end
  37.     end
  38.     halt = 0
  39.     turtle.turnLeft()
  40. end
  41.  
  42. function imSlave()
  43.     if turtle.detectUp() == false then
  44.         up = 1
  45.         while up == 1 do
  46.             turtle.up()
  47.             if turtle.detectUp() == true then
  48.                 up = 0
  49.                 turtle.turnRight()
  50.             end
  51.         end
  52.         if turtle.detect() == false then
  53.             while halt == 0 do
  54.                 turtle.forward()
  55.                 if turtle.detect() == true then
  56.                     halt = 1
  57.                 end
  58.             end
  59.             halt = 0
  60.         end
  61.         turtle.turnLeft()
  62.         turtle.digDown()
  63.     else
  64.         turtle.turnRight()
  65.         if turtle.detect() == false then
  66.             while halt == 0 do
  67.                 turtle.forward()
  68.                 if turtle.detect() == true then
  69.                     halt = 1
  70.                 end
  71.             end
  72.             halt = 0
  73.         end
  74.         turtle.turnLeft()
  75.         turtle.digDown()
  76.     end
  77. end
  78.  
  79.    
  80.  
  81.  
  82. if block.name == "minecraft:shulker_box" then
  83.     imMaster()
  84. else
  85.     imSlave()
  86. end
  87.  
  88. rednet.open("left", 1)
  89.  
  90. while true do
  91.     id, msg = rednet.receive()
  92.     print(msg)
  93.     if msg == "tunnel" then
  94.         for i = 1,50 do
  95.             turtle.dig()
  96.             turtle.forward()
  97.             print(i)
  98.         end
  99.         turtle.turnLeft()
  100.         turtle.turnLeft()
  101.         for i = 1,50 do
  102.             turtle.dig()
  103.             turtle.forward()
  104.             print(i)
  105.         end
  106.         sleep(10)
  107.         if turtle.detectDown() == false then
  108.             print("Im on bottom")
  109.             for i = 1,3 do
  110.                 turtle.digUp()
  111.                 turtle.up()
  112.             end
  113.             for i = 1,3 do
  114.                 turtle.down()
  115.             end
  116.             turtle.turnLeft()
  117.             local success, chest = turtle.inspect()
  118.             if chest.name == "minecraft:chest" then
  119.                 for i = 1,4 do
  120.                     for i = 1,16 do
  121.                         turtle.select(i)
  122.                         turtle.drop()
  123.                     end
  124.                     sleep(2)
  125.                 end
  126.                 turtle.turnLeft()
  127.                 turtle.turnLeft()
  128.                 for i = 1,3 do
  129.                     turtle.dig()
  130.                     turtle.forward()
  131.                 end
  132.                 turtle.turnLeft()
  133.                 turtle.forward()
  134.                 turtle.turnRight()
  135.                 turtle.turnRight()
  136.             else
  137.                 for i = 1,4 do
  138.                     for i = 1,16 do
  139.                         turtle.select(i)
  140.                         turtle.drop()
  141.                     end
  142.                 end
  143.             end
  144.         else
  145.             sleep(20)
  146.         end
  147.     end
  148. end
Add Comment
Please, Sign In to add comment