Enhance auto targeting

- Puts list of possible targets into its own function, so it can be used for throwing & firing.
- Add NPC as possible targets, too.
- Sorts targets by distance to PC.

fixes #2824
fixes #2307 - but for all npc (friendly included), this is currently the case for monsters, too.