Advertisement
thatparadox

TurtlePowerReceiver

May 4th, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. for i = 1,16 do
  2.   turtle.select(i)
  3.   if turtle.getItemCount(i) > 0 then
  4.     itemData = turtle.getItemDetail(i)
  5.     if itemData.name == "draconicevolution:draconium_capacitor" then
  6.       while turtle.drop(i) == false do
  7.         sleep(.05)
  8.       end
  9.       file = fs.open("dropped","w")
  10.       file.write("true")
  11.       file.close()
  12.       sleep(8)
  13.       turtle.suck()
  14.       file = fs.open("dropped","w")
  15.       file.write("false")
  16.       file.close()
  17.       rs.setOutput("bottom", false)
  18.       sleep(.5)
  19.       rs.setOutput("bottom", true)
  20.     else
  21.       turtle.turnRight()
  22.       turtle.drop(i)
  23.       turtle.turnLeft()
  24.     end
  25.   end
  26. end
  27.  
  28. turtle.suck()
  29. rs.setOutput("bottom", false)
  30. sleep(.5)
  31. rs.setOutput("bottom", true)
  32.  
  33. while true do
  34.   event, p1, p2 = os.pullEvent("turtle_inventory")
  35.   for i = 1,9 do
  36.     turtle.select(i)
  37.     if turtle.getItemCount(i) > 0 then
  38.       itemData = turtle.getItemDetail(i)
  39.       if itemData.name == "draconicevolution:draconium_capacitor" then
  40.         if turtle.drop() then
  41.           sleep(180)
  42.           turtle.suck()
  43.         end
  44.         rs.setOutput("bottom", false)
  45.         sleep(.5)
  46.         rs.setOutput("bottom", true)
  47.       else
  48.         turtle.turnRight()
  49.         turtle.drop()
  50.         turtle.trunLeft()
  51.       end
  52.     end
  53.   end
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement