Hoolaf

turtleLib/fuel

Sep 4th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. hasRefuelled = false
  2. tank = turtle.getFuelLevel()
  3.    
  4. function refuel(x)
  5.   if tonumber(x) == 1 then
  6.     display = true
  7.  
  8.   else
  9.     display = false
  10.   end
  11.  
  12.  
  13.   if tank < 200 then
  14.  
  15.     for slot = 16,1,-1 do
  16.       turtle.select(slot)
  17.       hasRefuelled = turtle.refuel(slot)
  18.    
  19.       if hasRefuelled == true then
  20.         if display == true then
  21.           print("Refuelled.")
  22.         end  
  23.         return true      
  24.       end
  25.    
  26.       if slot == 1 then
  27.         if display == true then
  28.           print("Out of fuel!")
  29.         end
  30.         return false    
  31.       end                
  32.     end    
  33.    
  34.     else
  35.       if displau == true then
  36.         print("No fuel needed.")
  37.       end
  38.       return false
  39.      
  40.   end
  41. end
Add Comment
Please, Sign In to add comment