a mask does it only if the people around are wearing masks too.
Well, wearing a mask will do both. In an environment where you have two people, one infected the other not, either one wearing a mask will reduce the risk of the non-infected person contracting the virus. However, if both are wearing masks, the odds of the non-infected person contracting the virus is lower again.
The main purpose of visors is to protect from particles entering the eyes.