Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cookTime = 6
- orientateDone = 0
- orientateSlot = 5
- potatoSlot = 1
- potatoCompSlot = 13
- beetSlot = 2
- beetCompSlot = 14
- carrotSlot = 3
- carrotCompSlot = 15
- cabbageSlot = 4
- cabbageCompSlot = 16
- stock = 0
- redstoneStopLvl = 7
- redstoneLvl = 0
- function orientate()
- turtle.select(orientateSlot)
- while (orientateDone == 0) do
- turtle.suck(1)
- if turtle.compareTo(potatoCompSlot) then
- turtle.drop(1)
- orientateDone = 1
- print("Found the potato")
- else
- turtle.drop(1)
- turtle.turnLeft()
- end
- end
- end
- function startup()
- orientate()
- turtle.select(potatoSlot)
- turtle.drop(64)
- turtle.turnLeft()
- turtle.select(beetSlot)
- turtle.drop(64)
- turtle.turnLeft()
- turtle.select(carrotSlot)
- turtle.drop(64)
- turtle.turnLeft()
- turtle.select(cabbageSlot)
- turtle.drop(64)
- turtle.turnLeft()
- turtle.select(potatoSlot)
- print("Startup Complete")
- end
- function getPotato()
- turtle.select(potatoSlot)
- while (turtle.getItemCount(potatoSlot) < 1) do
- turtle.suck(1)
- if (turtle.getItemCount(potatoSlot) < 1) then
- sleep(1)
- end
- end
- print("Got potato")
- end
- function getBeet()
- turtle.select(beetSlot)
- while (turtle.getItemCount(beetSlot) < 1) do
- turtle.suck(1)
- if (turtle.getItemCount(beetSlot) < 1) then
- sleep(1)
- end
- end
- print("Got beet")
- end
- function getCarrot()
- turtle.select(carrotSlot)
- while (turtle.getItemCount(carrotSlot) < 1) do
- turtle.suck(1)
- if (turtle.getItemCount(carrotSlot) < 1) then
- sleep(1)
- end
- end
- print("Got carrot")
- end
- function getCabbage()
- turtle.select(cabbageSlot)
- while (turtle.getItemCount(cabbageSlot) < 1) do
- turtle.suck(1)
- if (turtle.getItemCount(cabbageSlot) < 1) then
- sleep(1)
- end
- end
- print("Got cabbage")
- end
- function stockUp()
- getPotato()
- turtle.turnLeft()
- getBeet()
- turtle.turnLeft()
- getCarrot()
- turtle.turnLeft()
- getCabbage()
- turtle.turnLeft()
- print("Fully Stocked! Time to cook :D")
- stock = stock+1
- print("Current stock: " ..stock)
- end
- function cook()
- while (stock > 0) do
- turtle.select(potatoSlot)
- turtle.dropDown()
- turtle.select(beetSlot)
- turtle.dropDown()
- turtle.select(carrotSlot)
- turtle.dropDown()
- turtle.select(cabbageSlot)
- turtle.dropDown()
- print("1 set of ingredients added")
- stock = stock-1
- print("current stock: " ..stock)
- sleep(cookTime)
- end
- end
- function checkRedstoneLvl()
- redstoneLvl = redstone.getAnalogInput("top")
- end
- startup()
- while true do
- checkRedstoneLvl()
- if redstoneLvl < redstoneStopLvl then
- if stock < 1 then
- stockUp()
- else
- cook()
- end
- else
- sleep(10)
- print("The cookpot is full!")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement