Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------functions---------------
- ---------------------------------------
- function percent(current,volume)
- current=current+1
- percent=current/volume*100
- term.clear()
- print("current advencement:", percent,"%")
- return current
- end
- function height(h,height)
- print(h)
- if h==1 then
- if turtle.detectDown()==false then
- turtle.placeDown()
- end
- elseif h==height then
- if turtle.detectUp()==false then
- turtle.placeUp()
- end
- end
- end
- function OOF() --out of fuel
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print(" Out of fuel!")
- print(" Place fuel in slot 16")
- turtle.select(16)
- if turtle.getItemCount()>0 then
- prev=turtle.getFuelLevel()
- turtle.refuel(1)
- print("Fuel level:", turtle.getFuelLevel()/(1000).."k")
- if turtle.getItemCount()==0 or turtle.getFuelLevel()>=100000-(turtle.getFuelLevel()-prev) then
- break
- end
- end
- sleep(0.01)
- end
- end
- --------------main program-------------
- ---------------------------------------
- --terminal clear
- term.clear()
- --variables
- print("enter lenght:")
- lenght=tonumber(read())
- print("enter width:")
- width=tonumber(read())
- print("enter height:")
- height=tonumber(read())
- volume=lenght*width*height
- current=0
- for l=1,lenght do
- turtle.select(16)
- turtle.drop(turtle.getItemCount())
- if turtle.getFuelLevel()<((height*width)+height+width) then
- OOF() --out off fuel
- end
- turtle.dig()
- current=percent(current,volume)
- turtle.forward()
- turtle.turnRight()
- if turtle.detect()==false then
- turtle.place()
- end
- for i=1,height do
- h=i
- for w=1,width-1 do
- turtle.dig()
- current=percent(current,volume)
- turtle.forward()
- height(i)
- end
- if turtle.detect()==false then
- turtle.place()
- end
- if i~=height then
- turtle.digUp()
- current=percent(current,volume)
- turtle.up()
- if turtle.detect()==false then
- turtle.place()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- if height%2==0 then
- for i=1, height do
- turtle.down()
- end
- else
- for i=1, height do
- turtle.down()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,witdh-1 do
- turtle.forward()
- end
- end
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement