Guest User

Miner Mover, a turtle program to continually reset Digital Miners

a guest
Jul 9th, 2024
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | Gaming | 0 0
  1. --[[
  2.     Welcome to MinerMover, this is dead simple program to move a digital miner every time it runs out of blocks to dig
  3.     Requirements:
  4.     1. A fueled up mining turtle with a chunkloading peripheral,
  5.     2. a digital miner,
  6.     3. an enderchest equivalent to dump the ores,
  7.     4. and a method of power that does not require configuration upon placing(IE a preconfigured tesseract or fluxpoint)
  8.  
  9.     To start the program, name it startup, place a digital miner in slot 1, your power in slot 2, and the ender chest in slot three
  10.     The program should be able to start itself back up and resume when shut down unexpectedly
  11.     However if this happens midway through the break or build process, it will almost certainly break
  12.     This has never happened in my testing, given how small the window of time for that is, but it can happen.
  13.  
  14.     The turtle will not mine it's way forward, so I recommend starting it high in the air, above any potential obstacles.
  15. ]]
  16.  
  17. local function buildDigger()
  18.     turtle.select(1)
  19.     turtle.placeUp()
  20.     turtle.turnLeft()
  21.     turtle.forward()
  22.     turtle.forward()
  23.     turtle.select(2)
  24.     turtle.placeUp()
  25.     turtle.back()
  26.     turtle.back()
  27.     turtle.turnRight()
  28.     turtle.forward()
  29.     turtle.forward()
  30.     turtle.up()
  31.     turtle.select(3)
  32.     turtle.placeUp()
  33.     turtle.down()
  34.     turtle.back()
  35.     turtle.back()
  36.     peripheral.call("top", "start")
  37.     print("Digger placed and started")
  38. end
  39.  
  40. local function breakDigger()
  41.     turtle.select(1)
  42.     turtle.digUp()
  43.     turtle.up()
  44.     turtle.turnLeft()
  45.     turtle.forward()
  46.     turtle.select(2)
  47.     turtle.dig()
  48.     turtle.back()
  49.     turtle.turnRight()
  50.     turtle.forward()
  51.     turtle.up()
  52.     turtle.select(3)
  53.     turtle.dig()
  54.     turtle.down()
  55.     turtle.down()
  56. end
  57.  
  58. local function moveDigger()
  59.     breakDigger()
  60.     for i=1,65 do
  61.         turtle.forward()
  62.     end
  63.     buildDigger()
  64. end
  65.  
  66. if turtle.getItemCount(1) == 1 then
  67.     buildDigger()
  68. end
  69.  
  70. local running = true
  71. while running do
  72.     if peripheral.call("top", "getToMine") ~= 0 then
  73.         sleep(30)
  74.     else
  75.         moveDigger()
  76.     end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment