profezzional

mine

Apr 20th, 2021 (edited)
855
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local NUM_SLOTS = 16
  2. local args = { ... }
  3.  
  4. function refuel()
  5.     print("Refueling...")
  6.     local fuelLimit = turtle.getFuelLimit()
  7.  
  8.     for i = 1, NUM_SLOTS do
  9.         turtle.select(i)
  10.         local reachedFuelLimit = false
  11.  
  12.         while true do
  13.             if turtle.refuel(1) then
  14.                 if turtle.getFuelLevel() == fuelLimit then
  15.                     reachedFuelLimit = true -- full, so stop refueling
  16.                     break
  17.                 end
  18.             else
  19.                 break -- slot is either empty or contains non-fuel item, so go to next slot
  20.             end
  21.         end
  22.  
  23.         if reachedFuelLimit then
  24.             break
  25.         end
  26.     end
  27.  
  28.     fuelLevel = turtle.getFuelLevel()
  29.     print("Refueled to " .. fuelLevel .. "/" .. fuelLimit)
  30.  
  31.     return fuelLevel
  32. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×