Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- tries to refuel till possible
- local function refuelProcess()
- local cnt = 0
- local bFueld = false
- local slot = turtle.getSelectedSlot()
- while not bFueld do
- for i = 1, 16, 1 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item then
- if not (item.name == "minecraft:chest") then
- local ok, err = turtle.refuel()
- end
- end
- end
- if turtle.getFuelLevel() > 0 then
- print("New fuel level: " .. tostring(turtle.getFuelLevel()))
- turtle.select(slot)
- return true
- end
- if cnt == 0 then
- print("Pls enter fuel to continue")
- end
- cnt = 1
- end
- turtle.select(slot)
- return true
- end
- -- Checks if fuel is available or starts refuel process
- local function fuelCheck()
- if turtle.getFuelLevel() > 0 then
- return
- else
- refuelProcess()
- end
- end
- -- Digs in given direction till turtle can move
- local function Forward()
- fuelCheck()
- local b = false
- while not b do
- b = turtle.forward()
- if not b then
- turtle.dig()
- end
- end
- end
- local function Up()
- fuelCheck()
- local b = false
- while not b do
- b = turtle.up()
- if not b then
- turtle.digUp()
- end
- end
- end
- local function Down()
- fuelCheck()
- local b = false
- while not b do
- b = turtle.down()
- if not b then
- turtle.digDown()
- end
- end
- end
- -- Turn turtle 180°
- local function turnBack()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- return { Forward = Forward, Up = Up, Down = Down, turnBack = turnBack }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement