Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- chest = peripheral.wrap("front")
- launcher = peripheral.wrap("top")
- function receiveItem()
- id, mes, dis = rednet.receive()
- if mes ~= "report" and mes ~= "disarm" and mes ~= "launch" then
- print("Got message")
- sleep(5)
- if id == 23 then
- print("Taking actions")
- for i = 1, chest.getInventorySize() do
- curItem = chest.getStackInSlot(i)
- if curItem ~= nil then
- if curItem.name == mes then
- chest.pushItem("west",i,1)
- turtle.select(1)
- if turtle.dropUp() then
- return true
- else
- turtle.dropDown()
- return false
- end
- end
- end
- end
- end
- else
- if mes == "report" then
- toSend = launcher.getStackInSlot(1)
- if toSend ~= nil then
- rednet.send(id, toSend.name)
- else
- rednet.send(id, "EMPTY")
- end
- else
- if mes == "disarm" then
- turtle.suckUp()
- turtle.dropDown()
- else
- rs.setOutput("back",true)
- sleep(5)
- rs.setOutput("back",false)
- end
- end
- end
- end
- while true do
- receiveItem()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement