SHOW:
|
|
- or go back to the newest paste.
1 | -- Programme écrit par Lananas02 (Steam : Lananas) | |
2 | -- Programme libre d'utilisation et d'édition | |
3 | -- Programme interdit à la vente | |
4 | ||
5 | ligne = 2 | |
6 | prof = 5 | |
7 | position_profondeur = 0 | |
8 | position_largeur = 0 | |
9 | ||
10 | turtle.select(1) | |
11 | turtle.refuel(5) | |
12 | turtle.digDown() | |
13 | ||
14 | --------------------------------------------FONCTION-------------------------------------------- | |
15 | ||
16 | -- Permet d'avancer d'un bloc en minant | |
17 | function Mine_avance() | |
18 | turtle.dig() | |
19 | inventaire_plein() | |
20 | -- Permet de miner les blocs qui tombent devant "gravel,sand,..." | |
21 | while not turtle.forward() do | |
22 | turtle.dig() | |
23 | end | |
24 | inventaire_plein() | |
25 | turtle.digDown() | |
26 | inventaire_plein() | |
27 | turtle.digUp() | |
28 | inventaire_plein() | |
29 | -- Permet de miner les blocs qui tombent au dessus de la turtle "gravel,sand,..." | |
30 | while turtle.detectUp() or not turtle.up() do | |
31 | turtle.digUp() | |
32 | end | |
33 | inventaire_plein() | |
34 | turtle.down() | |
35 | end | |
36 | ||
37 | -- Permet de miner une ligne | |
38 | function Mine_ligne(profondeur) | |
39 | pr = profondeur | |
40 | while pr > 0 do | |
41 | Mine_avance() | |
42 | position_profondeur = position_profondeur + 1 | |
43 | pr = pr - 1 | |
44 | end | |
45 | pr = profondeur | |
46 | while pr > 0 do | |
47 | turtle.back() | |
48 | position_profondeur = position_profondeur - 1 | |
49 | pr = pr - 1 | |
50 | end | |
51 | end | |
52 | ||
53 | -- permet de se mettre en position pour la ligne suivante | |
54 | function Change_ligne() | |
55 | i = 0 | |
56 | turtle.turnLeft() | |
57 | while i < 3 do | |
58 | Mine_avance() | |
59 | position_largeur = position_largeur + 1 | |
60 | i = i + 1 | |
61 | end | |
62 | turtle.turnRight() | |
63 | end | |
64 | ||
65 | -- La turtle retourne à sa base | |
66 | function Retour_base () | |
67 | tmp_profondeur = position_profondeur | |
68 | tmp_largeur = position_largeur | |
69 | while tmp_profondeur > 0 do | |
70 | turtle.back() | |
71 | tmp_profondeur = tmp_profondeur - 1 | |
72 | end | |
73 | turtle.turnRight() | |
74 | while tmp_largeur > 0 do | |
75 | turtle.forward() | |
76 | tmp_largeur = tmp_largeur - 1 | |
77 | end | |
78 | turtle.turnLeft() | |
79 | end | |
80 | ||
81 | -- Vide l'inventaire à la base (coffre) | |
82 | function Vide_coffre() | |
83 | turtle.turnLeft() | |
84 | turtle.turnLeft() | |
85 | for i in 1,16 do | |
86 | turtle.select(i) | |
87 | turtle.drop() | |
88 | end | |
89 | turtle.turnRight() | |
90 | turtle.turnRight() | |
91 | end | |
92 | ||
93 | -- Retourne à sa position de minage | |
94 | function Retour_mine() | |
95 | tmp_profondeur = 0 | |
96 | tmp_largeur = 0 | |
97 | - | if position_largeur > 0 do |
97 | + | if position_largeur > 0 then |
98 | turtle.turnLeft() | |
99 | end | |
100 | while tmp_largeur < position_largeur do | |
101 | turtle.forward() | |
102 | tmp_largeur = tmp_largeur + 1 | |
103 | end | |
104 | - | if position_largeur > 0 do |
104 | + | if position_largeur > 0 then |
105 | turtle.turnRight() | |
106 | end | |
107 | while tmp_profondeur < position_profondeur do | |
108 | turtle.forward() | |
109 | tmp_profondeur = tmp_profondeur + 1 | |
110 | end | |
111 | end | |
112 | ||
113 | -- Contrôle si l'inventaire de la turtle est plein et l'envoie se vider | |
114 | function inventaire_plein () | |
115 | - | if turtle.getItemCount(16) > 0 do |
115 | + | if turtle.getItemCount(16) > 0 then |
116 | Retour_base() | |
117 | Vide_coffre() | |
118 | Retour_mine() | |
119 | end | |
120 | end | |
121 | ------------------------------------------------------------------------------------------------ | |
122 | ||
123 | ||
124 | ||
125 | ||
126 | ||
127 | ||
128 | lg = ligne | |
129 | while lg > 0 do | |
130 | Mine_ligne(prof) | |
131 | Change_ligne() | |
132 | lg = lg - 1 | |
133 | end |