SHOW:
|
|
- or go back to the newest paste.
1 | term.clear() | |
2 | term.setCursorPos(1,1) | |
3 | ||
4 | repeat | |
5 | print("Tunnellänge (/2) : ") | |
6 | tlength=read() | |
7 | until tlength % 2 == 0 | |
8 | repeat | |
9 | print("Fakelabstand (/2) : ") | |
10 | fabstand=read() | |
11 | until fabstand % 2 == 0 | |
12 | ||
13 | term.clear() | |
14 | term.setCursorPos(1,1) | |
15 | ||
16 | tstoff=turtle.getItemCount(16) | |
17 | fcount=turtle.getItemCount(15) | |
18 | bcount=turtle.getItemCount(14) | |
19 | baseLayerx,baseLayery,baseLayerz = gps.locate() | |
20 | orientation="front" | |
21 | s13count=0 | |
22 | fabstandcount=fabstand | |
23 | ||
24 | term.setCursorPos(1,1) | |
25 | print("Slot 13 Count : " .. s13count) | |
26 | print("Treibstoff in Slot 16 : " .. tstoff) | |
27 | print("Fackeln in Slot 15 : " .. fcount) | |
28 | print("Kisten in Slot 14 : " .. bcount) | |
29 | term.setCursorPos(1,5) | |
30 | print("Treibstofflevel : ") | |
31 | print("Fakelweg : " .. fabstand) | |
32 | print("Tunelweg : " .. tlength) | |
33 | term.setCursorPos(1,8) | |
34 | print("Abgebautes Material : ") | |
35 | ||
36 | function checkfuel() | |
37 | term.setCursorPos(1,5) | |
38 | print("Treibstofflevel : " .. turtle.getFuelLevel()) | |
39 | if turtle.getFuelLevel() <= 0.25 then | |
40 | if turtle.getItemCount(16) > 0 then | |
41 | turtle.select(16) | |
42 | turtle.refuel(1) | |
43 | end | |
44 | end | |
45 | end | |
46 | ||
47 | function gotoBaseLayer() | |
48 | local actlayerx,actlayery,actlayerz = gps.locate() | |
49 | while actlayery>baseLayery do | |
50 | turtle.down() | |
51 | local actlayerx,actlayery,actlayerz = gps.locate() | |
52 | end | |
53 | end | |
54 | ||
55 | function goup() | |
56 | checkfuel() | |
57 | if not turtle.up() then | |
58 | if not turtle.up() then | |
59 | if not turtle.up() then | |
60 | if not turtle.up() then | |
61 | gotoBaseLayer() | |
62 | end | |
63 | end | |
64 | end | |
65 | end | |
66 | end | |
67 | ||
68 | function godown() | |
69 | checkfuel() | |
70 | if not turtle.down() then | |
71 | if not turtle.down() then | |
72 | if not turtle.down() then | |
73 | exit() | |
74 | end | |
75 | end | |
76 | end | |
77 | end | |
78 | ||
79 | function breakplane() | |
80 | turtle.dig() | |
81 | turtle.forward() | |
82 | turtle.turnLeft() | |
83 | turtle.dig() | |
84 | turtle.turnRight() | |
85 | turtle.turnRight() | |
86 | turtle.dig() | |
87 | turtle.turnLeft() | |
88 | turtle.digUp() | |
89 | goup() | |
90 | turtle.turnLeft() | |
91 | turtle.dig() | |
92 | turtle.turnRight() | |
93 | turtle.turnRight() | |
94 | turtle.dig() | |
95 | turtle.turnLeft() | |
96 | turtle.digUp() | |
97 | goup() | |
98 | turtle.turnLeft() | |
99 | turtle.dig() | |
100 | turtle.turnRight() | |
101 | turtle.turnRight() | |
102 | turtle.dig() | |
103 | turtle.turnLeft() | |
104 | godown() | |
105 | godown() | |
106 | end | |
107 | ||
108 | function placetorch() | |
109 | if fabstandcount == 0 then | |
110 | turtle.turnLeft() | |
111 | goup() | |
112 | goup() | |
113 | turtle.select(15) | |
114 | turtle.place() | |
115 | godown() | |
116 | godown() | |
117 | turtle.turnRight() | |
118 | fabstandcount = fabstand | |
119 | else | |
120 | fabstandcount = fabstandcount - 1 | |
121 | end | |
122 | end | |
123 | ||
124 | function checkfullinventory() | |
125 | slot13count = turtle.getItemCount(13) | |
126 | term.setCursorPos(1,1) | |
127 | print(" Slot 13 : " .. slot13count) | |
128 | if slot13count > 1 then | |
129 | turtle.back() | |
130 | turtle.back() | |
131 | turtle.turnLeft() | |
132 | turtle.select(14) | |
133 | turtle.place() | |
134 | for i=13,1,-1 do | |
135 | turtle.select(i) | |
136 | turtle.drop() | |
137 | end | |
138 | turtle.turnRight() | |
139 | turtle.forward() | |
140 | turtle.forward() | |
141 | - | |
141 | + | |
142 | end | |
143 | ||
144 | ||
145 | function starttunnel() | |
146 | repeat | |
147 | blockinFront, blockdata=turtle.inspect() | |
148 | term.setCursorPos(1,6) | |
149 | print("Fakelweg : " .. fabstandcount .. "/" .. fabstand) | |
150 | print("Tunnelweg : " .. tlength) | |
151 | term.setCursorPos(1,8) | |
152 | print("Block in front : " .. blockdata.name) | |
153 | checkfuel() | |
154 | breakplane() | |
155 | checkfullinventory() | |
156 | placetorch() | |
157 | tlength=tlength-1 | |
158 | until tlength <= 0 | |
159 | end | |
160 | ||
161 | if tstoff < 1 then | |
162 | term.clear() | |
163 | term.setCursorPos(1,1) | |
164 | print("Ohne Treibstoff geht es nicht ! Bitte in Slot 16 laden") | |
165 | else | |
166 | print("Begin") | |
167 | starttunnel() | |
168 | end | |
169 |