Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- print("Start where the first chest was facing the second half of the chest")
- startingfuel = turtle.getFuelLevel()
- print("-----------")
- print("Turtle fuel:")
- print(startingfuel)
- if (startingfuel<300) then
- print("--------------------------------------")
- print("Low on fuel! (should have at least 300)")
- return
- end
- height = 0
- ceiling = false
- turtle.select(1)
- function nextFloor()
- if turtle.detectUp() then
- ceiling = true
- else
- ceiling = false
- end
- while ceiling ~= true do
- turtle.up()
- height=height+1
- if turtle.detectUp() then
- ceiling = true
- else
- ceiling = false
- end
- end
- end
- function reset()
- if height>0 then
- for i=0,height,1 do
- turtle.down()
- height=height-1
- end
- end
- turtle.select(1)
- end
- function getChestContents()
- -- We're at the floor, break that first...
- turtle.digUp()
- turtle.up()
- height=height+1
- -- Now the doubleslab the chest is on...
- turtle.digUp()
- turtle.up()
- height=height+1
- -- now that half of the chest...
- turtle.digUp()
- turtle.suckUp()
- turtle.up()
- height=height+1
- -- Vacuum all around
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- -- Break second half of chest
- turtle.dig()
- turtle.suck()
- turtle.forward()
- -- Vacuum
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.suck()
- turtle.turnRight()
- turtle.back()
- --Now back to the spot the chest was on, blocking the hole
- turtle.down()
- height=height-1
- end
- -- 9 floors above:
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- nextFloor()
- getChestContents()
- reset()
- print("---------------------")
- print("Ending turtle fuel:")
- print(turtle.getFuelLevel())
- print("Fuel used:")
- print(startingfuel-turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement