Same design as posted above, but added a gradual threshold on its activation so it doesn't automatically target the largest hostile entity around you (if you are average this is not an issue, but it's like with old games that had no max framerate: it works on old computers but on a modern computer they run at such a speed that it's unplayable).