SHOW:
|
|
- or go back to the newest paste.
1 | --pastebin get 02QNcL4m tree | |
2 | --pastebin run 02QNcL4m | |
3 | - | print("Hurde's Bomen Program") |
3 | + | |
4 | term.clear() | |
5 | term.setCursorPos(1,1) | |
6 | - | turtle.select(1) |
6 | + | print("Hurde's Tree Program") |
7 | - | if turtle.compare() then |
7 | + | print("modded by LJack2k") |
8 | - | else |
8 | + | print("") |
9 | - | turtle.place() |
9 | + | print("Press ENTER to stop") |
10 | print("") | |
11 | print("First slot: The sapling") | |
12 | print("Second slot: bonemeal") | |
13 | print("Fourth slot: The wood type you want") | |
14 | - | turtle.select(4) |
14 | + | print("Fifth till sixteen: fuel") |
15 | - | if turtle.compare() then |
15 | + | |
16 | - | else |
16 | + | |
17 | - | turtle.select(2) |
17 | + | turtle.select(1) |
18 | - | turtle.place() |
18 | + | if not turtle.compare() then |
19 | turtle.place() | |
20 | end | |
21 | end | |
22 | ||
23 | - | while turtle.detectUp() do |
23 | + | |
24 | - | turtle.digUp() |
24 | + | turtle.select(4) |
25 | - | turtle.up() |
25 | + | if not turtle.compare() then |
26 | turtle.select(2) | |
27 | - | while not turtle.detectDown() do |
27 | + | turtle.place() |
28 | - | turtle.down() |
28 | + | end |
29 | end | |
30 | - | turtle.back() |
30 | + | |
31 | - | os.reboot() |
31 | + | |
32 | while turtle.detectUp() do | |
33 | turtle.digUp() | |
34 | - | plant() |
34 | + | turtle.up() |
35 | - | turtle.select(4) |
35 | + | end |
36 | - | if turtle.compare() then |
36 | + | while not turtle.detectDown() do |
37 | - | turtle.dig() |
37 | + | turtle.down() |
38 | - | turtle.forward() |
38 | + | end |
39 | - | hak() |
39 | + | turtle.back() |
40 | - | else |
40 | + | |
41 | - | grow() |
41 | + | |
42 | - | shell.run("startup") |
42 | + | function fuel() |
43 | - | end |
43 | + | if turtle.getFuelLevel() < 100 then |
44 | for i = 5, 16 do -- loop through the slots | |
45 | turtle.select(i) -- change to the slot | |
46 | if turtle.refuel(0) then -- if it's valid fuel | |
47 | local halfStack = math.ceil(turtle.getItemCount(i)/2) -- work out half of the amount of fuel in the slot | |
48 | turtle.refuel(halfStack) -- consume half the stack as fuel | |
49 | end | |
50 | end | |
51 | end | |
52 | end | |
53 | ||
54 | function program() | |
55 | while true do | |
56 | fuel() | |
57 | plant() | |
58 | turtle.select(4) | |
59 | if turtle.compare() then | |
60 | turtle.dig() | |
61 | turtle.forward() | |
62 | hak() | |
63 | else | |
64 | grow() | |
65 | end | |
66 | sleep(0.5) | |
67 | end | |
68 | end | |
69 | ||
70 | function exitProgram() | |
71 | repeat | |
72 | local ev, key = os.pullEvent('key') | |
73 | until key == keys.enter | |
74 | end | |
75 | ||
76 | parallel.waitForAny(program, exitProgram) |