Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gfl = turtle.getFuelLevel
- local refuel(amount)
- local slot = turtle.select()
- if gfl() < amount) then
- for i = 1, 16 do
- while turtle.refuel() do
- if gfl() >= amount then
- turtle.select(slot)
- return true
- end
- end
- end
- end
- return false
- end
- local forward()
- while not turtle.forward do
- if not refuel(1) then
- os.sleep(10)
- end
- end
- end
- local back()
- while not turtle.back do
- os.sleep(10)
- local tHandlers = {
- ["B"] = turtle.back,
- ["D"] = turtle.down,
- ["F"] = turtle.forward,
- ["L"] = turtle.turnLeft,
- ["O"] = turtle.placeUp,
- ["P"] = turtle.place,
- ["Q"] = turtle.placeDown,
- ["R"] = turtle.turnRight,
- ["U"] = turtle.up
- }
- local function exec(command)
- if type(command) ~= "string" then return end
- for i = 1, #command do
- local cmd = tHandlers[command:sub(i,i)]
- if cmd then cmd() end
- end
- end
- local function door(n)
- turtle.select(n)
- exec("BUQUQPLLPRBP")
- end
- local function wall(n)
- turtle.select(n)
- exec("BPLLPUQ PLLPUQ PLLPRBP")
- end
- local function corner(n)
- turtle.select(16)
- turtle.placeDown()
- turtle.select(n)
- exec("LFFRPDPDP")
- end
- local function ladder()
- turtle.select(15)
- exec("BLFDQUQUQUQRFF")
- end
- local function noladder()
- exec("UULFRF")
- end
- local function ceiling(n)
- turtle.select(n)
- exec("QBQBQBQRFR QBQBQBQLFL QBQBQBQRFR QBQBQBQ")
- end
- ceiling()
- os.exit()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- door()
- corner()
- wall()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement