Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Vidéo : https://youtu.be/bvMwtWKyIHg
- local fermier1=101
- local fermier2=102
- local ordi=100
- local modem=peripheral.wrap("back")
- function msgEtAttente(id,msg)
- modem.transmit(id,ordi,msg)
- pasok=true
- while pasok do
- local e, m, sc, rc, msg, sd = os.pullEvent("modem_message")
- print(msg..' '..rc)
- if msg=='ok' and rc == id then
- pasok=false
- end
- end
- end
- modem.open(ordi)
- local lecture=false
- function boulot()
- while true do
- while lecture==false do
- os.sleep(3)
- end
- msgEtAttente(fermier1,'premier')
- while lecture do
- msgEtAttente(fermier2,'recolte')
- if lecture then msgEtAttente(fermier1,'recolte') end
- end
- modem.transmit(fermier2,ordi,'fin')
- modem.transmit(fermier1,ordi,'fin')
- end
- end
- function ecoute()
- while true do
- local event = os.pullEvent("redstone")
- print(rs.getInput("right"))
- if rs.getInput("right") then
- lecture=true
- else
- lecture=false
- end
- end
- end
- parallel.waitForAll(boulot,ecoute)
Add Comment
Please, Sign In to add comment