SHOW:
|
|
- or go back to the newest paste.
| 1 | local cnt=0 | |
| 2 | - | if turtle.getItemCount(1)>0 then |
| 2 | + | local hasChargeStation=false; |
| 3 | --cnt=0 | |
| 4 | args={...}
| |
| 5 | - | break |
| 5 | + | turtle.select(2) |
| 6 | if(args[1]==nil) then | |
| 7 | - | sleep(0.1) |
| 7 | + | |
| 8 | if not turtle.compare() then | |
| 9 | turtle.back() | |
| 10 | --turtle.select(2) | |
| 11 | - | os.pullEvent("redstone")
|
| 11 | + | |
| 12 | - | turtle.dig() |
| 12 | + | |
| 13 | end | |
| 14 | --if turtle.getItemCount(4)>0 then hasChargeStation = true end | |
| 15 | ||
| 16 | while true do | |
| 17 | turtle.select(2) | |
| 18 | ||
| 19 | ||
| 20 | while turtle.compareDown() do | |
| 21 | ||
| 22 | --check fuel first | |
| 23 | while turtle.getFuelLevel()<40 do | |
| 24 | if(hasChargeStation) then | |
| 25 | turtle.up() | |
| 26 | turtle.select(4) | |
| 27 | turtle.placeDown() | |
| 28 | sleep(10) | |
| 29 | turtle.digDown() | |
| 30 | turtle.down() | |
| 31 | turtle.select(2) | |
| 32 | else | |
| 33 | print(" I need more fuel")
| |
| 34 | for k=1,4 do turtle.turnLeft() end | |
| 35 | shell.run("refuel all")
| |
| 36 | sleep(5); | |
| 37 | ||
| 38 | end | |
| 39 | end | |
| 40 | cnt=cnt+1 | |
| 41 | turtle.back() | |
| 42 | ||
| 43 | if not turtle.detectDown() and turtle.getItemCount(2)>48 then | |
| 44 | redstone.setOutput("bottom",true)
| |
| 45 | ||
| 46 | turtle.down() | |
| 47 | --turtle.turnRight() | |
| 48 | turtle.select(1) | |
| 49 | turtle.transferTo(16,1) | |
| 50 | turtle.select(2) | |
| 51 | turtle.transferTo(1,32) | |
| 52 | turtle.select(1) | |
| 53 | while not turtle.detectDown() do | |
| 54 | sleep(1) | |
| 55 | end | |
| 56 | --redstone.setOutput("bottom",false)
| |
| 57 | while( turtle.getItemCount(1)>0) do sleep(0.5) end | |
| 58 | turtle.select(16) | |
| 59 | turtle.transferTo(1,1) | |
| 60 | --redstone.setOutput("bottom",true)
| |
| 61 | --turtle.drop() | |
| 62 | turtle.up() | |
| 63 | --turtle.turnLeft() | |
| 64 | turtle.select(2) | |
| 65 | redstone.setOutput("bottom",false)
| |
| 66 | end | |
| 67 | ||
| 68 | sleep(0.5) | |
| 69 | ||
| 70 | end | |
| 71 | ||
| 72 | if cnt>7 then | |
| 73 | cnt=0 | |
| 74 | turtle.select(2) | |
| 75 | turtle.placeDown() | |
| 76 | turtle.turnRight() | |
| 77 | turtle.forward() | |
| 78 | turtle.select(1) | |
| 79 | turtle.placeDown() | |
| 80 | turtle.back() | |
| 81 | turtle.attackDown() | |
| 82 | turtle.turnLeft() | |
| 83 | ||
| 84 | turtle.forward() | |
| 85 | turtle.forward() | |
| 86 | --turtle.forward() | |
| 87 | turtle.select(2) | |
| 88 | repeat | |
| 89 | if turtle.compareDown() then turtle.digDown() end | |
| 90 | until not turtle.forward() | |
| 91 | turtle.dig() | |
| 92 | turtle.forward() | |
| 93 | turtle.digDown() | |
| 94 | --turtle.back() | |
| 95 | ||
| 96 | turtle.turnRight() | |
| 97 | turtle.forward() | |
| 98 | turtle.select(1) | |
| 99 | turtle.digDown() | |
| 100 | turtle.back() | |
| 101 | turtle.turnLeft() | |
| 102 | ||
| 103 | turtle.forward() | |
| 104 | turtle.select(2) | |
| 105 | while turtle.compareDown() do | |
| 106 | turtle.digDown() | |
| 107 | end | |
| 108 | ||
| 109 | turtle.select(2) | |
| 110 | while not turtle.compareDown() do | |
| 111 | turtle.back() | |
| 112 | end | |
| 113 | turtle.back() | |
| 114 | turtle.back() | |
| 115 | ||
| 116 | turtle.place() | |
| 117 | else | |
| 118 | sleep(2) | |
| 119 | end | |
| 120 | ||
| 121 | end |