Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- holderUp = "top"
- holderDown = "left"
- feedback = "right"
- activator = "back"
- swapper = "front"
- networkSide = "bottom"
- rednet.open(networkSide)
- function waitForFlyer()
- timeout = 1200
- while timeout>=0 do
- timeout = timeout - 1
- if redstone.getInput(feedback) then
- print("triggered")
- return true
- end
- sleep(0.05)
- end
- print("flyer wait timed out")
- return false
- end
- function sendFlying()
- redstone.setOutput(activator,true)
- sleep(0.05)
- redstone.setOutput(activator,false)
- end
- rednet.open(networkSide)
- while rednet.isOpen() do
- senderID,message,distance,protcol = rednet.receive()
- print(message.command)
- if message.command == "interceptor.flyer.catch" then
- redstone.setOutput(holderUp,true)
- redstone.setOutput(holderDown,false)
- if waitForFlyer() then
- redstone.setOutput(holderDown,true)
- redstone.setOutput(holderUp,false)
- sleep(0.4)
- redstone.setOutput(holderDown,false)
- redstone.setOutput(swapper,true)
- sleep(1)
- redstone.setOutput(swapper,false)
- else
- print("flyer timed out")
- rednet.broadcast({command="interceptor.flyer.timeout"})
- redstone.setOutput(holderUp,true)
- redstone.setOutput(holderDown,false)
- end
- rednet.broadcast({command="interceptor.flyer.arrived"})
- end
- if message.command == "interceptor.flyer.reattach" then
- redstone.setOutput(holderDown,true)
- if waitForFlyer() then
- sleep(2)
- redstone.setOutput(holderDown,false)
- redstone.setOutput(swapper,true)
- redstone.setOutput(holderUp,true)
- sleep(2)
- redstone.setOutput(holderUp,false)
- sleep(1)
- redstone.setOutput(swapper,false)
- else
- print("flyer timed out")
- rednet.broadcast({command="interceptor.flyer.timeout"})
- redstone.setOutput(holderDown,false)
- end
- rednet.broadcast({command="interceptor.flyer.attached"})
- end
- if message.command == "interceptor.flyer.start" then
- sendFlying()
- end
- end
- print("rednet closed... terminating")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement