Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length = 0
- local width = 0
- local depth = 0
- local gone = 0
- local lr = 0
- local lengthgone = 0
- local chest = turtle.getItemCount(3)
- local function CheckItems()
- if turtle.getItemCount(16)>0 then -- If slot 16 in turtle has item slot 5 to 16 will go to chest
- if chest > 0 then
- turtle.select(3)
- turtle.placeUp()
- chest = chest - 1
- for slot = 4, 16 do
- turtle.select(slot)
- turtle.dropUp()
- sleep(1.5)
- end
- turtle.select(4)
- print("emptied storage")
- else
- print("turtle run out of chest")
- print("press enter after refilling them in slot 3")
- input5 = io.read()
- chest = turtle.getItemCount(3)
- end
- end
- end
- local function DigLength()
- repeat
- while turtle.detect() == true do
- turtle.dig()
- end
- turtle.forward()
- lengthgone = lengthgone+1
- CheckItems()
- until lengthgone == length
- lengthgone = 0
- if lr == 0 then
- lr = 1
- else
- lr = 0
- end
- end
- local function down()
- if turtle.detectDown() == true then turtle.digDown() end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.down()
- depth = depth-1
- if lr == 0 then
- lr = 1
- else
- lr = 0
- end
- end
- local function Check()
- if turtle.getFuelLevel() == "unlimited" then
- print("NO NEED FOR FUEL")
- elseif turtle.getFuelLevel() < 1000 then
- turtle.refuel()
- end
- end
- -- start from here
- print("What Length shall the house be?")
- input = io.read()
- length = tonumber(input)
- length = length-1
- print("What Width shall the house be?")
- input2 = io.read()
- width = tonumber(input2)
- width = width - 1
- print("What Depth shall the house be?")
- input3 = io.read()
- depth = tonumber(input3)
- print("First turn left or right? 0=right, 1=left")
- input4 = io.read()
- lr = tonumber(input4)
- print("place fuel in slots 1 and 2, chests in slot 3")
- Check()
- repeat
- DigLength()
- if gone == width then
- if depth > 1 then
- gone = 0
- down()
- print("finished level")
- else
- depth = depth-1
- print("turtle has finished")
- end
- elseif lr == 0 then
- turtle.turnLeft()
- if turtle.detect() == true then turtle.dig() end
- turtle.forward()
- turtle.turnLeft()
- gone = gone+1
- elseif lr == 1 then
- turtle.turnRight()
- if turtle.detect() == true then turtle.dig() end
- turtle.forward()
- turtle.turnRight()
- gone = gone+1
- end
- Check()
- until depth == 0
- turtle.turnLeft()
- turtle.turnLeft()
- length = 0
- width = 0
- depth = 0
- gone = 0
- lr = 0
- lengthgone = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement