I've been running through some ideas in the Suggestion Box on chaff/flare launchers and I think I've got a working solution.
How It Works
It comes in two parts: a chaff dispenser fitted permanently to the ship, and a 5-bundle refill that comes in the form of a mine. Each time you fire off a bundle of chaff the dispenser will be reloaded, with the icon popping up again on the HUD, until the stock has been exhausted. To get more, you'll need to buy another refill from your nearest friendly shipyard.
At the moment, refills can only be fitted in dock, so even if you buy say three 'mines' before setting out, the contents of only one of them can be automatically loaded into the dispenser. While I could probably do a load of complex scripting to get around this, I think this sounds like a reasonable compromise. Also it means keeping your other pylons free for missiles and fuel tanks.
At the moment, I haven't prevented a chaff refill from being used without a dispenser. Used in this way, the chaff mine reverts to being a one-shot device, which could be an option for those who can't afford all the equipment.
I didn't want people to constantly have a pylon taken up by the mine, so you're free to remove it as you would any other weapon. The chaff_count will be retained, so you need only buy another refill to start using the dispenser again.
Now there may be easier ways to implement this - some of the obvious methods I thought would work didn't seem to (e.g. using awardEquipment as a death action). However, even after adding more variables than I would like, it doesn't cause any significant slowdown. Suggestions are welcome of course. One thing I might do is to have the chaff launched directly rather than having the mine ejected first - I'll need to set up another AI for this but that should be straightforward enough.
Thanks to Commanders Maegil and McLane for their suggestions and help on this, and everyone else for their encouragement.
Missile and Bombs v0.4
I've included the remote controlled mine in here as well - watch out as I've made it insanely powerful!
Now I'm off to see some fireworks!