GraySloth

ComputerCraft: MiscPeripherals: 'fill' for Thaumic crucibles

Feb 15th, 2013
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. --v1.1 by GraySloth 2013-Feb-23 for the MiscPeripheral mod with the Tank Upgrade, use to fill thaumic crucibles with water automatically
  2.  
  3. --variables
  4. local w = peripheral.wrap("right")
  5. local dist = 1 --sets distance from water source
  6. --functions
  7. function clear()
  8.    term.clear()
  9.    term.setCursorPos(1,1)
  10. end
  11.  
  12. function fuelCheck()
  13.    if turtle.getFuelLevel() == "unlimited" then
  14.       return true
  15.    elseif turtle.getFuelLevel() < 2 then
  16.       print("Searching for fuel hold ctrl+t to stop")
  17.       while turtle.getFuelLevel() < 10 do
  18.          for n=1,16 do
  19.             if turtle.getFuelLevel() < 10 then
  20.                turtle.select(n)
  21.                turtle.refuel(1)
  22.             end
  23.          end
  24.       end
  25.       print("Refueled: "..turtle.getFuelLevel())
  26.    end
  27. end
  28. --Main
  29. while true do
  30.    if w.getLiquid() then
  31.       w.drop()
  32.    else
  33.       fuelCheck()
  34.       for i = 1, dist do
  35.          turtle.back()
  36.       end
  37.       clear()
  38.       print("Refilling")
  39.       for i=1,10 do
  40.          while not w.suckDown() do
  41.             print("Refilled "..tostring(i).."/10")
  42.             os.sleep(1.5)
  43.          end
  44.       end
  45.       for i = 1, dist do
  46.          turtle.forward()
  47.       end
  48.    end
  49.    os.sleep(1)
  50.    clear()
  51.    print(textutils.formatTime(os.time(),true))
  52.    print("Waiting to fill, Master.")
  53. end
Advertisement
Add Comment
Please, Sign In to add comment