Barotrauma
Barotrauma copied to clipboard
Make AI calculate target visibility from the turret muzzle.
Make AI calculate target visibility from the turret muzzle, and add a check that the target is not closer than the muzzle of the turret.
Helps the AI to use turrets with more intimate placement (custom subs).
A good test case is the U-42C from the workshop, which has a rear flak cannon placement that doesn't work well with AI. (Note that a bot-friendly variant is included, but use the default one for testing).
AI seems to work very well with my changes, and I tested a few vanilla subs as well, using freecam and spawning in crawlers and hammerheads. Probably needs more thorough testing still, as any regression in AI shooting things would be pretty catastrophic.