SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --New Age Stoner-- |
| 1 | + | ----Perpetual Forward---- |
| 2 | - | --For the purifying daisy-- |
| 2 | + | --Global Var-- |
| 3 | t = turtle | |
| 4 | - | t.select(1) |
| 4 | + | r = rednet |
| 5 | - | |
| 5 | + | --Functions-- |
| 6 | - | function left() |
| 6 | + | function forward() |
| 7 | if t.detect() then | |
| 8 | - | t.forward() |
| 8 | + | t.dig() |
| 9 | - | t.turnRight() |
| 9 | + | t.forward() |
| 10 | else | |
| 11 | - | function side() |
| 11 | + | t.forward() |
| 12 | - | length = 3 |
| 12 | + | |
| 13 | - | while length > 0 |
| 13 | + | |
| 14 | - | t.place() |
| 14 | + | function up() |
| 15 | - | left() |
| 15 | + | if t.detectUp() then |
| 16 | - | length = length - 1 |
| 16 | + | t.digUp() |
| 17 | end | |
| 18 | - | left() |
| 18 | + | |
| 19 | - | t.forward() |
| 19 | + | function down() |
| 20 | - | t.turnRight() |
| 20 | + | if t.detectDown() then |
| 21 | t.digDown() | |
| 22 | - | function loop() |
| 22 | + | |
| 23 | - | loops = 4 |
| 23 | + | |
| 24 | - | while loops > 0 do |
| 24 | + | function tack() |
| 25 | - | side() |
| 25 | + | |
| 26 | - | loops = loops - 1 |
| 26 | + | |
| 27 | end | |
| 28 | function slot() | |
| 29 | - | function main() |
| 29 | + | forward() |
| 30 | - | while not (t.getItemCount() == 0) do |
| 30 | + | up() |
| 31 | - | loop() |
| 31 | + | down() |
| 32 | end | |
| 33 | - | end |
| 33 | + | function store() |
| 34 | t.select(1) | |
| 35 | tack() | |
| 36 | t.place() | |
| 37 | num = 13 | |
| 38 | while num > 4 do | |
| 39 | t.select(num+4) | |
| 40 | t.drop() | |
| 41 | num = num - 1 | |
| 42 | end | |
| 43 | tack() | |
| 44 | end | |
| 45 | function refuel() | |
| 46 | t.select(2) | |
| 47 | tack() | |
| 48 | t.dig() | |
| 49 | t.place() | |
| 50 | t.suck() | |
| 51 | t.refuel() | |
| 52 | t.dig() | |
| 53 | tack() | |
| 54 | end | |
| 55 | function refuelCheck() | |
| 56 | if t.getFuelLevel() == 0 then | |
| 57 | refuel() | |
| 58 | end | |
| 59 | end | |
| 60 | function storeCheck() | |
| 61 | if t.getItemCount(16) > 0 then | |
| 62 | store() | |
| 63 | end | |
| 64 | end | |
| 65 | function portal() | |
| 66 | store() | |
| 67 | refuel() | |
| 68 | t.select(3) | |
| 69 | tack() | |
| 70 | t.place() | |
| 71 | id, message distance = rednet.receive(1) | |
| 72 | if distance > 0 then | |
| 73 | t.select(3) | |
| 74 | t.dig() | |
| 75 | tack() | |
| 76 | end | |
| 77 | end | |
| 78 | function basic() | |
| 79 | storeCheck() | |
| 80 | refuelCheck() | |
| 81 | id, message, distance = rednet.receive(1, 0.1) | |
| 82 | if (message == "stop") then | |
| 83 | portal() | |
| 84 | break | |
| 85 | else if (message == "portal") then | |
| 86 | portal() | |
| 87 | else | |
| 88 | slot() | |
| 89 | end | |
| 90 | end | |
| 91 | function setNode() | |
| 92 | dist1 = 8 | |
| 93 | dist2 = 8 | |
| 94 | t.select(4) | |
| 95 | t.digUp() | |
| 96 | t.placeUp() | |
| 97 | while dist1 > 0 do | |
| 98 | basic() | |
| 99 | dist1 = dist1 - 1 | |
| 100 | end | |
| 101 | tack() | |
| 102 | while dist2 > 0 do | |
| 103 | forward() | |
| 104 | dist2 = dist2 - 1 | |
| 105 | end | |
| 106 | t.select(4) | |
| 107 | up() |