SHARE
TWEET

rmwater.lua

a guest Nov 9th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local input = {...}
  2.  
  3. if #input~=3 then
  4.     print("Usage: rmwater <x> <y> <z>")
  5.     return
  6. end
  7.  
  8. local x = tonumber(input[1])
  9. local y = tonumber(input[2])
  10. local z = tonumber(input[3])
  11.  
  12. local function checkFuel()
  13.     turtle.select(1)
  14.     if turtle.getFuelLevel()==0 then
  15.         while not turtle.refuel(1) do
  16.             print("Waiting For Fuel...")
  17.         end
  18.     end
  19.     turtle.select(2)
  20. end
  21.  
  22. local function checkItemsAndPlace()
  23.     turtle.select(2)
  24.     local slot = 2
  25.     while turtle.getItemCount()==0 do
  26.         slot = slot + 1
  27.         if slot>16 then
  28.             slot = 2
  29.         end
  30.         turtle.select(slot)
  31.     end
  32.     turtle.placeDown()
  33. end
  34.  
  35. local function span(x,y,z,vert,action)
  36.     for i=1,y do
  37.         for j=1,z do
  38.             for k=1,x do
  39.                 action()
  40.                     if k~=x then
  41.                     checkFuel()
  42.                     while not turtle.forward() do end
  43.                 end
  44.             end
  45.             if j % 2 == (x % 2 == 1 and 1 or i % 2) then
  46.                 turtle.turnRight()
  47.                 checkFuel()
  48.                 if j~=z then
  49.                     while not turtle.forward() do end
  50.                 end
  51.                 turtle.turnRight()
  52.             else
  53.                 turtle.turnLeft()
  54.                 checkFuel()
  55.                 if j~=z then
  56.                     while not turtle.forward() do end
  57.                 end
  58.                 turtle.turnLeft()
  59.             end
  60.         end
  61.         if i~=y then
  62.             checkFuel()
  63.             while not vert() do end
  64.         end
  65.     end
  66. end
  67.  
  68. span(x,y,z,turtle.up,checkItemsAndPlace)
  69. checkFuel()
  70. while not turtle.forward() do end
  71. turtle.turnRight()
  72. while not turtle.forward() do end
  73. turtle.turnLeft()
  74.  
  75. span(x-2,y,z-2,turtle.down,turtle.digDown)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top