On the bat, why do we have both an Area2D and a RayCast2D that both detect the player? Wouldn't just the raycast suffice?
As godoterfr explained, they serve different purposes. The ray cast serves as a way to test the line of sight to the target, and the area node controls the area in which the mob considers potential targets.
You can try with just a ray cast, you'll quickly see it's harder to code this without the area,