Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Sheep shearing program for shearing turtle
- -- Fuel must be provided in a chest directly above the turtle
- -- Collected wool is placed in the chest directly under the turtle
- cycles = 0
- totalwool = 0
- local function shear()
- turtle.attack()
- turtle.turnRight()
- turtle.attack()
- turtle.turnRight()
- turtle.attack()
- turtle.turnRight()
- turtle.attack()
- turtle.turnRight()
- end
- local function updateterm()
- term.clear()
- print("---------------------------------")
- write("Cycles: ")
- write(cycles)
- write(" | ")
- write("Total Wool: ")
- write(totalwool)
- print("---------------------------------")
- print("")
- end
- local function getFuel()
- turtle.select(16)
- while turtle.getItemCount(16) < 2 do
- redstone.setOutput("top", true)
- sleep(5)
- redstone.setOutput("top", false)
- turtle.suckUp(63)
- os.sleep(1)
- if turtle.getItemCount(16) < 2 then
- print("I need more fuel in above chest")
- print("Waiting 30 seconds before checking again")
- os.sleep(30)
- end
- end
- end
- local function checkFuel()
- while turtle.getFuelLevel() < 10 do
- getFuel()
- turtle.select(16)
- turtle.refuel(1)
- end
- end
- local function storeWool()
- storecheck = false
- -- while storecheck == false do
- for i=1,15,1 do
- if turtle.getItemCount(i) > 0 then
- turtle.select(i)
- totalwool = totalwool + turtle.getItemCount(i)
- storecheck = not turtle.dropDown()
- end
- end
- -- end
- if storagespace == false then
- print("The inventory is full I can't store my harvest")
- print("Waiting 30 seconds before checking again")
- os.sleep(30)
- end
- end
- while true do
- checkFuel()
- shear()
- storeWool()
- cycles = cycles + 1
- updateterm()
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement