SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local torchDistance = 0 |
| 1 | + | local torchDistance = 0 -- Distanz für Fackel |
| 2 | - | local fuelLevel = turtle.getFuelLevel() |
| 2 | + | local fuelLevel = turtle.getFuelLevel() --FuelLevel |
| 3 | - | local chests = turtle.getItemCount(4) |
| 3 | + | local chests = turtle.getItemCount(4) --Anzahl Chests |
| 4 | ||
| 5 | function ivFull() | |
| 6 | - | local full = true |
| 6 | + | local full = true |
| 7 | - | for i = 4,16 do |
| 7 | + | for i = 5,16 do |
| 8 | - | if turtle.getItemCount(i) == 0 then |
| 8 | + | if turtle.getItemCount(i) == 0 then |
| 9 | - | full = false |
| 9 | + | full = false |
| 10 | end | |
| 11 | end | |
| 12 | - | return full |
| 12 | + | return full |
| 13 | end | |
| 14 | ||
| 15 | function mine() | |
| 16 | - | if turtle.getFuelLevel() > 100 then |
| 16 | + | if turtle.getFuelLevel() < 100 then |
| 17 | turtle.refuel(1) | |
| 18 | - | turtle.refuel(1) |
| 18 | + | end |
| 19 | end | |
| 20 | ||
| 21 | while ivFull() == false do | |
| 22 | ||
| 23 | - | if torchDistance == 8 then |
| 23 | + | if torchDistance == 8 then |
| 24 | turtle.select(2) | |
| 25 | - | turtle.select(2) |
| 25 | + | turtle.turnRight() |
| 26 | - | turtle.turnRight() |
| 26 | + | turtle.turnRight() |
| 27 | - | turtle.turnRight() |
| 27 | + | turtle.place() |
| 28 | - | turtle.place() |
| 28 | + | turtle.turnLeft() |
| 29 | - | turtle.turnLeft() |
| 29 | + | turtle.turnLeft() |
| 30 | - | turtle.turnLeft() |
| 30 | + | torchDistance = 0 |
| 31 | - | torchDistance = 0 |
| 31 | + | end |
| 32 | ||
| 33 | if turtle.detectDown() == false then | |
| 34 | - | if turtle.detectDown() == false then |
| 34 | + | turtle.select(3) |
| 35 | - | turtle.select(3) |
| 35 | + | turtle.placeDown() |
| 36 | - | turtle.placeDown() |
| 36 | + | end |
| 37 | ||
| 38 | if turtle.detect() then | |
| 39 | - | if turtle.detect() then |
| 39 | + | turtle.dig() |
| 40 | - | turtle.dig() |
| 40 | + | turtle.forward() |
| 41 | - | turtle.forward() |
| 41 | + | turtle.digUp() |
| 42 | - | turtle.digUp() |
| 42 | + | turtle.turnLeft() |
| 43 | - | turtle.turnLeft() |
| 43 | + | turtle.dig() |
| 44 | - | turtle.dig() |
| 44 | + | turtle.up() |
| 45 | - | turtle.up() |
| 45 | + | turtle.dig() |
| 46 | - | turtle.dig() |
| 46 | + | turtle.turnRight() |
| 47 | - | turtle.turnRight() |
| 47 | + | turtle.turnRight() |
| 48 | - | turtle.turnRight() |
| 48 | + | turtle.dig() |
| 49 | - | turtle.dig() |
| 49 | + | turtle.down() |
| 50 | - | turtle.down() |
| 50 | + | turtle.dig() |
| 51 | - | turtle.dig() |
| 51 | + | turtle.turnLeft() |
| 52 | - | turtle.turnLeft() |
| 52 | + | torchDistance = torchDistance + 1 |
| 53 | - | torchDistance = torchDistance + 1 |
| 53 | + | else |
| 54 | turtle.forward() | |
| 55 | - | turtle.forward() |
| 55 | + | torchDistance = torchDistance + 1 |
| 56 | - | torchDistance = torchDistance + 1 |
| 56 | + | end |
| 57 | ||
| 58 | if ivFull() == true then | |
| 59 | - | if ivFull() == true then |
| 59 | + | if chests > 0 then |
| 60 | - | if chests > 0 then |
| 60 | + | turtle.select(4) |
| 61 | - | turtle.select(4) |
| 61 | + | turtle.digDown() |
| 62 | - | turtle.digDown() |
| 62 | + | turtle.placeDown() |
| 63 | - | turtle.placeDown() |
| 63 | + | chest = chest - 1 |
| 64 | - | chest = chest - 1 |
| 64 | + | for slot = 5,16 do |
| 65 | - | for slot = 5,16 do |
| 65 | + | turtle.select(slot) |
| 66 | - | turtle.select(slot) |
| 66 | + | turtle.dropDown() |
| 67 | - | turtle.dropDown() |
| 67 | + | sleep(1.5) |
| 68 | - | sleep(1.5) |
| 68 | + | end |
| 69 | turtle.select(5) | |
| 70 | - | turtle.select(5) |
| 70 | + | else |
| 71 | print("Keine Kisten vorhanden")
| |
| 72 | - | print("Keine Kisten vorhanden")
|
| 72 | + | os.shutdown() |
| 73 | - | os.shutdown() |
| 73 | + | end |
| 74 | end | |
| 75 | end | |
| 76 | ||
| 77 | end | |
| 78 | ||
| 79 | function check() | |
| 80 | local torch = turtle.getItemCount(2) | |
| 81 | local fuel = turtle.getItemCount(1) | |
| 82 | local error = 0 | |
| 83 | ||
| 84 | if torch == 0 then | |
| 85 | print("Im Slot 2 fehlen Fackeln")
| |
| 86 | - | print("Im Slot 2 fehlen Fackeln")
|
| 86 | + | error = error + 1 |
| 87 | - | error = error + 1 |
| 87 | + | |
| 88 | else | |
| 89 | print("Fackeln sind vorhanden")
| |
| 90 | - | print("Fackeln sind vorhanden")
|
| 90 | + | |
| 91 | ||
| 92 | if fuel == 0 then | |
| 93 | print("Es fehlt brennbares Material")
| |
| 94 | - | print("Es fehlt brennbares Material")
|
| 94 | + | error = error + 1 |
| 95 | - | error = error + 1 |
| 95 | + | |
| 96 | print("Brennbares Material vorhanden")
| |
| 97 | end | |
| 98 | - | print("Brennbares Material vorhanden")
|
| 98 | + | |
| 99 | if error == 0 then | |
| 100 | return true | |
| 101 | - | return true |
| 101 | + | |
| 102 | return false | |
| 103 | - | return false |
| 103 | + | |
| 104 | ||
| 105 | end | |
| 106 | ||
| 107 | - | if check() == true then |
| 107 | + | |
| 108 | - | mine() |
| 108 | + | if check() == true then |
| 109 | mine() | |
| 110 | - | print("Slots ueberpruefen")
|
| 110 | + | else |
| 111 | print("Slots ueberpruefen")
| |
| 112 | end | |
| 113 | - | check() |
| 113 | + | |
| 114 | ||
| 115 | Start() |