It's based on the settings of sides and alliances.
This is the only way to do it, and it's ultimately a limitation of the game engine.
If you're not happy with this, then I can set it to fire at any submerged contact. It's easy to change, however, probably a less accurate modeling of the weapon for most circumstances.
Cheers,
David
__________________
LW

|