Advertisement
Guest User

mine

a guest
Feb 17th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.80 KB | None | 0 0
  1. rednet.open("right")
  2.  
  3. function mineDown()
  4.   print("mineDown")
  5.   continue = false
  6.   local succ, t = turtle.inspect()
  7.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  8.   turtle.dig()
  9.   turtle.forward()
  10.   turtle.turnRight()
  11.   local succ, t = turtle.inspect()
  12.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  13.   turtle.dig()
  14.   turtle.turnLeft()
  15.   turtle.turnLeft()
  16.   local succ, t = turtle.inspect()
  17.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  18.   local succ, t = turtle.inspectDown()
  19.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  20.   turtle.dig()
  21.   turtle.digDown()
  22.   turtle.down()
  23.   local succ, t = turtle.inspect()
  24.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  25.   turtle.dig()
  26.   turtle.turnRight()
  27.   turtle.turnRight()
  28.   local succ, t = turtle.inspect()
  29.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  30.   local succ, t = turtle.inspectDown()
  31.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  32.   turtle.dig()
  33.   turtle.digDown()
  34.   turtle.down()
  35.   local succ, t = turtle.inspect()
  36.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  37.   turtle.dig()
  38.   turtle.turnLeft()
  39.   turtle.turnLeft()
  40.   local succ, t = turtle.inspect()
  41.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  42.   turtle.dig()
  43.   turtle.turnRight()
  44. end
  45.  
  46. function mineUp()
  47.   print("mineUp")
  48.   continue = false
  49.   local suc, t = turtle.inspect()
  50.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  51.   turtle.dig()
  52.   turtle.forward()
  53.   turtle.turnRight()
  54.   local suc, t = turtle.inspect()
  55.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  56.   turtle.dig()
  57.   turtle.turnLeft()
  58.   turtle.turnLeft()
  59.   local suc, t = turtle.inspect()
  60.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  61.   local suc, t = turtle.inspectUp()
  62.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  63.   turtle.dig()
  64.   turtle.digUp()
  65.   turtle.up()
  66.   local suc, t = turtle.inspect()
  67.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  68.   turtle.dig()
  69.   turtle.turnRight()
  70.   turtle.turnRight()
  71.   local suc, t = turtle.inspect()
  72.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  73.   local suc, t = turtle.inspectUp()
  74.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  75.   turtle.dig()
  76.   turtle.digUp()
  77.   turtle.up()
  78.   local suc, t = turtle.inspect()
  79.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  80.   turtle.dig()
  81.   turtle.turnLeft()
  82.   turtle.turnLeft()
  83.   local suc, t = turtle.inspect()
  84.   if t.name == "gregtech:gt.blockores.gc" then continue = true end
  85.   turtle.dig()
  86.   turtle.turnRight()
  87. end
  88.  
  89. function keepFuel()
  90.   while turtle.getFuelLevel() < 100 do
  91.     turtle.select(1)
  92.     turtle.refuel(1)
  93.     rednet.send(12, "ready")
  94.   end
  95. end
  96.  
  97. function getStatus()
  98.   if continue == true then
  99.     rednet.send(12, true)
  100.     print(continue)
  101.   end
  102. end
  103.  
  104. function store()
  105.   turtle.select(2)
  106.   turtle.turnRight()
  107.   turtle.turnRight()
  108.   turtle.place()
  109.   turtle.select(1)
  110.   turtle.suck()
  111.    
  112.   for i = 3, 16 do
  113.     turtle.select(i)
  114.     turtle.drop()
  115.   end
  116.  
  117.   turtle.select(2)
  118.   turtle.place()
  119.   turtle.turnRight()
  120.   turtle.turnRight()
  121. end
  122.  
  123. function reset()
  124.   turtle.down()
  125.   turtle.down()
  126.   turtle.down()
  127. end
  128.  
  129. function mainLoop()
  130.   while true do
  131.     id, msg = rednet.receive()
  132.      
  133.     if msg == "mineUp" then
  134.       mineUp()
  135.     end
  136.      
  137.     if msg == "mineDown" then
  138.       mineDown()
  139.     end
  140.      
  141.     if msg == "getStatus" then
  142.       getStatus()
  143.     end
  144.      
  145.     if msg == "store" then
  146.       store()
  147.     end
  148.      
  149.     if msg == "refuel" then
  150.       keepFuel()
  151.     end
  152.    
  153.     if msg == "reset" then
  154.       reset()
  155.     end
  156.   end
  157. end
  158.  
  159. mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement