Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --v1.3 by GraySloth 2013-Feb-23 for the miscPeripheral mod with the Feeding Module it feeds animals between 6am and noon in-game time
- --wheat carrot or seeds depending on the animal need to be in the only item in the turtle, and can only use one of those types of food at a time.
- --it sends a redstone signal to output(bottom by default) if it can't find food, it can also be forced to feed manually if a redstone signal is sent to input(bottom by default) and can be set to always feed if alwaysOn is true
- --variables
- local feeder = peripheral.wrap("right")
- --available locations: top, bottom, left, right, front or back
- local input = "bottom" --receives signal for manual feeding
- local output = "bottom" --sends signal when out of food
- local alwaysOn = false --true sets to always feed
- --functions
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function food()
- if turtle.getItemCount(1) == 0 then
- clear()
- print("Needs more food")
- print("Searching for food hold ctrl+t to stop")
- while turtle.getItemCount(1) == 0 do
- redstone.setOutput(output, true)
- for n=2,16 do
- if turtle.getItemCount(1) == 0 then
- turtle.select(n)
- turtle.transferTo(1)
- end
- end
- end
- print("Food selected")
- redstone.setOutput(output, false)
- end
- end
- --Main
- while true do
- if (os.time() > 6) and (os.time() < 12) or (redstone.getInput(input)) or alwaysOn then
- clear()
- print(textutils.formatTime(os.time(),true))
- print("Feeding time!")
- food()
- turtle.select(1)
- feeder.feed()
- os.sleep(1)
- else
- clear()
- print(textutils.formatTime(os.time(),true))
- print("waiting till morning")
- food()
- os.sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment