Advertisement
Lupino

brew.lua

Jul 7th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local redstone = component.proxy(component.list("redstone")())
  2.  
  3. local brew_tick = 1
  4. local collect_tick = 0
  5.  
  6. local brew_state = true
  7. local collect_state = false
  8.  
  9. local brew_delay = 24
  10. local collect_delay = 22
  11.  
  12. local brew_pin = 4
  13. local collect_pin = 5
  14.  
  15. redstone.setOutput(brew_pin, 15)
  16. redstone.setOutput(collect_pin, 0)
  17.  
  18. while true do
  19.     computer.pullSignal(1)
  20.     if brew_tick > brew_delay then
  21.         if brew_state then
  22.             redstone.setOutput(brew_pin, 0)
  23.             brew_state = false
  24.             brew_delay = 6
  25.         else
  26.             redstone.setOutput(brew_pin, 15)
  27.             brew_state = true
  28.             brew_delay = 24
  29.         end
  30.         brew_tick = 0
  31.     end
  32.     if collect_tick > collect_delay then
  33.         if collect_state then
  34.             redstone.setOutput(collect_pin, 0)
  35.             collect_state = false
  36.             collect_delay = 22
  37.         else
  38.             redstone.setOutput(collect_pin, 15)
  39.             collect_state = true
  40.             collect_delay = 8
  41.         end
  42.         collect_tick = 0
  43.     end
  44.     brew_tick = brew_tick + 1
  45.     collect_tick = collect_tick + 1
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement