Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local torchDistance = 0 -- Distanz für Fackel
- local fuelLevel = turtle.getFuelLevel() --FuelLevel
- local fuelMaterial = turtle.getItemCount(1) -- Brennstoff
- local torch = turtle.getItemCount(2) -- Anzahl Fackeln
- local chests = turtle.getItemCount(3) --Anzahl Chests
- local placeBlock = turtle.getItemCount(4) -- Bloecke die platziert werden wenn unter der Turtle nichts ist
- function ivFull()
- local full = true
- for i = 5,16 do
- if turtle.getItemCount(i) == 0 then
- full = false
- end
- end
- return full
- end
- function chestPlacement()
- 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(2)
- turtle.digDown()
- turtle.placeDown()
- chest = chest - 1
- for slot = 5, 16 do
- turtle.select(slot)
- turtle.dropDown()
- sleep(1.5)
- end
- turtle.select(5)
- mine()
- else
- print("turtle run out of chest")
- os.shutdown()
- end
- end
- end
- function torchPlacement()
- if torchDistance == 8 then
- turtle.select(2)
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- torchDistance = torchDistance - 8
- end
- end
- function fuelLevel()
- if turtle.getFuelLevel() < 100 then
- turtle.refuel(1)
- end
- end
- function mine()
- fuelLevel()
- while ivFull() == false do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.up()
- turtle.dig()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.down()
- turtle.dig()
- turtle.turnLeft()
- torchDistance = torchDistance + 1
- torchPlacement()
- else
- turtle.forward()
- torchDistance = torchDistance + 1
- torchPlacement()
- end
- if turtle.detectDown() == false then
- turtle.select(3)
- turtle.placeDown()
- end
- end
- chestPlacement()
- end
- function check()
- local error = 0
- if torch == 0 then
- print("Im Slot 2 fehlen Fackeln")
- error = error + 1
- else
- print("Fackeln sind vorhanden")
- end
- if fuelMaterial == 0 then
- print("Im Slot 1 fehlt Brennstoff")
- error = error + 1
- else
- print("Brennbares Material vorhanden")
- end
- if chests == 0 then
- print("Es fehlen Kisten")
- error = error + 1
- else
- print("Kisten vorhanden")
- end
- if error == 0 then
- return true
- else
- return false
- end
- end
- function Start()
- if check() == true then
- mine()
- else
- print("Slots ueberpruefen")
- end
- end
- Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement