Advertisement
Jkerr

Simple mining well placement program

Apr 13th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 KB | None | 0 0
  1. -- Mining well program
  2.  
  3. -- Should have 200 fuel at least...
  4. forward = 0
  5. startingfuel = turtle.getFuelLevel()
  6. numconduit = 30
  7.  
  8. term.clear()
  9. print("Turtle fuel:")
  10. print(startingfuel)
  11.  
  12. if (startingfuel<200) then
  13.    print("Low on fuel! (should have at least 200)")
  14.    return
  15. end
  16.  
  17. -- rednet.open("right") --enable modem on the right side of the PC
  18.  
  19. print("---------------------")
  20. print("Start to the right of a powered conduit, mining well slot 1, ender chest in slot 2, ".. numconduit .." energy conduit slot 3")
  21. print("---------------------")
  22.  
  23. --rednet.broadcast("-----------------")
  24. --rednet.broadcast("Starting - fuel: ".. startingfuel)
  25.  
  26.  
  27. function digAndPlaceConduit()
  28.    turtle.dig()
  29.    turtle.forward()
  30.    turtle.digUp()
  31.    turtle.turnLeft()
  32.    turtle.dig()
  33.    -- place conduit
  34.    turtle.place()
  35.    turtle.up()
  36.    turtle.dig()
  37.    turtle.down()
  38.    turtle.turnRight()
  39. end
  40.  
  41. function emptyInventory()
  42.    for n=0,15 do
  43.       turtle.select(n+1)
  44.       turtle.drop()
  45.    end
  46.    turtle.select(1)
  47. end
  48.  
  49. function placeMiningWell()
  50.    -- ender chest first
  51.    turtle.up()
  52.    turtle.select(2)
  53.    turtle.place()
  54.    turtle.down()
  55.    turtle.select(1)
  56.    turtle.place()
  57.    sleep(6)
  58.    turtle.up()
  59.    -- Empty into the ender chest first
  60.    emptyInventory()
  61.    turtle.down()
  62.    turtle.dig()
  63.    turtle.up()
  64.    turtle.dig()
  65.    turtle.down()
  66.    turtle.forward()
  67.    forward = forward+1
  68. end
  69.    
  70. function cleanUpConduit()
  71.    turtle.turnLeft()
  72.    turtle.dig()
  73.    turtle.turnRight()
  74.    turtle.back()
  75. end
  76.  
  77. turtle.select(3)
  78.  
  79. for n=0,numconduit-1 do
  80.    digAndPlaceConduit()
  81. end
  82.  
  83. for n=0,numconduit-1 do
  84.    turtle.back()
  85. end
  86.  
  87. for n=0,numconduit-1 do
  88.    placeMiningWell()
  89. end
  90.  
  91. for n=0,numconduit-1 do
  92.    cleanUpConduit()
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement