Advertisement
npexception

milk.tankturtle

Mar 3rd, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. local inputSide = "bottom"
  2. local outputSide = "left"
  3.  
  4. local tank = peripheral.wrap("right")
  5.  
  6. while true do
  7.   -- start only if redstone signal is applied
  8.   if redstone.getInput(inputSide) then
  9.     print("DRAINING COW")
  10.   end
  11.   while redstone.getInput(inputSide) do
  12.     if turtle.place() then
  13.       if not tank.unpack() then
  14.         turtle.turnLeft()
  15.         turtle.turnLeft()
  16.         shell.run("redpulse "..outputSide)
  17.         print()
  18.         while tank.drop() < 1000 do
  19.           print("TANK FULL")
  20.           sleep(5)
  21.         end
  22.         tank.unpack()
  23.         while not tank.drop() < 1000 do
  24.           print("TANK FULL")
  25.           sleep(5)
  26.         end
  27.         turtle.turnLeft()
  28.         turtle.turnLeft()
  29.       end
  30.       sleep(0.5)
  31.     else
  32.       print("WAITING FOR COW")
  33.       sleep(10)
  34.     end
  35.   end
  36.   print("STOPPED DRAINING COW")
  37.   os.pullEvent("redstone")
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement