SHOW:
|
|
- or go back to the newest paste.
| 1 | x=0 | |
| 2 | refuelNeeded=true | |
| 3 | ||
| 4 | local function start() | |
| 5 | turtle.select(1) | |
| 6 | if turtle.compareTo(16)==false then | |
| 7 | print("Bitte sicherstellen, dass Saplings in Slot 1 und Vergleichssapling in Slot 16 liegen und [Enter] druecken.")
| |
| 8 | io.read() | |
| 9 | return | |
| 10 | - | if turtle.getItemCount(2)<1 then |
| 10 | + | |
| 11 | - | print("Bitte mindestens einen Vergleichsbaumstamm in Slot 2 legen und [Enter] druecken.")
|
| 11 | + | |
| 12 | ||
| 13 | local function refuel() | |
| 14 | if (turtle.getFuelLevel()<100 and refuelNeeded==true) then | |
| 15 | turtle.select(2) | |
| 16 | turtle.refuel(turtle.getItemCount(2)) | |
| 17 | turtle.select(1) | |
| 18 | end | |
| 19 | end | |
| 20 | ||
| 21 | local function plant() | |
| 22 | if (turtle.getFuelLevel()<30 and refuelNeeded==true) then | |
| 23 | print("Kein Treibstoff mehr vorhanden. Bitte Treibstoff in Slot 2 geben und eine Taste druecken.")
| |
| 24 | end | |
| 25 | turtle.select(1) | |
| 26 | if turtle.getItemCount(1)<=1 then | |
| 27 | print("Bitte Saplings in Slot 1 nachfuellen.")
| |
| 28 | io.read() | |
| 29 | - | if turtle.getItemCount(2)<1 then |
| 29 | + | |
| 30 | - | print("Bitte mindestens einen Vergleichsbaumstamm in Slot 2 legen und [Enter] druecken.")
|
| 30 | + | |
| 31 | - | io.read() |
| 31 | + | turtle.forward() |
| 32 | - | return |
| 32 | + | |
| 33 | turtle.turnRight() | |
| 34 | - | while turtle.compare()==false do |
| 34 | + | turtle.forward() |
| 35 | - | sleep(2) |
| 35 | + | |
| 36 | turtle.place() | |
| 37 | turtle.turnLeft() | |
| 38 | turtle.turnLeft() | |
| 39 | turtle.forward() | |
| 40 | turtle.turnRight() | |
| 41 | - | while turtle.compare()==true do |
| 41 | + | |
| 42 | turtle.place() | |
| 43 | turtle.turnLeft() | |
| 44 | turtle.forward() | |
| 45 | turtle.turnRight() | |
| 46 | - | while turtle.detectDown()==false do |
| 46 | + | turtle.place() |
| 47 | end | |
| 48 | ||
| 49 | local function wait() | |
| 50 | turtle.select(1) | |
| 51 | turtle.up() | |
| 52 | while turtle.detect()==false do | |
| 53 | sleep(1) | |
| 54 | end | |
| 55 | end | |
| 56 | ||
| 57 | local function tree() | |
| 58 | turtle.select(2) | |
| 59 | - | turtle.drop(turtle.getItemCount(2)-1) |
| 59 | + | turtle.down() |
| 60 | turtle.dig() | |
| 61 | turtle.forward() | |
| 62 | local h=0 | |
| 63 | while turtle.detectUp()==true do | |
| 64 | turtle.dig() | |
| 65 | turtle.digUp() | |
| 66 | turtle.up() | |
| 67 | h=h+1 | |
| 68 | ||
| 69 | end | |
| 70 | refuel() | |
| 71 | turtle.turnRight() | |
| 72 | turtle.dig() | |
| 73 | turtle.forward() | |
| 74 | turtle.turnLeft() | |
| 75 | for i=h, 1, -1 do | |
| 76 | turtle.dig() | |
| 77 | turtle.digDown() | |
| 78 | turtle.down() | |
| 79 | end | |
| 80 | turtle.dig() | |
| 81 | h=nil | |
| 82 | turtle.turnLeft() | |
| 83 | turtle.turnLeft() | |
| 84 | turtle.forward() | |
| 85 | turtle.turnRight() | |
| 86 | turtle.forward() | |
| 87 | turtle.turnRight() | |
| 88 | x=x+1 | |
| 89 | term.clear() | |
| 90 | term.setCursorPos(1, 1) | |
| 91 | print("Es wurden bisher ", x, " Baeume gefaellt.")
| |
| 92 | end | |
| 93 | ||
| 94 | local function drop() | |
| 95 | refuel() | |
| 96 | turtle.turnLeft() | |
| 97 | turtle.select(2) | |
| 98 | if turtle.getItemCount(2)>1 then | |
| 99 | turtle.drop() | |
| 100 | end | |
| 101 | for i=3, 15, 1 do | |
| 102 | turtle.select(i) | |
| 103 | if turtle.getItemCount(i)>0 then | |
| 104 | turtle.drop() | |
| 105 | end | |
| 106 | ||
| 107 | end | |
| 108 | turtle.turnRight() | |
| 109 | end | |
| 110 | ||
| 111 | -------------------------- | |
| 112 | ||
| 113 | start() | |
| 114 | ||
| 115 | while true do | |
| 116 | plant() | |
| 117 | drop() | |
| 118 | wait() | |
| 119 | tree() | |
| 120 | end |