Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local NUM_SLOTS = 16
- local MAX_STACK_SIZE = 64
- local args = { ... }
- function refuelFromLocalInventory()
- print("Refueling...")
- for i = 1, NUM_SLOTS do
- turtle.select(i)
- turtle.refuel(MAX_STACK_SIZE)
- end
- turtle.select(1)
- fuelLevel = turtle.getFuelLevel()
- print("Refueled to " .. fuelLevel .. "/" .. turtle.getFuelLimit())
- return fuelLevel
- end
- function refuelFromContainer(suckDirection, dropDirection)
- local sucks = {
- ["front"] = turtle.suck,
- ["up"] = turtle.suckUp,
- ["down"] = turtle.suckDown
- }
- local suck = sucks[suckDirection]
- local drops = {
- ["front"] = turtle.drop,
- ["up"] = turtle.dropUp,
- ["down"] = turtle.dropDown
- }
- local drop = drops[dropDirection]
- for i = 1, NUM_SLOTS do
- drop() -- empty inventory into drop container
- end
- -- refuel from suck container as much as possible
- while suck() do
- if not turtle.refuel(MAX_STACK_SIZE) then
- drop() -- not combustible, so drop it
- end
- end
- end
- refuelFromLocalInventory("front", "up")
Add Comment
Please, Sign In to add comment