Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function nofuel()
- clear()
- for i=1,x-1 do
- write("-")
- end
- print("Please insert some fuel first!")
- print("Make sure to put in enough for the task.")
- print("")
- print("Returning...")
- for i=1,x-1 do
- write("-")
- end
- sleep(1)
- start()
- end
- function checkfuel()
- if turtle.getFuelLevel() < 5 then
- return true
- else
- return false
- end
- end
- function refuel(quantity)
- fuelpre = turtle.getFuelLevel()
- for i4=0,13 do
- turtle.select(16-i4)
- if turtle.refuel(quantity) then
- break
- else
- if 16-i4==3 then
- fuelpost = turtle.getFuelLevel()
- turtle.select(1)
- if fuelpre == fuelpost then
- nofuel()
- end
- end
- end
- end
- turtle.select(tmp)
- end
- function findcobble()
- for i1 = 3,16 do
- turtle.select(i1)
- if turtle.compareTo(1) then
- tmp = i1
- break
- end
- end
- end
- function findstairs()
- for i3 = 3,16 do
- turtle.select(i3)
- if turtle.compareTo(2) then
- tmp = i3
- break
- end
- end
- end
- function dig()
- turtle.select(1)
- if not turtle.compare() then
- turtle.dig()
- end
- turtle.digUp()
- turtle.select(tmp)
- end
- function buildwallsegment()
- findcobble()
- for i2 = 1,3 do
- output()
- if checkfuel() then
- refuel(1)
- end
- dig()
- turtle.place()
- turtle.turnRight()
- dig()
- if i2 < 3 then
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- function buildfullsegment()
- for i5 = 1,4 do
- buildwallsegment()
- end
- end
- function placestairs()
- if checkfuel() then
- refuel(1)
- end
- findcobble()
- turtle.forward()
- output()
- turtle.place()
- findstairs()
- turtle.back()
- output()
- turtle.place()
- turtle.up()
- output()
- turtle.forward()
- output()
- turtle.place()
- turtle.up()
- output()
- turtle.forward()
- output()
- end
- function staircase()
- buildfullsegment()
- turtle.up()
- output()
- buildfullsegment()
- turtle.down()
- output()
- turtle.turnRight()
- placestairs()
- end
- function confirm()
- clear()
- x,y=term.getSize()
- for i=1,x-1 do
- write("-")
- end
- print("Stairs v0.1a by m3Zz")
- print("")
- print("Alright, building a "..(height*2).." blocks high staircase!")
- for i=1,x-1 do
- write("-")
- end
- sleep(1)
- end
- function getinfo()
- clear()
- x,y=term.getSize()
- for i=1,x-1 do
- write("-")
- end
- print("Stairs v0.1a by m3Zz")
- print("")
- print("How high shall the staircase be?")
- for i=1,x-1 do
- write("-")
- end
- print("")
- height=read()
- confirm()
- end
- function output()
- clear()
- x,y=term.getSize()
- for i=1,x-1 do
- write("-")
- end
- print("Stairs v0.1a by m3Zz")
- print("")
- print("Fuel Level: "..turtle.getFuelLevel())
- print("Building...")
- for i=1,x-1 do
- write("-")
- end
- end
- function setup()
- clear()
- getinfo()
- end
- function main()
- clear()
- output()
- for i = 1,height do
- staircase()
- end
- start()
- end
- function start()
- setup()
- main()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement