Advertisement
Guest User

Power by Direwolf20 - Ripped by Zeus_guy

a guest
Feb 3rd, 2013
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. local location = ""
  2.  
  3. function teleport()
  4.    tp = peripheral.wrap("bottom")
  5.    tp.teleport()
  6. end
  7.  
  8. function checkFull()
  9.    greader = peripheral.wrap("right")
  10.    data = greader.get()
  11.    while not data["Full Energt"] do
  12.       sleep(2)
  13.       data=greader.get()
  14.    end
  15.    turtle.dig()
  16. end
  17.  
  18. function checkEmpty()
  19.    greader=peripheral.wrap("right")
  20.    data = greader.get()
  21.    while not data["No Energy"] do
  22.       sleep(2)
  23.       data = greader.get()
  24.    end
  25.    turtle.dig()
  26. end
  27.  
  28. function checkLoc()
  29.    loc = turtle.detectUp()
  30.    if loc == true then
  31.       print("I am at the quarry")
  32.       location = "Quarry"
  33.    else
  34.       print("I am at the charge station")
  35.       location = "Charging"
  36.    end
  37. end
  38.  
  39. function getFuel()
  40.    turtle.turnRight()
  41.    for i = 1, 9 do turtle.forward() end
  42.    turtle.turnLeft()
  43.    for i = 1, 6 do turtle.forward() end
  44.    turtle.suck()
  45.    turtle.refuel()
  46.    turtle.turnLeft()
  47.    turtle.turnLeft()
  48.    for i = 1, 6 do turtle.forward() end
  49.    turtle.turnRight()
  50. for i = 1, 9 do turtle.forward() end
  51.    turtle.turnRight()
  52. end
  53.  
  54.  
  55. function checkFuel()
  56.    fuel = turtle.getFuelLevel()
  57.    print("My fuel level:"..tostring(fuel))
  58.    if fuel < 2500 then
  59.       print("I need fuel")
  60.       getFuel()
  61.       print("My fuel level:"..tostring(turtle.getFuelLevel()))
  62.    end
  63. end
  64.  
  65.  
  66. checkLoc()
  67. if location == "Quarry" then
  68.    turtle.turnRight()
  69.    turtle.place()
  70.    checkEmpty()
  71.    teleport()
  72. else
  73.    turtle.turnRight()
  74.    turtle.forward()
  75.    turtle.forward()
  76.    turtle.place()
  77.    checkFuel()
  78.    checkFull()
  79.    turtle.turnLeft()
  80.    turtle.turnLeft()
  81.    turtle.forward()
  82.    turtle.forward()
  83.    teleport()
  84. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement