SHOW:
|
|
- or go back to the newest paste.
1 | function test() | |
2 | for i, j in pairs(peripheral.call("right","get")) do | |
3 | print("** "..i) | |
4 | print(j) | |
5 | end | |
6 | print("_____________") | |
7 | end | |
8 | ||
9 | function rechargeCell() | |
10 | turtle.place() | |
11 | while true do | |
12 | print("waiting...") | |
13 | test() | |
14 | sleep(5) | |
15 | if peripheral.call("right", "get")["Full Energy"] == true then | |
16 | print("Cellule chargee!") | |
17 | turtle.dig() | |
18 | return true | |
19 | end | |
20 | end | |
21 | end | |
22 | ||
23 | - | for i=1,16 do |
23 | + | while true do |
24 | - | turtle.select(i) |
24 | + | for i=1,16 do |
25 | - | print("Recharging slot"..i) |
25 | + | turtle.select(i) |
26 | - | rechargeCell() |
26 | + | if(turtle.getItemCount(i)>0) then |
27 | print("Recharging slot"..i) | |
28 | rechargeCell() | |
29 | end | |
30 | end | |
31 | sleep(5) | |
32 | end |