SHOW:
|
|
- or go back to the newest paste.
1 | -- Turtle utility program to cover holes or build floors in pits (I make pits) | |
2 | -- v1.0 20140803a first draft, room for improvement | |
3 | -- floor material in second slot | |
4 | -- position on left side of room | |
5 | ||
6 | flip=0 | |
7 | slot=3 | |
8 | turtle.select(2) | |
9 | turtle.forward() | |
10 | ||
11 | while not turtle.detectDown() do | |
12 | while turtle.getItemCount(2)<1 and slot<16 do | |
13 | turtle.select(slot) | |
14 | turtle.transferTo(2) | |
15 | slot=slot+1 | |
16 | turtle.select(2) | |
17 | end | |
18 | ||
19 | -- if turtle runs out, it should have x,y | |
20 | -- offset to return to start at this point | |
21 | ||
22 | turtle.placeDown() | |
23 | if turtle.detect() then | |
24 | turtle.turnRight() | |
25 | end | |
26 | turtle.forward() | |
27 | if turtle.detectDown() then | |
28 | if flip==0 then | |
29 | turtle.turnRight() | |
30 | turtle.forward() | |
31 | turtle.turnRight() | |
32 | turtle.forward() | |
33 | flip=1 | |
34 | elseif flip==1 then | |
35 | turtle.turnLeft() | |
36 | turtle.forward() | |
37 | turtle.turnLeft() | |
38 | turtle.forward() | |
39 | flip=0 | |
40 | end | |
41 | end | |
42 | end |