SHOW:
|
|
- or go back to the newest paste.
| 1 | rednet.open("right")
| |
| 2 | local func | |
| 3 | local tArgs = {...}
| |
| 4 | ||
| 5 | function cleanup() | |
| 6 | for i = 1,12 do | |
| 7 | turtle.select(i) | |
| 8 | turtle.dropDown() | |
| 9 | end | |
| 10 | end | |
| 11 | ||
| 12 | function place() | |
| 13 | turtle.select(16) | |
| 14 | turtle.place() | |
| 15 | sleep(10) | |
| 16 | turtle.down() | |
| 17 | turtle.select(15) | |
| 18 | turtle.place() | |
| 19 | turtle.select(14) | |
| 20 | turtle.placeDown() | |
| 21 | end | |
| 22 | ||
| 23 | function remove() | |
| 24 | turtle.select(14) | |
| 25 | turtle.digDown() | |
| 26 | turtle.select(15) | |
| 27 | turtle.dig() | |
| 28 | turtle.up() | |
| 29 | sleep(10) | |
| 30 | turtle.select(16) | |
| 31 | turtle.dig() | |
| 32 | end | |
| 33 | ||
| 34 | function fuel() | |
| 35 | turtle.select(13) | |
| 36 | turtle.placeUp() | |
| 37 | turtle.select(1) | |
| 38 | turtle.suckUp() | |
| 39 | turtle.dropUp(turtle.getItemCount(1) - 4) | |
| 40 | turtle.refuel() | |
| 41 | turtle.select(13) | |
| 42 | turtle.digUp() | |
| 43 | end | |
| 44 | ||
| 45 | function fuelBoss() | |
| 46 | turtle.select(13) | |
| 47 | turtle.placeUp() | |
| 48 | turtle.select(1) | |
| 49 | turtle.suckUp() | |
| 50 | turtle.dropUp(turtle.getItemCount(1) - 4) | |
| 51 | turtle.select(13) | |
| 52 | turtle.digUp() | |
| 53 | turtle.up() | |
| 54 | turtle.turnRight() | |
| 55 | turtle.select(1) | |
| 56 | turtle.drop() | |
| 57 | turtle.turnLeft() | |
| 58 | turtle.down() | |
| 59 | end | |
| 60 | ||
| 61 | function checkFuel() | |
| 62 | if turtle.getFuelLevel() < 400 then | |
| 63 | fuel() | |
| 64 | end | |
| 65 | end | |
| 66 | ||
| 67 | function cycle() | |
| 68 | place() | |
| 69 | - | sleep(5) |
| 69 | + | m = peripheral.wrap("front")
|
| 70 | while turtle.getItemCount(1) > 0 do | |
| 71 | cleanup() | |
| 72 | sleep(2) | |
| 73 | end | |
| 74 | - | remove() |
| 74 | + | if m.isActive() == 0 then |
| 75 | remove() | |
| 76 | else | |
| 77 | sleep(1) | |
| 78 | remove() | |
| 79 | end | |
| 80 | checkFuel() | |
| 81 | turtle.forward() | |
| 82 | end | |
| 83 | ||
| 84 | function checkIn(fromID) | |
| 85 | rednet.send(fromID, tArgs[1]) | |
| 86 | end | |
| 87 | ||
| 88 | function chunkLoad() | |
| 89 | turtle.select(16) | |
| 90 | turtle.digUp() | |
| 91 | checkFuel() | |
| 92 | turtle.select(16) | |
| 93 | turtle.forward() | |
| 94 | turtle.placeUp() | |
| 95 | end | |
| 96 | ||
| 97 | while true do | |
| 98 | local id,msg,dist = rednet.receive() | |
| 99 | func = loadstring(msg.."(...)") | |
| 100 | setfenv(func, getfenv()) | |
| 101 | func(id) | |
| 102 | rednet.send(id,"Done") | |
| 103 | end |