I believe the answer would be yes because players in the same faction (and I believe another possibility is when they have each other set as friendly on their IFF) share their scanners.
I believe NPCs share their scanners with owners, managers and supervisors and the owner, manager, supervisor in turn shares it with players in the same faction (and the IFF friendlies but on that I am the least confident in saying as fact)
If I am wrong on anything... feel free to correct me anyone.
One time I was able to hit something in range of my rifle but out of range of sight because I refreshed the Attack screen... I had another window open with scanners where I couldn't see the target. It was a creature that I attacked and afterwards it moved out of sight but not out of range. This was with an old character and a one-off so not sure if it's still possible.
That's why you don't attack an NPC or a player with a sniper as a primary or secondary with your sniper, you get in closer or further than their minimum and maximum range. I usually prefer closer to a range of 3. That way shotguns, most medium and all long range guns are useless. Whilst the guns still in range are so weak you can deal with it, besides not all NPCs have a gun that can damage at a range 3 whilst you and your squad do.
Once again TL;DR:
Attack bandit squads at range 3 as it's the best range (in my opinion) to take the least amount of damage, have the least amount of guns firing at you and deal some good damage back.
“It should probably be changed to consider whether the attacker is in vision for the counterattack. ”
That might not be a good idea, Mikel. Bandits have the same skills as military NPC's, correct? If so they will have a very low or nonexistent perception skill. There are only two bandit fitouts that have macrobinoculars and neither fitout has a weapon with a range greater than 6.
Meaning a player/squad equipped with any weapon that has a range of 7+ would be able to kill bandits without being counterattacked. It is not perfect but allowing counterattacks regardless of vision range is a more balanced mechanic. Otherwise the bandit's vision range would need to be adjusted to be equal to the maximum range of their furthest shooting weapon.
Apply a bit of code to ensure that any/all A280/X-45/Nightstinger wielding peasants are automatically equipped with Macrobinoculars. Alternatively, at least one of the party is equipped with them - say, a scout, hired explicitly for the sniper's use - and elimination of said scout results in damaged combat capability. You know, like real combat.
A bandit with a perception of 5 and macrobinoculars would have a range of 10, I believe. The only way to fully use sniper rifles is to have scouts and sensor packs. There is no way for a single person, NPC or otherwise, to reach 11+ weapon range on their own.
Macros add 5. Perception 0 gives vision 3. Macros + Perception 0 = 8 vision range. Ie. a bandit would never hit with a sniper, macros or not. I agree with Dol. It's not perfect as it is, but taking away out-of-range counterattack would lead to more balance issues.
"Apply a bit of code to ensure that any/all A280/X-45/Nightstinger wielding peasants are automatically equipped with Macrobinoculars."
This would be manually making sure the Fitouts that include A280s, X-45s, and Nightstingers have MacroBinocs equipped.. Wait... head, BELT or utility ? They'll still add perception if they're on your Belt?
In any event, I lean towards leaving it with the auto-counterattack regardless of vision. Barring a robust AI that has PCs and NPCs alike Moving towards or away from danger, it seems like too big an advantage.