TKArchie

Untitled

Aug 10th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. function placePower()
  91.    turtle.select(1)
  92.    turtle.place()
  93.    turtle.down()
  94.    turtle.select(2)
  95.    turtle.dig()
  96. end
  97.  
  98. function removePower()
  99.    turtle.select(2)
  100.    turtle.dig()
  101.    turtle.up()
  102.    turtle.select(1)
  103.    turtle.dig()
  104. end
  105.  
  106. function power()
  107.    placePower()
  108.    sleep(30)
  109.    removePower()
  110.    turtle.select(3)
  111.    turtle.refuel()
  112.    turtle.select(1)
  113.    turtle.forward()
  114. end
  115.  
  116. while true do
  117.    local id,msg,dist = rednet.receive()
  118.    func = loadstring(msg.."(...)")
  119.    setfenv(func, getfenv())
  120.    func(id)
  121.    rednet.send(id,"Done")
  122. end
Advertisement
Add Comment
Please, Sign In to add comment