SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local fcount = 0 |
| 1 | + | ---NOTES--- |
| 2 | - | local mcount = 0 |
| 2 | + | ---Does not handle gravel yet--- |
| 3 | - | local lcount = 0 |
| 3 | + | ---Is desigened to be "smart" and pick the closets direction--- |
| 4 | - | local SRcount = 0 |
| 4 | + | ---Unsure If i have set it up correctly so that the functions are variables--- |
| 5 | - | local SLcount = 0 |
| 5 | + | ---DEBUGGED by martmists-- |
| 6 | - | local SFcount = 0 |
| 6 | + | ---END--- |
| 7 | - | local fuellevel = turtle.getFuelLevel() |
| 7 | + | |
| 8 | - | local procends = 0 |
| 8 | + | |
| 9 | fcount = 0 ----General Fowrard Distance counter---- | |
| 10 | - | function getcoal() ---Refueling funciton-- |
| 10 | + | mcount = 0 ----Distance counter used for new branch creation---- |
| 11 | - | turtle.select(1) |
| 11 | + | lcount = 0 ----tunnel length counter---- |
| 12 | - | fuellevel = turtle.getFuelLevel() |
| 12 | + | mocount = mcount ----Variable to determine how far in a turtle must go before it can dig again---- |
| 13 | - | Local I2count = turtle.getItemCount() |
| 13 | + | SRcount = 0 ----Master counter for Right tunnels---- |
| 14 | - | if fuellevel < 1000 then |
| 14 | + | SLcount = 0 ----Master counter for Left tunnels---- |
| 15 | - | I3count = 64 - I2count |
| 15 | + | SFcount = 0 ----Master counter for Foward tunnels---- |
| 16 | - | turtle.suckUp( I3count ) |
| 16 | + | SDcount = 0 ----Master counter for downwards tunnels *not implemented*---- |
| 17 | - | turtle.refuel( 1,5 ) |
| 17 | + | SUcount = 0 ----Master counter for upwards tunnels *not implemented*---- |
| 18 | ||
| 19 | function Dig() ----function to handle general 3x1 digging | |
| 20 | - | function ymine1() |
| 20 | + | if turle.detect() then |
| 21 | - | turtle.turnLeft() |
| 21 | + | turtle.dig() |
| 22 | - | turtle.dig() |
| 22 | + | |
| 23 | - | turtle.digUp() |
| 23 | + | if turtle.detectUp() then |
| 24 | - | turtle.digDown() |
| 24 | + | turtle.digUp() |
| 25 | - | turtle.forward() |
| 25 | + | if turtle.detectDown() then |
| 26 | - | turtle.dig |
| 26 | + | |
| 27 | - | turtle.digUp() |
| 27 | + | |
| 28 | - | turtle.digDown() |
| 28 | + | |
| 29 | - | turtle.forward() |
| 29 | + | |
| 30 | end | |
| 31 | ||
| 32 | - | function Ymine() |
| 32 | + | function Dropoff() -----THIS FUNCTION IS FOR ITEM DROP OFF---- |
| 33 | - | turtle.dig() |
| 33 | + | for I= 2, 16, 1 do |
| 34 | - | turtle.forward() |
| 34 | + | turtle.select(I) |
| 35 | - | turtle.turnLeft() |
| 35 | + | turtle.dropDown() |
| 36 | - | turtle.dig() |
| 36 | + | |
| 37 | - | turtle.forward() |
| 37 | + | |
| 38 | - | ymine1() |
| 38 | + | |
| 39 | - | ymine1() |
| 39 | + | function MiningJobFoward() ----THIS FUNCTION IS FOR FORWARD MINING---- |
| 40 | - | turtle.turnLeft() |
| 40 | + | while true do |
| 41 | - | turtle.dig() |
| 41 | + | |
| 42 | - | turtle.forward() |
| 42 | + | local Icount = turtle.getItemCount() |
| 43 | - | turtle.turnRight() |
| 43 | + | if Icount == 0 then |
| 44 | Dig() | |
| 45 | fcount = fcount +1 | |
| 46 | end | |
| 47 | - | function Downmine() |
| 47 | + | turtle.turnLeft() |
| 48 | - | Dcount = Dcount + 1 |
| 48 | + | Dig() |
| 49 | - | turtle.select(16) |
| 49 | + | turtle.back() |
| 50 | - | local Icount = turtle.getItemCount() |
| 50 | + | turtle.turnRight() |
| 51 | - | if Icount == 0 then |
| 51 | + | turtle.turnRight() |
| 52 | Dig() | |
| 53 | - | Icount = turtle.getItemCount() |
| 53 | + | turtle.back() |
| 54 | - | turtle.select(1) |
| 54 | + | turtle.turnLeft |
| 55 | - | turtle.Down() |
| 55 | + | local fuellevel = turtle.getFuelLevel() |
| 56 | - | tutle.digDown() |
| 56 | + | if fuellevel << fcount + 5 then |
| 57 | - | turtle.Down() |
| 57 | + | turtle.select(1) |
| 58 | - | tutle.digDown() |
| 58 | + | turtle.refuel( 1, 10 ) |
| 59 | - | turtle.Down() |
| 59 | + | |
| 60 | - | tutle.digDown() |
| 60 | + | if fuellevel << fcount + 10 then |
| 61 | - | Ymine() |
| 61 | + | SFcount + fcount = SFcount |
| 62 | repeat | |
| 63 | turtle.back() | |
| 64 | fcount = fcount - 1 | |
| 65 | - | function Inventory() ---Tier 1 Mining Function--- |
| 65 | + | until fcount = 0 |
| 66 | - | turtle.select(16) |
| 66 | + | |
| 67 | - | local Icount = turtle.getItemCount() |
| 67 | + | Dropoff() |
| 68 | - | if Icount == 0 then |
| 68 | + | end |
| 69 | - | turtle.select(16) |
| 69 | + | end |
| 70 | - | Icount = turtle.getItemCount() |
| 70 | + | |
| 71 | - | turtle.select(1) |
| 71 | + | |
| 72 | - | fcount = fcount + 1 |
| 72 | + | function MiningJobRight() ----THIS FUNCTION IS FOR RIGHT MINING---- |
| 73 | - | turtle.turnLeft() |
| 73 | + | while true do |
| 74 | - | Dig() |
| 74 | + | |
| 75 | - | turtle.back() |
| 75 | + | local Icount = turtle.getitemcount() |
| 76 | - | turtle.turnRight() |
| 76 | + | if Icount == 0 then |
| 77 | - | turtle.turnRight() |
| 77 | + | Dig() |
| 78 | - | Dig() |
| 78 | + | fcount = fcount +1 |
| 79 | - | turtle.back() |
| 79 | + | |
| 80 | - | turtle.turnLeft() |
| 80 | + | turtle.turnLeft() |
| 81 | - | turtle.digUp() |
| 81 | + | Dig() |
| 82 | turtle.back() | |
| 83 | - | turtle.dig() |
| 83 | + | turtle.turnRight() |
| 84 | - | turtle.forward() |
| 84 | + | turtle.turnRight() |
| 85 | Dig() | |
| 86 | turtle.back() | |
| 87 | turtle.turnLeft | |
| 88 | - | function home() |
| 88 | + | local fuellevel = turtle.getfuellevel() |
| 89 | if fuellevel << fcount + 5 then | |
| 90 | - | turtle.back() |
| 90 | + | turtle.select(1) |
| 91 | - | fcount = fcount - 1 |
| 91 | + | turtle.refuel( 1, 10 ) |
| 92 | - | until fcount == 0 |
| 92 | + | |
| 93 | - | end |
| 93 | + | SRcount + 3 = SRcount |
| 94 | if fuellevel << fcount + 10 then | |
| 95 | - | function Dropoff() |
| 95 | + | repeat |
| 96 | - | for I= 2, 16, 1 do |
| 96 | + | turtle.back() |
| 97 | - | turtle.select(I) |
| 97 | + | fcount = fcount - 1 |
| 98 | - | turtle.dropDown() |
| 98 | + | until fcount = 0 |
| 99 | - | end |
| 99 | + | |
| 100 | - | end |
| 100 | + | Dropoff() |
| 101 | end | |
| 102 | - | function fuel() |
| 102 | + | end |
| 103 | - | local fuellevel = turtle.getFuelLevel() |
| 103 | + | |
| 104 | - | if fuellevel < fcount + 5 then |
| 104 | + | |
| 105 | - | turtle.select(1) |
| 105 | + | function MiningJobLeft() ----THIS FUNCTION IS FOR LEFT MINING---- |
| 106 | - | turtle.refuel( 1, 10 ) |
| 106 | + | while true do |
| 107 | - | end |
| 107 | + | |
| 108 | - | if fuellevel < fcount + 10 then |
| 108 | + | local Icount = turtle.getitemcount() |
| 109 | - | local procends = 1 |
| 109 | + | if Icount == 0 then |
| 110 | - | repeat |
| 110 | + | Dig() |
| 111 | - | turtle.back() |
| 111 | + | fcount = fcount +1 |
| 112 | - | fcount = fcount - 1 |
| 112 | + | |
| 113 | - | until fcount == 0 |
| 113 | + | turtle.turnLeft() |
| 114 | - | Dropoff() |
| 114 | + | Dig() |
| 115 | - | end |
| 115 | + | turtle.back() |
| 116 | turtle.turnRight() | |
| 117 | turtle.turnRight() | |
| 118 | - | |
| 118 | + | Dig() |
| 119 | - | function Dig() |
| 119 | + | turtle.back() |
| 120 | - | if turtle.detect() then |
| 120 | + | turtle.turnLeft |
| 121 | - | repeat |
| 121 | + | local fuellevel = turtle.getfuellevel() |
| 122 | - | turtle.dig() |
| 122 | + | if fuellevel << fcount + 5 then |
| 123 | - | local gravel = turtle.detect() |
| 123 | + | turtle.select(1) |
| 124 | - | until gravel == false |
| 124 | + | turtle.refuel( 1, 10 ) |
| 125 | end | |
| 126 | - | turtle.forward() |
| 126 | + | SLcount + 3 = SLcount |
| 127 | - | if turtle.detectUp() then |
| 127 | + | if fuellevel << fcount + 10 then |
| 128 | - | turtle.digUp() |
| 128 | + | repeat |
| 129 | - | if turtle.detectDown() then |
| 129 | + | turtle.back() |
| 130 | - | turtle.digDown() |
| 130 | + | fcount = fcount - 1 |
| 131 | - | end |
| 131 | + | until fcount = 0 |
| 132 | - | end |
| 132 | + | |
| 133 | - | end |
| 133 | + | Dropoff() |
| 134 | - | |
| 134 | + | end |
| 135 | end | |
| 136 | - | function miningJobF() |
| 136 | + | |
| 137 | - | while Icount == 0 and procends == 0 do |
| 137 | + | |
| 138 | - | Inventory() |
| 138 | + | function movement() ----function for Left,right movement---- |
| 139 | - | SFcount = SFcount +1 |
| 139 | + | |
| 140 | - | fuel() |
| 140 | + | if turtle.detect() == false then |
| 141 | - | end |
| 141 | + | turtle.forward() |
| 142 | - | home() |
| 142 | + | fcount + 1 = fcount |
| 143 | end | |
| 144 | - | |
| 144 | + | until turtle.detect() = true |
| 145 | - | function miningJobR() |
| 145 | + | |
| 146 | - | while Icount == 0 and procends == 0 do |
| 146 | + | |
| 147 | - | Inventory() |
| 147 | + | |
| 148 | - | fuel() |
| 148 | + | function NewtunnelFOW() ---function to locate new forward tunnel--- |
| 149 | - | end |
| 149 | + | TSF = SFcount |
| 150 | - | home() |
| 150 | + | |
| 151 | - | SRcount = SRcount + 3 |
| 151 | + | |
| 152 | TSF - 1 = TSF | |
| 153 | until TSF == SFcount | |
| 154 | - | function miningJobL() |
| 154 | + | |
| 155 | - | while Icount == 0 and procends == 0 do |
| 155 | + | end |
| 156 | - | Inventory() |
| 156 | + | |
| 157 | - | fuel() |
| 157 | + | function NewtunnelLEF() ---function to locate new left tunnel--- |
| 158 | - | end |
| 158 | + | TSL = SLcount |
| 159 | - | home() |
| 159 | + | |
| 160 | - | SLcount = SLcount +3 |
| 160 | + | |
| 161 | lcount + 1 = lcount | |
| 162 | - | |
| 162 | + | TSL - 1 = TSL |
| 163 | - | function movement() |
| 163 | + | until TSF == SLcount then |
| 164 | - | repeat |
| 164 | + | turle.turnLeft() |
| 165 | - | if turtle.detect() == false then |
| 165 | + | |
| 166 | - | turtle.forward() |
| 166 | + | movement() |
| 167 | - | fcount = fcount + 1 |
| 167 | + | |
| 168 | ||
| 169 | - | until turtle.detect() == true |
| 169 | + | function NewtunnelRIG() --- function to locate new right tunnel--- |
| 170 | - | |
| 170 | + | TSR = SRcount |
| 171 | repeat | |
| 172 | - | |
| 172 | + | |
| 173 | - | function NewtunnelFOW() |
| 173 | + | lcount + 1 = lcount |
| 174 | - | TSF = SFcount |
| 174 | + | TSR - 1 = TSR |
| 175 | - | repeat |
| 175 | + | until TSR == SRcount |
| 176 | - | turtle.dig() |
| 176 | + | turtle.turnRight() |
| 177 | end | |
| 178 | - | TSF = TSF - 1 |
| 178 | + | movement() |
| 179 | - | until TSF == SFcount or TSF < 0 or turtle.detect() == true |
| 179 | + | |
| 180 | - | |
| 180 | + | |
| 181 | function Stright() | |
| 182 | - | |
| 182 | + | NewtunnelFOW() |
| 183 | - | function NewtunnelLEF() |
| 183 | + | MiningJobForward() |
| 184 | - | TSL = SLcount |
| 184 | + | |
| 185 | - | repeat |
| 185 | + | |
| 186 | - | turtle.forward() |
| 186 | + | |
| 187 | - | lcount = lcount + 1 |
| 187 | + | NewtunnelLEF() |
| 188 | - | TSL = TSL - 1 |
| 188 | + | MiningJobLeft() |
| 189 | - | until TSL == SLcount or TSL < 0 or turtle.detect() == true |
| 189 | + | |
| 190 | - | turtle.turnLeft() |
| 190 | + | |
| 191 | - | movement() |
| 191 | + | |
| 192 | NewtunnelRIG() | |
| 193 | - | |
| 193 | + | MiningJobRight() |
| 194 | - | function NewtunnelRIG() |
| 194 | + | |
| 195 | - | TSR = SRcount |
| 195 | + | |
| 196 | - | repeat |
| 196 | + | function logicish() ----The "brains" of it all--- |
| 197 | - | turtle.forward() |
| 197 | + | |
| 198 | - | lcount = lcount + 1 |
| 198 | + | if SFcount == SLcount then |
| 199 | - | TSR = TSR - 1 |
| 199 | + | local function RN() |
| 200 | - | until TSR == SRcount or TSR < 0 or turtle.detect() == true |
| 200 | + | local rand = math.random(1,3) |
| 201 | - | turtle.turnRight() |
| 201 | + | return rand |
| 202 | - | movement() |
| 202 | + | |
| 203 | local num = RN() | |
| 204 | - | |
| 204 | + | end |
| 205 | - | function Straight() |
| 205 | + | |
| 206 | - | getcoal() |
| 206 | + | if local num == 1 then |
| 207 | - | procends = 0 |
| 207 | + | Stright() |
| 208 | - | Icount = 0 |
| 208 | + | |
| 209 | - | NewtunnelFOW() |
| 209 | + | if local num == 2 then |
| 210 | - | miningJobF() |
| 210 | + | ---mining function here, TBC Right--- |
| 211 | end | |
| 212 | - | |
| 212 | + | if local num == 3 then |
| 213 | Lefttime() | |
| 214 | - | getcoal() |
| 214 | + | |
| 215 | - | procends = 0 |
| 215 | + | if SFcount << SRcount and SFcount < SLcount then |
| 216 | - | Icount = 0 |
| 216 | + | Stright() |
| 217 | - | NewtunnelLEF() |
| 217 | + | |
| 218 | - | miningJobL() |
| 218 | + | if SRcount << SFcount and SRcount < SLcount then |
| 219 | Righttime() | |
| 220 | - | |
| 220 | + | |
| 221 | if SLcount << SF count and SLcount < SRcount thne | |
| 222 | - | getcoal() |
| 222 | + | Lefttime() |
| 223 | - | procends = 0 |
| 223 | + | end |
| 224 | - | Icount = 0 |
| 224 | + | if SLcount == SRcount and SLcount << SFcount then |
| 225 | - | NewtunnelRIG() |
| 225 | + | local function RN() |
| 226 | - | miningJobR() |
| 226 | + | local rand = math.random(1,2) |
| 227 | return rand | |
| 228 | - | |
| 228 | + | |
| 229 | - | function logicish() |
| 229 | + | local num = RN() |
| 230 | - | if SFcount == 0 then |
| 230 | + | |
| 231 | - | Straight() |
| 231 | + | if local num == 1 then |
| 232 | Lefttime() | |
| 233 | end | |
| 234 | - | if SFcount == SLcount then |
| 234 | + | if local num == 2 then |
| 235 | - | local function RN() |
| 235 | + | Righttime() |
| 236 | - | local rand = math.random(1,3) |
| 236 | + | |
| 237 | - | return rand |
| 237 | + | if SFcount == SRcount and SRcount << SFcount then |
| 238 | - | end |
| 238 | + | local function RN() |
| 239 | - | local num = RN() |
| 239 | + | local rand = math.random(1,2) |
| 240 | - | end |
| 240 | + | return rand |
| 241 | - | end |
| 241 | + | |
| 242 | - | if num == 1 then |
| 242 | + | local num = RN() |
| 243 | - | Stright() |
| 243 | + | |
| 244 | - | end |
| 244 | + | if local num == 1 then |
| 245 | - | if num == 2 then |
| 245 | + | Stright() |
| 246 | - | Righttime() |
| 246 | + | |
| 247 | - | end |
| 247 | + | if local num == 2 then |
| 248 | - | if num == 3 then |
| 248 | + | Righttime() |
| 249 | - | Lefttime() |
| 249 | + | |
| 250 | - | end |
| 250 | + | if SFcount == SLcount and SLcount << SRcount then |
| 251 | - | if SFcount < SRcount and SFcount < SLcount then |
| 251 | + | local function RN() |
| 252 | - | Stright() |
| 252 | + | local rand = math.random(1,2) |
| 253 | - | end |
| 253 | + | return rand |
| 254 | - | if SRcount < SFcount and SRcount < SLcount then |
| 254 | + | |
| 255 | - | Righttime() |
| 255 | + | local num = RN() |
| 256 | - | end |
| 256 | + | |
| 257 | - | if SLcount < SFcount and SLcount < SRcount then |
| 257 | + | if local num == 1 then |
| 258 | - | Lefttime() |
| 258 | + | Lefttime() |
| 259 | - | end |
| 259 | + | |
| 260 | - | if SLcount == SRcount and SLcount < SFcount then |
| 260 | + | if local num == 2 then |
| 261 | - | local function RN() |
| 261 | + | Stright() |
| 262 | - | local rand = math.random(1,2) |
| 262 | + | |
| 263 | - | return rand |
| 263 | + | |
| 264 | - | end |
| 264 | + | |
| 265 | - | local num = RN() |
| 265 | + | ---The actual working function to make it mine below here--- |
| 266 | - | end |
| 266 | + | |
| 267 | - | if num == 1 then |
| 267 | + | |
| 268 | - | Lefttime() |
| 268 | + | |
| 269 | - | end |
| 269 | + | |
| 270 | - | if num == 2 then |
| 270 | + | logicish() |
| 271 | - | Righttime() |
| 271 | + |