Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("+-------------------------------------+")
- print("| Tree Farm made by Henkekalmar |")
- print("+-------------------------------------+")
- print("| |")
- print("| Before you start you must place a |")
- print("| chest with saplings on the turtle's |")
- print("| left side, and en empty chest under |")
- print("| it for emptying wood. |")
- print("| Place one log in the 2nd slot, fuel |")
- print("| in the 15th and a chest in the 16th |")
- print("| |")
- print("+-------------------------------------+")
- ---------------------------------------
- -- basic functions for turtle control -
- ---------------------------------------
- local function gf() while not turtle.forward() do end end
- local function gb() while not turtle.back() do end end
- local function gu() while not turtle.up() do end end
- local function gd() while not turtle.down() do end end
- local function gl() while not turtle.turnLeft() do end end
- local function gr() while not turtle.turnRight() do end end
- local function df() turtle.dig() end
- local function du() turtle.digUp() end
- local function dd() turtle.digDown() end
- local function pf() turtle.place() end
- local function pu() turtle.placeUp() end
- local function pd() turtle.placeDown() end
- local function sf() turtle.suck() end
- local function su() turtle.suckUp() end
- local function sd() turtle.suckDown() end
- local function Df() turtle.drop() end
- local function Du() turtle.dropUp() end
- local function Dd() turtle.dropDown() end
- local function ss(s) turtle.select(s) end
- ------Resetting itself 1.
- ss(2) if turtle.compare() then df() du() gu() else du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ss(2) if turtle.compare() then df() du() gu() end
- ------Resetting itself 2.
- gd() gd() gd() gd() gd() gd() gd() gd() gd() gd()
- ss(16) if turtle.compare() then os.sleep(0.2) else gr() end
- if turtle.compare() then os.sleep(0.2) else gr() end
- if turtle.compare() then os.sleep(0.2) else gr() end
- if turtle.compare() then os.sleep(0.2) else gr() end
- gr() ss(1) if turtle.detect() then os.sleep(0.2) else if pf() then os.sleep(0.2) else gl() sf(1) gr() pf() end end
- ------Detect growth/harvest
- while true do
- ss(1) if turtle.detect() then os.sleep(0.2) else if pf() then os.sleep(0.2) else gl() sf(1) gr() pf() end end
- ss(2) if turtle.compare() then df() gu() gu() du() df() gu() du() df()
- gu() du() df() gu() du() df() gu() du() df() gu() du() df() gu() df()
- gd() gd() gd() gd() gd() gd() gd() gd()
- ------Refuelling
- function checkFuel()
- if turtle.getFuelLevel() <= 200
- ss(15)
- turtle.refuel(1)
- end
- end
- ------Dropping off items
- ss(2) Dd(turtle.getItemCount(i) - 1)
- gl() ss(1) Df() ss(3) Df() ss(4) Df() ss(1) sf() Dd(turtle.getItemCount(i) - 4)
- ------
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment