thatparadox

PowerStationTurtle

May 4th, 2017
155
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rs.setOutput("bottom",true)
  2.  
  3. for i = 1,16 do
  4.   turtle.select(i)
  5.   if turtle.getItemCount(i) > 0 then
  6.     itemData = turtle.getItemDetail(i)
  7.     if itemData.name == "draconicevolution:draconium_capacitor" then
  8.       while turtle.drop(i) == false do
  9.         sleep(.05)
  10.       end
  11.       file = fs.open("dropped","w")
  12.       file.write("true")
  13.       file.close()
  14.       sleep(8)
  15.       turtle.suck()
  16.       file = fs.open("dropped","w")
  17.       file.write("false")
  18.       file.close()
  19.       rs.setOutput("bottom", false)
  20.       sleep(.5)
  21.       rs.setOutput("bottom", true)
  22.     else
  23.       turtle.turnRight()
  24.       turtle.drop(i)
  25.       turtle.turnLeft()
  26.     end
  27.   end
  28. end
  29.  
  30.  
  31. if fs.exists("dropped") then
  32.   file = fs.open("dropped", "r")
  33.   dropped = file.readAll()
  34.   file.close()
  35.   if dropped == "true" then
  36.     turtle.suck()
  37.     rs.setOutput("bottom", false)
  38.     sleep(.5)
  39.     rs.setOutput("bottom", true)
  40.   end
  41. end
  42.  
  43. while true do
  44.   event, p1, p2 = os.pullEvent("turtle_inventory")
  45.   for i = 1,16 do
  46.     turtle.select(i)
  47.     if turtle.getItemCount(i) > 0 then
  48.       itemData = turtle.getItemDetail(i)
  49.       if itemData.name == "draconicevolution:draconium_capacitor" then
  50.         while turtle.drop(i) == false do
  51.           sleep(.05)
  52.         end
  53.         file = fs.open("dropped","w")
  54.         file.write("true")
  55.         file.close()
  56.         sleep(8)
  57.         turtle.suck()
  58.         file = fs.open("dropped","w")
  59.         file.write("false")
  60.         file.close()
  61.         rs.setOutput("bottom", false)
  62.         sleep(.5)
  63.         rs.setOutput("bottom", true)
  64.       else
  65.         turtle.turnRight()
  66.         turtle.drop(i)
  67.         turtle.turnLeft()
  68.       end
  69.     end
  70.   end
  71. end
RAW Paste Data