I still think the original problem mentioned needs looking at -- even if it is set in the table that a ship can only fire 4 turrets at once, it should be smart enough to realize "oh, those blob turrets are out of range, let's fire something else". Or maybe a customizable priority could be added, in which we could specify "beams before everything". I'm taking a look, but I'm fairly certain it won't be nearly as easy a fix.
Agreed on all counts. Nice work, btw.

Also interesting thing is the usage of 'aip->ai_class' in the code. Apparently - remember i could well be wrong, even though the comments in the code seem to agree with my judgment - it is the index value of the ai class. And it is used also in certain ai checks. Basically this means that for example (BtRL) Cylon AI set to 1st AI slot in the ai.tbl will have different behavior from the identical Cylon AI set to next to last slot (remembering traitor slot) - which certainly does not make AI tweaking any easier.
I think the code assumes that AI classes will be arranged from easiest to hardest. But yeah, that should really be recoded (with proper flags in ai_profiles for compatability).