SHOW:
|
|
- or go back to the newest paste.
| 1 | function SwitchREC() | |
| 2 | if not turtle.attack() then | |
| 3 | print "Couldn't dismantle the Redstone Energy Cell" | |
| 4 | return false | |
| 5 | end | |
| 6 | sleep(1) | |
| 7 | if not turtle.place() then | |
| 8 | print "Couldn't place a Redstone Energy Cell" | |
| 9 | return false | |
| 10 | end | |
| 11 | tries = 0 | |
| 12 | while not turtle.suckDown() do | |
| 13 | sleep(1) | |
| 14 | tries = tries + 1 | |
| 15 | if tries>10 then | |
| 16 | print "Couldn't get the Redstone Energy Cell from the inventory under me" | |
| 17 | return false | |
| 18 | end | |
| 19 | end | |
| 20 | return true | |
| 21 | end | |
| 22 | ||
| 23 | function CheckRefuel() | |
| 24 | - | if turtle.getFuelLevel() < 1000 then |
| 24 | + | if turtle.getFuelLevel() < 5000 then |
| 25 | print "Refueling" | |
| 26 | turtle.select(2) | |
| 27 | if not turtle.suckUp() then | |
| 28 | print "Couldn't find any (fuel)items in the inventory above me" | |
| 29 | return false | |
| 30 | end | |
| 31 | if not turtle.refuel() then | |
| 32 | print "Couldn't use the items I got from the inventory above me to refuel" | |
| 33 | return false | |
| 34 | end | |
| 35 | turtle.select(1) | |
| 36 | end | |
| 37 | return true | |
| 38 | end | |
| 39 | ||
| 40 | function Tele() | |
| 41 | if not peripheral.call("back", "teleport") then
| |
| 42 | print "Teleporting failed" | |
| 43 | return false | |
| 44 | end | |
| 45 | sleep(1) | |
| 46 | return true | |
| 47 | end | |
| 48 | ||
| 49 | function WaitUntilFull() | |
| 50 | print "Waiting for a full Redstone Energy Cell" | |
| 51 | while not peripheral.call("right", "get")["Full Energy"] do
| |
| 52 | - | sleep(5) |
| 52 | + | sleep(10) |
| 53 | end | |
| 54 | end | |
| 55 | ||
| 56 | function WaitUntilEmpty() | |
| 57 | print "Waiting for an empty Redstone Energy Cell" | |
| 58 | while not peripheral.call("right", "get")["No Energy"] do
| |
| 59 | - | sleep(5) |
| 59 | + | sleep(10) |
| 60 | end | |
| 61 | end | |
| 62 | ||
| 63 | ||
| 64 | while true do | |
| 65 | ||
| 66 | WaitUntilFull() | |
| 67 | if not SwitchREC() then | |
| 68 | break | |
| 69 | end | |
| 70 | if not CheckRefuel() then | |
| 71 | break | |
| 72 | end | |
| 73 | if not Tele() then | |
| 74 | break | |
| 75 | end | |
| 76 | WaitUntilEmpty() | |
| 77 | if not SwitchREC() then | |
| 78 | break | |
| 79 | end | |
| 80 | if not Tele() then | |
| 81 | break | |
| 82 | end | |
| 83 | end |