akihex

turtleDrum

Apr 8th, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. local signalSide = "bottom"
  2. local drum = peripheral.wrap("front")
  3. local rTank = peripheral.wrap("back")
  4. local limit = -256000
  5. --local limit = -3500000
  6. local tank, rtank
  7.  
  8. while true do
  9.   rtank = rTank.getTankInfo("in")
  10.   if(rtank and rtank[1] and rtank[1].amount-rtank[1].capacity >= limit) then
  11.     print("Trying to place new drum.")
  12.     if not turtle.detect() then
  13.       --encourage block placer to do his job
  14.       redstone.setOutput(signalSide,true)
  15.       sleep(1)
  16.       redstone.setOutput(signalSide,false)
  17.     end
  18.   end
  19.   if turtle.detect() then
  20.     drum = peripheral.wrap("front")
  21.     if drum then
  22.       tank = drum.getTankInfo("in")
  23.       if(tank and tank[1] and tank[1].amount-tank[1].capacity>=0) then
  24.         turtle.dig()
  25.        -- redstone.setOutput(signalSide,true)
  26.        -- sleep(1)
  27.        -- redstone.setOutput(signalSide,false)
  28.       end
  29.     end
  30.   end
  31.   sleep(30)
  32. end
Advertisement
Add Comment
Please, Sign In to add comment