Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --pastebin get 02QNcL4m tree
- --pastebin run 02QNcL4m
- term.clear()
- term.setCursorPos(1,1)
- print("Hurde's Tree Program")
- print("modded by LJack2k")
- print("")
- print("Press ENTER to stop")
- print("")
- print("First slot: The sapling")
- print("Second slot: bonemeal")
- print("Fourth slot: The wood type you want")
- print("Fifth till sixteen: fuel")
- function plant()
- turtle.select(1)
- if not turtle.compare() then
- turtle.place()
- end
- end
- function grow()
- turtle.select(4)
- if not turtle.compare() then
- turtle.select(2)
- turtle.place()
- end
- end
- function hak()
- while turtle.detectUp() do
- turtle.digUp()
- turtle.up()
- end
- while not turtle.detectDown() do
- turtle.down()
- end
- turtle.back()
- end
- function fuel()
- if turtle.getFuelLevel() < 100 then
- for i = 5, 16 do -- loop through the slots
- turtle.select(i) -- change to the slot
- if turtle.refuel(0) then -- if it's valid fuel
- local halfStack = math.ceil(turtle.getItemCount(i)/2) -- work out half of the amount of fuel in the slot
- turtle.refuel(halfStack) -- consume half the stack as fuel
- end
- end
- end
- end
- function program()
- while true do
- fuel()
- plant()
- turtle.select(4)
- if turtle.compare() then
- turtle.dig()
- turtle.forward()
- hak()
- else
- grow()
- end
- sleep(0.5)
- end
- end
- function exitProgram()
- repeat
- local ev, key = os.pullEvent('key')
- until key == keys.enter
- end
- parallel.waitForAny(program, exitProgram)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement