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