SHOW:
|
|
- or go back to the newest paste.
| 1 | print("Test Loaded")
| |
| 2 | function f(loc) | |
| 3 | while not turtle[loc]() do | |
| 4 | sleep(0.5) | |
| 5 | end | |
| 6 | end | |
| 7 | print("Test1")
| |
| 8 | function up() f("up") end
| |
| 9 | function down() f("down") end
| |
| 10 | function fw() f("forward") end
| |
| 11 | function back() f("back") end
| |
| 12 | function l() f("turnLeft") end
| |
| 13 | function r() f("turnRight") end
| |
| 14 | function d() turtle.dig() end | |
| 15 | function du() turtle.digUp() end | |
| 16 | function dd() turtle.digDown() end | |
| 17 | function c(x) | |
| 18 | for i=1,x do d() fw() du() dd() end | |
| 19 | end | |
| 20 | print("test2")
| |
| 21 | function reFuelTurt() | |
| 22 | ||
| 23 | if turtle.getFuelLevel() <= 50 then | |
| 24 | turtle.select(2) | |
| 25 | turtle.refuel(4) | |
| 26 | end | |
| 27 | end | |
| 28 | ||
| 29 | function cutTree() | |
| 30 | print("Tree Cut")
| |
| 31 | hi = 0 | |
| 32 | ||
| 33 | while not turtle.detectUp() do | |
| 34 | up() hi=hi+1 | |
| 35 | end | |
| 36 | ||
| 37 | du() up() du() up() du() l() l() | |
| 38 | c(1) r() c(2) r() c(4) r() c(4) r() | |
| 39 | c(4) r() c(1) r() c(3) l() c(2) l() | |
| 40 | c(2) back() l() c(1) l() down() | |
| 41 | ||
| 42 | for r=1,hi do dd() down() end | |
| 43 | ||
| 44 | dd() turtle.placeDown() back() | |
| 45 | down() down() | |
| 46 | ||
| 47 | print(hi) | |
| 48 | end | |
| 49 | ||
| 50 | - | function scanTree() end |
| 50 | + | function scanTree() |
| 51 | if not turtle.detectDown() then | |
| 52 | r() fw() fw() | |
| 53 | ||
| 54 | for k=3,15 do | |
| 55 | turtle.select(k) | |
| 56 | turtle.drop() | |
| 57 | end | |
| 58 | ||
| 59 | turtle.select(1) | |
| 60 | back() back() | |
| 61 | l() | |
| 62 | end | |
| 63 | ||
| 64 | up() sleep(1) turtle.select(16) turtle.place() turtle.select(1) | |
| 65 | ||
| 66 | if turtle.detect() then | |
| 67 | up() | |
| 68 | if turtle.detect() then | |
| 69 | down() | |
| 70 | cutTree() | |
| 71 | else | |
| 72 | down() | |
| 73 | down() | |
| 74 | end | |
| 75 | else | |
| 76 | turtle.select(1) turtle.place() | |
| 77 | down() | |
| 78 | end | |
| 79 | ||
| 80 | l() if turtle.detect() then | |
| 81 | back() r() fw() e() fw() | |
| 82 | fw() fw() | |
| 83 | else | |
| 84 | l() l() | |
| 85 | ||
| 86 | if turtle.detect() then | |
| 87 | back() l() fw() l() fw() | |
| 88 | fw() fw() | |
| 89 | else | |
| 90 | fw() l() fw() fw() l() fw() r() fw() | |
| 91 | fw() fw() | |
| 92 | end | |
| 93 | end | |
| 94 | end |