Advertisement
Guest User

Miner

a guest
Jun 18th, 2013
12,492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 KB | None | 0 0
  1. rednet.open("right")
  2. local func
  3. local tArgs = {...}
  4.  
  5. function cleanup()
  6.    for i = 1,12 do
  7.       turtle.select(i)
  8.       turtle.dropDown()
  9.    end
  10. end
  11.  
  12. function place()
  13.    turtle.select(16)
  14.    turtle.place()
  15.    turtle.down()
  16.    turtle.select(15)
  17.    turtle.place()
  18.    turtle.select(14)
  19.    turtle.placeDown()
  20. end
  21.  
  22. function remove()
  23.    turtle.select(14)
  24.    turtle.digDown()
  25.    turtle.select(15)
  26.    turtle.dig()
  27.    turtle.up()
  28.    turtle.select(16)
  29.    turtle.dig()
  30. end
  31.  
  32. function fuel()
  33.    turtle.select(13)
  34.    turtle.placeUp()
  35.    turtle.select(1)
  36.    turtle.suckUp()
  37.    turtle.dropUp(turtle.getItemCount(1) - 4)
  38.    turtle.refuel()
  39.    turtle.select(13)
  40.    turtle.digUp()
  41. end
  42.  
  43. function fuelBoss()
  44.   turtle.select(13)
  45.   turtle.placeUp()
  46.   turtle.select(1)
  47.   turtle.suckUp()
  48.   turtle.dropUp(turtle.getItemCount(1) - 4)
  49.   turtle.select(13)
  50.   turtle.digUp()
  51.   turtle.up()
  52.   turtle.turnRight()
  53.   turtle.select(1)
  54.   turtle.drop()
  55.   turtle.turnLeft()
  56.   turtle.down()
  57. end
  58.  
  59. function checkFuel()
  60.    if turtle.getFuelLevel() < 400 then
  61.       fuel()
  62.    end
  63. end
  64.  
  65. function cycle()
  66.    place()
  67.    sleep(25)
  68.    while turtle.getItemCount(1) > 0 do
  69.       cleanup()
  70.       sleep(2)
  71.    end
  72.    remove()
  73.    checkFuel()
  74.    turtle.forward()
  75. end
  76.  
  77. function checkIn(fromID)
  78.    rednet.send(fromID, tArgs[1])
  79. end
  80.  
  81. function chunkLoad()
  82.    turtle.select(16)
  83.    turtle.digUp()
  84.    checkFuel()
  85.    turtle.select(16)
  86.    turtle.forward()
  87.    turtle.placeUp()
  88. end
  89.  
  90. while true do
  91.    local id,msg,dist = rednet.receive()
  92.    func = loadstring(msg.."(...)")
  93.    setfenv(func, getfenv())
  94.    func(id)
  95.    rednet.send(id,"Done")
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement