SHOW:
|
|
- or go back to the newest paste.
1 | -- Script to plant trees in minecraft world | |
2 | ||
3 | tiempoAgua=150 | |
4 | tiempoAgua2=120 | |
5 | shell.run("clear") | |
6 | os.loadAPI("tortu") | |
7 | pimpoLleno = false | |
8 | print("Please put log in slot 1 and sapplings in slot 16") | |
9 | print("Number of files to plant?") | |
10 | - | local numFilas = io.read() |
10 | + | local numFilas = tonumber(io.read()) |
11 | numFilas = numFilas + 0 | |
12 | print("Number of columns to plant?") | |
13 | local numCols = tonumber(io.read()) | |
14 | - | for i=1,5 do |
14 | + | numCols = numCols +0 |
15 | ||
16 | ||
17 | ||
18 | -- A la posicion | |
19 | turtle.turnLeft() | |
20 | for i=1,7 do | |
21 | tortu.avanza() | |
22 | - | turtle.forward() |
22 | + | |
23 | - | for i=1,numFilas-1 do |
23 | + | |
24 | for i=1,12 do | |
25 | - | turtle.select(1) |
25 | + | |
26 | - | if turtle.compare() then |
26 | + | |
27 | - | tortu.tala() |
27 | + | for j=1, numCols do |
28 | - | -- turtle.select(16) turtle.place() |
28 | + | for i=1,numFilas do |
29 | if(i == 1) then | |
30 | else | |
31 | - | for i=1,6 do |
31 | + | tortu.avanza(6) |
32 | end | |
33 | turtle.turnRight() | |
34 | turtle.select(1) | |
35 | if turtle.compare() then | |
36 | tortu.tala() | |
37 | - | if turtle.compare(1) then |
37 | + | turtle.select(16) turtle.place() |
38 | - | tortu.tala() |
38 | + | end |
39 | - | -- turtle.select(16) turtle.place() |
39 | + | turtle.turnLeft() |
40 | print("Terminada fila "..i.." columna "..j) | |
41 | end | |
42 | - | turtle.forward() |
42 | + | |
43 | -- Recoge pimpollos | |
44 | - | for i=1,8 do |
44 | + | tortu.avanza(2) |
45 | turtle.turnRight() | |
46 | tortu.avanza(3) | |
47 | turtle.turnRight() | |
48 | - | turtle.forward() |
48 | + | tortu.suca(5,numFilas*6-1) |
49 | - | for i=1,numFilas do |
49 | + | |
50 | tortu.avanza(3) | |
51 | - | turtle.select(1) |
51 | + | |
52 | - | if turtle.compare() then |
52 | + | tortu.avanza(2) |
53 | - | tortu.tala() turtle.select(16) |
53 | + | |
54 | - | -- turtle.place() |
54 | + | |
55 | - | end |
55 | + | |
56 | -- Giro entre columnas | |
57 | - | for i=1,6 do |
57 | + | |
58 | if(j<numCols) then | |
59 | tortu.avanza() | |
60 | if(j%2 == 0) then | |
61 | turtle.turnLeft() | |
62 | - | turtle.forward() |
62 | + | tortu.avanza(4) |
63 | turtle.turnLeft() | |
64 | - | function chupamelamingadominga() |
64 | + | else |
65 | - | tortu.avanza(4) |
65 | + | turtle.turnRight() |
66 | tortu.avanza(8) | |
67 | - | tortu.avanza(8) |
67 | + | turtle.turnRight() |
68 | end | |
69 | - | tortu.suca(11,numFilas*6-1) |
69 | + | |
70 | - | tortu.avanza(4) |
70 | + | |
71 | end | |
72 | ||
73 | -- Volver a la posición de inicio por una ruta segura. | |
74 | if(numCols %2 == 0) then | |
75 | tortu.avanza() | |
76 | - | redstone.setOutput("front",true) |
76 | + | turtle.turnRight() |
77 | - | tortu.sube(7) |
77 | + | tortu.avanza(6*(numCols-1) + 2) |
78 | turtle.turnLeft() | |
79 | - | tortu.avanza(3) |
79 | + | tortu.avanza(6*(1+1) - 1) |
80 | else | |
81 | tortu.avanza() | |
82 | - | os.sleep(tiempoAgua) |
82 | + | turtle.turnLeft() |
83 | - | turtle.back() |
83 | + | tortu.avanza(6*(numCols-1)) |
84 | - | os.sleep(20) |
84 | + | turtle.turnLeft() |
85 | - | tortu.sube(2) |
85 | + | tortu.avanza(6*(numFilas+1) +1) |
86 | - | os.sleep(tiempoAgua2) |
86 | + | |
87 | - | turtle.back() |
87 | + | |
88 | tortu.avanza(7) | |
89 | - | tortu.avanza(3) |
89 | + | |
90 | -- Inventario | |
91 | - | tortu.baja(9) |
91 | + | tronco = turtle.getItemDetail(1) |
92 | - | redstone.setOutput("front",false) |
92 | + | pimpollo = turtle.getItemDetail(16) |
93 | ||
94 | turtle.turnRight() | |
95 | tortu.avanza(2) | |
96 | turtle.turnLeft() | |
97 | turtle.turnLeft() | |
98 | ||
99 | turtle.select(1) | |
100 | item = turtle.getItemDetail(1) | |
101 | turtle.turnRight() | |
102 | turtle.drop(item.count-1) | |
103 | turtle.turnLeft() | |
104 | for inventory = 2,15 do | |
105 | turtle.select(inventory) | |
106 | item = turtle.getItemDetail(inventory) | |
107 | if(item == nil) then | |
108 | print("Slot "..inventory.." vacío.") | |
109 | elseif(item.name == tronco.name) then | |
110 | turtle.turnRight() | |
111 | ||
112 | turtle.drop() | |
113 | turtle.turnLeft() | |
114 | elseif(item.name == pimpollo.name) then | |
115 | if(turtle.getItemCount(16)<64) then | |
116 | turtle.transferTo(16) | |
117 | end | |
118 | if(turtle.getItemCount(inventory)>0) then | |
119 | turtle.turnLeft() | |
120 | turtle.drop() | |
121 | turtle.turnRight() | |
122 | end | |
123 | else | |
124 | turtle.dropUp() | |
125 | end | |
126 | end | |
127 | tortu.avanza(2) | |
128 | ||
129 | ||
130 |