SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ Landstryder's Lumber Jack | |
| 2 | ||
| 3 | Only works with redstone signal | |
| 4 | from bottom when at the harvest | |
| 5 | location, ment to come from a | |
| 6 | daylight detector to keep it from | |
| 7 | bonemealing at night. | |
| 8 | Drop off point is to the right of | |
| 9 | the harvest location. Wood goes in | |
| 10 | container strait at the end of path | |
| 11 | and the excess saplings to the left | |
| 12 | the bot at the end of path. Comparator | |
| 13 | can be use on drop off chest to send | |
| 14 | redstone to top of turtle at drop | |
| 15 | location to pause program cycle till | |
| 16 | more wood is required. | |
| 17 | ]]-- | |
| 18 | ||
| 19 | local i=0 | |
| 20 | ||
| 21 | function Dream() | |
| 22 | if rs.getAnalogInput("bottom")<1 then
| |
| 23 | print("Sun has set.... time to sleep....")
| |
| 24 | textutils.slowPrint("....and perhaps to D.R.E.A.M. ....")
| |
| 25 | end | |
| 26 | while rs.getAnalogInput("bottom")<1 do
| |
| 27 | sleep(30) | |
| 28 | end | |
| 29 | end | |
| 30 | ||
| 31 | function Breaks() | |
| 32 | if rs.getAnalogInput("top")>1 then
| |
| 33 | print("Sensors detect adiaquite inventory....")
| |
| 34 | textutils.slowPrint(".... time for a B.R.E.A.K. ....")
| |
| 35 | end | |
| 36 | - | turtle.refuel(1) |
| 36 | + | |
| 37 | sleep(30) | |
| 38 | end | |
| 39 | end | |
| 40 | ||
| 41 | function Bone() | |
| 42 | turtle.select(3) | |
| 43 | if turtle.getItemCount()<1 then | |
| 44 | print("No bone detected...")
| |
| 45 | textutils.slowPrint(".... atempting to get B.O.N.E up to acceptable level....")
| |
| 46 | turtle.turnLeft() | |
| 47 | turtle.turnLeft() | |
| 48 | if not turtle.suck() then | |
| 49 | turtle.turnLeft() | |
| 50 | turtle.turnLeft() | |
| 51 | textutils.slowPrint(".... B.O.N.E has been depleted - shuting down ....")
| |
| 52 | return | |
| 53 | end | |
| 54 | turtle.turnLeft() | |
| 55 | turtle.turnLeft() | |
| 56 | end | |
| 57 | end | |
| 58 | ||
| 59 | function GasUp() | |
| 60 | if turtle.getFuelLevel()<100 then | |
| 61 | turtle.select(1) | |
| 62 | if not turtle.refuel(1) then | |
| 63 | print("Out of fuel....")
| |
| 64 | textutils.slowPrint("....shuting down....")
| |
| 65 | return | |
| 66 | end | |
| 67 | end | |
| 68 | end | |
| 69 | ||
| 70 | function Lumber() | |
| 71 | turtle.select(4) | |
| 72 | if turtle.compare() then | |
| 73 | print("Tree detected")
| |
| 74 | textutils.slowPrint(".... commencing cutdown ....")
| |
| 75 | turtle.select(5) | |
| 76 | turtle.dig() | |
| 77 | turtle.forward() | |
| 78 | while turtle.compareUp() do | |
| 79 | turtle.digUp() | |
| 80 | turtle.up() | |
| 81 | i=i+1 | |
| 82 | end | |
| 83 | while i>0 do | |
| 84 | turtle.down() | |
| 85 | i=i-1 | |
| 86 | end | |
| 87 | turtle.back() | |
| 88 | turtle.select(2) | |
| 89 | turtle.place() | |
| 90 | print("New sapling planted...")
| |
| 91 | textutils.slowPrint(".... boning started ....")
| |
| 92 | - | turtle.suck() |
| 92 | + | |
| 93 | Dream() | |
| 94 | Bone() | |
| 95 | turtle.place() | |
| 96 | end | |
| 97 | end | |
| 98 | - | |
| 98 | + | |
| 99 | function DropOff() | |
| 100 | turtle.select(5) | |
| 101 | if turtle.getItemCount()>45 then | |
| 102 | turtle.turnRight() | |
| 103 | for x=1,6 do --you can change to the distance to your drop point | |
| 104 | turtle.forward() | |
| 105 | end | |
| 106 | turtle.drop() | |
| 107 | turtle.turnLeft() | |
| 108 | for x=6,16 do | |
| 109 | turtle.select(x) | |
| 110 | turtle.drop() | |
| 111 | end | |
| 112 | turtle.select(2) | |
| 113 | turtle.transferTo(6,1) | |
| 114 | turtle.turnLeft() | |
| 115 | Breaks() | |
| 116 | for x=1,6 do --if you change the number above make this one match | |
| 117 | turtle.forward() | |
| 118 | end | |
| 119 | turtle.turnRight() | |
| 120 | end | |
| 121 | end | |
| 122 | ||
| 123 | ||
| 124 | -- Main Program Loop | |
| 125 | ||
| 126 | while true do | |
| 127 | for x=1,5 do | |
| 128 | GasUp() | |
| 129 | Lumber() | |
| 130 | sleep(3) | |
| 131 | end | |
| 132 | GasUp() | |
| 133 | DropOff() | |
| 134 | sleep(3) | |
| 135 | end |