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