Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clearscreen()
- term.clear()
- term.setCursorPos(1, 1)
- end
- maxFuel = turtle.getFuelLimit()
- curFuel = turtle.getFuelLevel()
- missingFuel = maxFuel - curFuel
- bucketsNeeded = math.ceil(missingFuel / 1000)
- automaticLength = math.floor(bucketsNeeded / 2)
- clearscreen()
- print("Currently at " ..curFuel.. "/" ..maxFuel.. " fuel.")
- print("\nAccording to my calculations I'll need to move [" ..automaticLength.. "] blocks to refuel completely.\n\nWanna do that? y/n")
- auto = read()
- if auto == "y" then
- laenge = automaticLength
- else
- clearscreen()
- print("How long?")
- laenge = tonumber(read())
- end
- print("To the left or right? l/r")
- dir = read()
- print("Try to move into safe position? y/n ")
- safe = read()
- lcount = 0
- function finditem(item)
- for i = 1, 16 do
- if turtle.getItemCount(i) > 0 then
- data = turtle.getItemDetail(i)
- if data.name == item then
- turtle.select(i)
- return true
- end
- end
- end
- return false
- end
- function safemove()
- finditem("minecraft:bucket")
- turtle.placeDown()
- turtle.refuel()
- if turtle.forward() == false then
- turtle.dig()
- else
- lcount = lcount + 1
- end
- end
- function oneline()
- repeat
- safemove()
- until lcount == laenge
- lcount = 0
- end
- function turn()
- if dir == "l" then
- turtle.turnLeft()
- elseif dir == "r" then
- turtle.turnRight()
- end
- end
- function fullturn()
- finditem("minecraft:bucket")
- turtle.placeDown()
- turtle.refuel()
- turn()
- repeat turtle.dig() until turtle.forward()
- turn()
- end
- function movetosafety()
- for i =1, 2 do
- repeat turtle.digUp() until turtle.up()
- end
- for i=1, 2 do
- repeat turtle.dig() until turtle.forward()
- end
- end
- function manualstart()
- if finditem("minecraft:bucket") == false then
- repeat
- clearscreen()
- textutils.slowPrint("Need bucket or this won't work.")
- sleep(1)
- until finditem("minecraft:bucket")
- end
- oneline()
- fullturn()
- oneline()
- if safe == "y" then
- movetosafety()
- end
- end
- manualstart()
- clearscreen()
- print("I'm now at " ..turtle.getFuelLevel() .." fuel.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement