denvys5

Miner

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