Advertisement
Guest User

mine

a guest
Feb 17th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.64 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.   rednet.send(12, continue)
  99.   print(continue)
  100. end
  101.  
  102. function store()
  103.   turtle.select(2)
  104.   turtle.turnRight()
  105.   turtle.turnRight()
  106.   turtle.place()
  107.   turtle.select(1)
  108.   turtle.suck()
  109.    
  110.   for i = 3, 16 do
  111.     turtle.select(i)
  112.     turtle.drop()
  113.   end
  114.  
  115.   turtle.select(2)
  116.   turtle.place()
  117.   turtle.turnRight()
  118.   turtle.turnRight()
  119. end
  120.  
  121. function mainLoop()
  122.   while true do
  123.     id, msg = rednet.receive()
  124.      
  125.     if msg == "mineUp" then
  126.       mineUp()
  127.     end
  128.      
  129.     if msg == "mineDown" then
  130.       mineDown()
  131.     end
  132.      
  133.     if msg == "getStatus" then
  134.       getStatus()
  135.     end
  136.      
  137.     if msg == "store" then
  138.       store()
  139.     end
  140.      
  141.     if msg == "refuel" then
  142.       keepFuel()
  143.     end
  144.   end
  145. end
  146.  
  147. mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement