Advertisement
Guest User

y

a guest
Apr 7th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. mod = peripheral.wrap("bottom")
  2. sensor = peripheral.wrap("right")
  3.  
  4. mod.open(2)
  5. mod.open(3)
  6.  
  7. while true do
  8.     local event = {os.pullEvent()}
  9.     if event[3] == 3 then
  10.         redstone.setOutput("left", true)
  11.         sleep(1)
  12.         redstone.setOutput("left", false)
  13.     else if event[3] == 2 then
  14.         local count = 0
  15.         for k,v in pairs(sensor.sense()) do
  16.             if v["name"] == "Cow" then
  17.                 count = count + 1
  18.             end
  19.         end
  20.         mod.transmit(2,2,tostring(count))
  21.     end
  22.  
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement